Skip to content

Commit c3f0995

Browse files
committed
debug logger when state change
1 parent d524e63 commit c3f0995

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/plumpy/base/state_machine.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ def transition_to(self, new_state: State | None, **kwargs: Any) -> None:
312312
The arguments are passed to the state class to create state instance.
313313
(process arg does not need to pass since it will always call with 'self' as process)
314314
"""
315-
print(f'try: {self._state} -> {new_state}')
316315
assert not self._transitioning, 'Cannot call transition_to when already transitioning state'
317316

318317
if new_state is None:

src/plumpy/processes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ def on_entered(self, from_state: Optional[state_machine.State]) -> None:
748748
elif state_label == process_states.ProcessState.KILLED:
749749
call_with_super_check(self.on_killed)
750750

751-
if self._coordinator and isinstance(self.state, enum.Enum):
751+
if self._coordinator and isinstance(self.state_label, enum.Enum):
752752
from_label = cast(enum.Enum, from_state.LABEL).value if from_state is not None else None
753753
subject = f'state_changed.{from_label}.{self.state_label.value}'
754754
self.logger.info('Process<%s>: Broadcasting state change: %s', self.pid, subject)
@@ -1342,7 +1342,6 @@ async def step(self) -> None:
13421342
self._stepping = True
13431343
next_state = None
13441344
try:
1345-
# XXX: debug log when need to step to next state
13461345
next_state = await self._run_task(self._state.execute)
13471346
except process_states.Interruption as exception:
13481347
# If the interruption was caused by a call to a Process method then there should
@@ -1368,6 +1367,7 @@ async def step(self) -> None:
13681367
self._interrupt_action.run(next_state)
13691368
else:
13701369
# Everything nominal so transition to the next state
1370+
self.logger.debug(f'Process<{self.pid}>: transfer from {self._state.LABEL} to {next_state.LABEL}')
13711371
self.transition_to(next_state)
13721372

13731373
finally:

tests/test_processes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def test_kill(self):
331331
proc.kill(msg_text=msg_text)
332332
self.assertTrue(proc.killed())
333333
self.assertEqual(proc.killed_msg()[MESSAGE_TEXT_KEY], msg_text)
334-
self.assertEqual(proc.state, ProcessState.KILLED)
334+
self.assertEqual(proc.state_label, ProcessState.KILLED)
335335

336336
def test_wait_continue(self):
337337
proc = utils.WaitForSignalProcess()

0 commit comments

Comments
 (0)