Skip to content

Commit

Permalink
sis manager, option to setup runnable jobs
Browse files Browse the repository at this point in the history
Also some extra logging for all the options.

Also renamed "holded" -> "held".

Also reordered the options in UI a bit,
so that the most common (start manager) is first.
Same order then also in the code.
  • Loading branch information
albertz committed Jan 23, 2025
1 parent a7a0165 commit e5ed56a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions sisyphus/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def input(self, prompt):
ret = input(prompt)
return ret

def setup_holded_jobs(self):
def setup_held_jobs(self):
# Find all jobs in hold state and set them up.
# _sis_setup_directory can be called multiple times, it will only create the directory once
self.thread_pool.map(lambda job: job._sis_setup_directory(), self.jobs.get(gs.STATE_HOLD, []))
Expand Down Expand Up @@ -546,27 +546,36 @@ def maybe_clear_state(state, always_clear, action):
while True and not self.ui:
if answer is None:
pass
elif answer.lower() == "v":
self.print_state_overview(verbose=True)
elif answer.lower() == "y":
logging.info("Start manager")
self.link_outputs = True
self.thread_pool.apply_async(create_aliases, (self.sis_graph.jobs(),))
self.thread_pool.apply_async(
self.check_output,
kwds={"write_output": self.link_outputs, "update_all_outputs": True, "force_update": True},
)
break
elif answer.lower() == "v":
self.print_state_overview(verbose=True)
elif answer.lower() == "u":
logging.info("Update outputs and aliases")
self.link_outputs = True
create_aliases(self.sis_graph.jobs())
self.check_output(write_output=self.link_outputs, update_all_outputs=True, force_update=True)
elif answer.lower() == "s":
logging.info("Setup runnable jobs")
for job in self.jobs.get(gs.STATE_RUNNABLE, []):
logging.info(f"Setup: {job}")
job._sis_setup_directory()
elif answer.lower() == "n":
logging.info("Exit manager")
self.stop()
return False
else:
logging.warning("Unknown command: %s" % answer)
answer = self.input(
"Print verbose overview (v), update aliases and outputs (u), " "start manager (y), or exit (n)? "
"Start manager (y), print verbose overview (v), update aliases and outputs (u),"
" setup runnable jobs (s), or exit (n)? "
)

if (not self._stop_loop) and (gs.CLEAR_ERROR or self.clear_errors_once):
Expand Down Expand Up @@ -626,7 +635,7 @@ def run(self):
logging.debug("Wait for %i seconds" % gs.WAIT_PERIOD_BETWEEN_CHECKS)
time.sleep(gs.WAIT_PERIOD_BETWEEN_CHECKS)

self.setup_holded_jobs()
self.setup_held_jobs()
self.resume_jobs()
self.run_jobs()

Expand Down

0 comments on commit e5ed56a

Please sign in to comment.