Skip to content

Commit

Permalink
move setting up job after move into manager (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelwi authored May 16, 2024
1 parent 0ddc98a commit a5ddfaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions sisyphus/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def __new__(cls: Type[T], *args, **kwargs) -> T:

# Init
def _sis_init(self, args, kwargs, parsed_args):

for key, arg in parsed_args.items():
if isinstance(arg, Job):
logging.warning(
Expand Down Expand Up @@ -793,17 +792,14 @@ def _sis_print_error(self, tasks=1, lines=0):
task.print_error(lines)

def _sis_move(self) -> None:
"""Move job directory a side and set up a new one"""
"""Move job directory aside"""
path = self._sis_path()
i = 1
while os.path.isdir("%s.cleared.%04i" % (path, i)):
i += 1
trash_path = "%s.cleared.%04i" % (path, i)
logging.info("Move: %s to %s" % (path, trash_path))
os.rename(path, trash_path)
self._sis_setup_directory()
for t in self._sis_tasks():
t.reset_cache()

def _sis_delete(self) -> None:
"""Delete job directory"""
Expand Down
3 changes: 3 additions & 0 deletions sisyphus/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def clear_states(self, state=gs.STATE_ERROR):
for job in self.jobs[state]:
logging.warning("Clearing: %s" % job)
job._sis_move()
job._sis_setup_directory()
for t in job._sis_tasks():
t.reset_cache()
job_cleared = True
self.update_jobs()
return job_cleared
Expand Down

0 comments on commit a5ddfaa

Please sign in to comment.