docstrings added

This commit is contained in:
Philip Sargent 2022-12-23 00:49:22 +00:00
parent a72c2bd96a
commit 9c39c9dcff

View File

@ -19,7 +19,7 @@ troggle application.
"""
print(" - settings on loading databaseReset.py", flush=True)
os.environ['PYTHONPATH'] = settings.PYTHON_PATH
os.environ['PYTHONPATH'] = str(settings.PYTHON_PATH)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
print(" - settings on loading databaseReset.py")
@ -153,6 +153,8 @@ def reinit_db():
#raise
def memdumpsql(fn):
'''Unused option to dump SQL. Aborted attempt to create a cache for loading data
'''
djconn = django.db.connection
from dump import _iterdump
with open(fn, 'w') as f:
@ -168,6 +170,9 @@ class JobQueue():
"""
def __init__(self,run):
'''Initialises the job queue object with a fixed order for reporting
options during a run. Imports the timings from previous runs.
'''
self.runlabel = run
self.queue = [] # tuples of (jobname, jobfunction)
self.results = {}
@ -180,8 +185,10 @@ class JobQueue():
self.tfile = "import_profile.json"
self.htmlfile = "profile.html" # for HTML results table. Not yet done.
#Adding elements to queue - enqueue
def enq(self,label,func):
'''Enqueue: Adding elements to queue
'''
self.queue.append((label,func))
return True
@ -257,6 +264,8 @@ class JobQueue():
def append_placeholders(self):
'''Ads a dummy timing for each option, to fix off by one error
'''
for j in self.results_order:
self.results[j].append(None) # append a placeholder
@ -326,6 +335,8 @@ class JobQueue():
def usage():
'''Prints command line options, can print history of previous runs with timings
'''
print("""Usage is 'python databaseReset.py <command> [runlabel]'
where command is:
test - testing... imports people and prints profile. Deletes nothing.