diff options
Diffstat (limited to 'databaseReset.py')
-rw-r--r-- | databaseReset.py | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/databaseReset.py b/databaseReset.py index 5165440..a7fc8c6 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -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() |