2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

add 'del' and 'delfirst' options

This commit is contained in:
Philip Sargent 2021-04-15 14:27:16 +01:00
parent 0fee2bb165
commit 7124d978d3

View File

@ -211,6 +211,20 @@ class JobQueue():
self.results[j].append(None) # append a placeholder
return True
def dellastprofile(self):
"""trim one set of data from the results
"""
for j in self.results_order:
self.results[j].pop() # delete last item
return True
def delfirstprofile(self):
"""trim one set of data from the results
"""
for j in self.results_order:
self.results[j].pop(0) # delete zeroth item
return True
def saveprofiles(self):
"""Save timings for the set of imports just completed
"""
@ -323,7 +337,9 @@ def usage():
print("""Usage is 'python databaseReset.py <command> [runlabel]'
where command is:
test - testing... imports people and prints profile. Deletes nothing.
profile - print the profile from previous runs. Import nothing.
profile - print the profile from previous runs. Import nothing.
- del - deletes last entry
- delfirst - deletes first entry
reset - normal usage: clear database and reread everything from files - time-consuming
@ -403,8 +419,21 @@ if __name__ == "__main__":
# elif "writecaves" in sys.argv: # untested in 2020 - will overwrite input files!!
# writeCaves()
elif "profile" in sys.argv:
jq.loadprofiles()
jq.showprofile()
if runlabel == 'del' :
jq.loadprofiles()
jq.dellastprofile()
jq.dellastprofile() # twice because loadprofiles adds a dummy
jq.showprofile()
jq.saveprofiles()
if runlabel == 'delfirst' :
jq.loadprofiles()
jq.dellastprofile() # remove the dummy
jq.delfirstprofile()
jq.showprofile()
jq.saveprofiles()
else:
jq.loadprofiles()
jq.showprofile()
exit()
elif "help" in sys.argv:
usage()