Skip to content

Commit

Permalink
Fail if process exited with non-zero status.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Aug 15, 2022
1 parent afb49af commit aa20057
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
3 changes: 0 additions & 3 deletions aiidalab_ispg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,4 @@
"ViewSpectrumStep",
]

# WARNING: This needs to be kept in sync with version
# in setup.cfg
# TODO: Take a look and how aiidalab-qe and other packages do it.
__version__ = "0.1-alpha"
36 changes: 21 additions & 15 deletions aiidalab_ispg/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,18 +533,22 @@ def reset(self):
def _update_state(self):
if self.process is None:
self.state = self.State.INIT
else:
process_state = self.process.process_state
if process_state in (
ProcessState.CREATED,
ProcessState.RUNNING,
ProcessState.WAITING,
):
self.state = self.State.ACTIVE
elif process_state in (ProcessState.EXCEPTED, ProcessState.KILLED):
self.state = self.State.FAIL
elif process_state is ProcessState.FINISHED:
self.state = self.State.SUCCESS
return

process_state = self.process.process_state
if process_state in (
ProcessState.CREATED,
ProcessState.RUNNING,
ProcessState.WAITING,
):
self.state = self.State.ACTIVE
elif (
process_state in (ProcessState.EXCEPTED, ProcessState.KILLED)
or self.process.is_failed
):
self.state = self.State.FAIL
elif process_state is ProcessState.FINISHED and self.process.is_finished_ok:
self.state = self.State.SUCCESS

@traitlets.observe("process")
def _observe_process(self, change):
Expand Down Expand Up @@ -631,17 +635,19 @@ def _update_state(self):
self.state = self.State.INIT
return

process_state = self.process.process_state
process_state = self.process.process_state
if process_state in (
ProcessState.CREATED,
ProcessState.RUNNING,
ProcessState.WAITING,
):
self.state = self.State.ACTIVE
elif process_state in (ProcessState.EXCEPTED, ProcessState.KILLED):
elif (
process_state in (ProcessState.EXCEPTED, ProcessState.KILLED)
or self.process.is_failed
):
self.state = self.State.FAIL
elif process_state is ProcessState.FINISHED:
elif process_state is ProcessState.FINISHED and self.process.is_finished_ok:
self.state = self.State.SUCCESS

@traitlets.observe("process")
Expand Down

0 comments on commit aa20057

Please sign in to comment.