01234567890123456789012345678901234567890123456789012345678901234567890123456789
123 4567891011121314151617181920212223 69366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961 69626963696469656966696769686969697069716972697369746975697669776978697969806981 | #!/usr/bin/python3 import datetime import io import json import math import multiprocessing import numbers import os import pickle import queue import re import shutil import signal import statistics import sys import textwrap import time import tracemalloc import bs4 import dateutils import numpy <----SKIPPED LINES----> enabled and we dump the configuration every time iteration is evenly divisible by 1000 times the 'memory' setting (because the setting as described on the settings.php page is in thousands of iterations). Args: configuration: dictionary of configuration attributes. iteration: counter that indicates how many times through the main loop we are. main_start_time: time stamp of when the program first started, to be recorded in file names, so that associated memory dumps can be more easily grouped, analyzed, and purged together. initial_frame_count: frame count used to initialize the tracemalloc; note that anything greater than 1 has implications for how comparisons can be done. """ iteration_divisor = configuration.get('memory', 0) if not iteration_divisor: return if not iteration % (iteration_divisor * 1000): main_time_stamp = EpochDisplayTime( main_start_time, format_string='%m%d%H%M%S') this_time_stamp = EpochDisplayTime( time.time(), format_string='%Y%m%d%H%M') file_name = '%s-%s-%d-%d.dump' % ( main_time_stamp, this_time_stamp, iteration, initial_frame_count) full_path_name = os.path.join(MEMORY_DIRECTORY, file_name) snapshot = tracemalloc.take_snapshot() snapshot.dump(full_path_name) def main(): """Traffic cop between radio, configuration, and messageboard. This is the main logic, checking for new flights, augmenting the radio signal with additional web-scraped data, and generating messages in a form presentable to the messageboard. """ VersionControl() # Since this clears log files, it should occur first before we start logging if '-s' in sys.argv: global SIMULATION_COUNTER SimulationSetup() last_heartbeat_time = HeartbeatRestart() init_timing = [(time.time(), 0)] <----SKIPPED LINES----> |
01234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789101112131415161718192021222324 69376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983 | #!/usr/bin/python3 import datetime import gc import io import json import math import multiprocessing import numbers import os import pickle import queue import re import shutil import signal import statistics import sys import textwrap import time import tracemalloc import bs4 import dateutils import numpy <----SKIPPED LINES----> enabled and we dump the configuration every time iteration is evenly divisible by 1000 times the 'memory' setting (because the setting as described on the settings.php page is in thousands of iterations). Args: configuration: dictionary of configuration attributes. iteration: counter that indicates how many times through the main loop we are. main_start_time: time stamp of when the program first started, to be recorded in file names, so that associated memory dumps can be more easily grouped, analyzed, and purged together. initial_frame_count: frame count used to initialize the tracemalloc; note that anything greater than 1 has implications for how comparisons can be done. """ iteration_divisor = configuration.get('memory', 0) if not iteration_divisor: return if not iteration % (iteration_divisor * 1000): main_time_stamp = EpochDisplayTime( main_start_time, format_string='%Y%m%d%H%M') this_time_stamp = EpochDisplayTime( time.time(), format_string='%m%d%H%M%S') file_name = '%s-%s-%d-%d.dump' % ( main_time_stamp, this_time_stamp, iteration, initial_frame_count) full_path_name = os.path.join(MEMORY_DIRECTORY, file_name) gc.collect() snapshot = tracemalloc.take_snapshot() snapshot.dump(full_path_name) def main(): """Traffic cop between radio, configuration, and messageboard. This is the main logic, checking for new flights, augmenting the radio signal with additional web-scraped data, and generating messages in a form presentable to the messageboard. """ VersionControl() # Since this clears log files, it should occur first before we start logging if '-s' in sys.argv: global SIMULATION_COUNTER SimulationSetup() last_heartbeat_time = HeartbeatRestart() init_timing = [(time.time(), 0)] <----SKIPPED LINES----> |