diff options
Diffstat (limited to 'lorrycontroller/workingstate.py')
-rw-r--r-- | lorrycontroller/workingstate.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lorrycontroller/workingstate.py b/lorrycontroller/workingstate.py index 2064005..c4b031f 100644 --- a/lorrycontroller/workingstate.py +++ b/lorrycontroller/workingstate.py @@ -58,6 +58,8 @@ class WorkingStateManager(object): def _load_state(self): self.lorry_state_file = os.path.join(self.workdir, "last-lorry-state.json") + self.trove_state_file = os.path.join(self.workdir, + "last-trove-state.json") if os.path.exists(self.lorry_state_file): logging.debug("Loading state file: %s" % self.lorry_state_file) with open(self.lorry_state_file, "r") as fh: @@ -65,11 +67,22 @@ class WorkingStateManager(object): else: self.lorry_state = dict() + if os.path.exists(self.trove_state_file): + logging.debug("Loading state file: %s" % self.trove_state_file) + with open(self.trove_state_file, "r") as fh: + self.trove_state = json.load(fh) + else: + self.trove_state = dict() + def save_state(self): logging.debug("Serialising state: %s" % self.lorry_state_file) with open(self.lorry_state_file, "w") as fh: json.dump(self.lorry_state, fh, sort_keys=True, indent=4) fh.write("\n") + logging.debug("Serialising state: %s" % self.trove_state_file) + with open(self.trove_state_file, "w") as fh: + json.dump(self.trove_state, fh, sort_keys=True, indent=4) + fh.write("\n") def runner(self, lorryname): return LorryFileRunner(self, lorryname) |