This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from timeit import default_timer as timer | |
| from memory_profiler import profile | |
| # from multiprocessing.pool import Pool | |
| from multiprocessing import Pool | |
| from django.core.management.base import BaseCommand | |
| from core.models import CoreData | |
| from core.documents import CoreDataDocument | |
| SLICES = 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # file: core/management/commands/bench_po.py | |
| from timeit import default_timer as timer | |
| from memory_profiler import profile | |
| from django.core.management.base import BaseCommand | |
| from core.models import CoreData | |
| class Command(BaseCommand): | |
| def add_arguments(self, parser): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging.config | |
| import os | |
| from django.utils.log import DEFAULT_LOGGING | |
| # Disable Django's logging setup | |
| LOGGING_CONFIG = None | |
| LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper() | |
| logging.config.dictConfig({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class RequestResponseDebugMixin: | |
| def list(self, request, *args, **kwargs): | |
| import time | |
| global serializer_time | |
| global db_time | |
| db_start = time.time() | |
| queryset_list = list(self.filter_queryset(self.get_queryset())) | |
| db_time = time.time() - db_start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| from select import select | |
| to_monitor = [] | |
| # domain:port - socket | |
| server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
| server_socket.bind(('localhost', 5000)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| killall -9 rosout roslaunch rosmaster gzserver nodelet robot_state_publisher gzclient | |