Skip to content

Commit

Permalink
more stop job fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKraus committed Jul 21, 2024
1 parent 90f8065 commit 3e81920
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/tomato/daemon/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def stop(msg: dict, daemon: Daemon) -> Reply:
io.store(daemon)
if any([pip.jobid is not None for pip in daemon.pips.values()]):
logger.error("cannot stop tomato-daemon as jobs are running")
return Reply(success=False, data=daemon)
return Reply(success=False, msg="jobs are running", data=daemon.jobs)
else:
daemon.status = "stop"
logger.critical("stopping tomato-daemon")
return Reply(success=True, data=daemon.status)
return Reply(success=True)


def setup(msg: dict, daemon: Daemon) -> Reply:
Expand Down
19 changes: 1 addition & 18 deletions src/tomato/tomato/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,24 +249,7 @@ def stop(
req.connect(f"tcp://127.0.0.1:{port}")
req.send_pyobj(dict(cmd="stop"))
rep = req.recv_pyobj()
logger.debug(f"{rep=}")
if rep.data == "stop":
return Reply(
success=True,
msg=f"tomato-daemon on port {port} was instructed to stop",
)
elif rep.data == "running":
return Reply(
success=False,
msg=f"tomato-daemon on port {port} cannot stop as jobs are running",
data=rep.data,
)
else:
return Reply(
success=False,
msg=f"unknown error: {rep}",
data=rep.data,
)
return rep
else:
return stat

Expand Down

0 comments on commit 3e81920

Please sign in to comment.