Skip to content

Commit 99655eb

Browse files
author
Joel Collins
committed
Changed action status messages
1 parent bf41b50 commit 99655eb

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/labthings/actions/thread.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@ def status(self):
117117
============== =============================================
118118
``pending`` Not yet started
119119
``running`` Currently in-progress
120-
``success`` Finished without error
120+
``completed`` Finished without error
121+
``cancelled`` Thread stopped after a cancel request
121122
``error`` Exception occured in thread
122-
``stopped`` Thread finished cleanly after a stop request
123-
``terminated`` Thread killed after stop request timed out
124123
============== =============================================
125124
"""
126125
return self._status
@@ -194,11 +193,11 @@ def wrapped(*args, **kwargs):
194193
self.started.set()
195194
try:
196195
self._return_value = f(*args, **kwargs)
197-
self._status = "success"
196+
self._status = "completed"
198197
except (ActionKilledException, SystemExit) as e:
199198
logging.error(e)
200-
# Set state to terminated
201-
self._status = "terminated"
199+
# Set state to stopped
200+
self._status = "cancelled"
202201
self.progress = None
203202
except Exception as e: # skipcq: PYL-W0703
204203
logging.error(e)
@@ -294,8 +293,8 @@ def terminate(self, exception=ActionKilledException):
294293
while self._is_thread_proc_running():
295294
pass
296295

297-
# Set state to terminated
298-
self._status = "terminated"
296+
# Set state to stopped
297+
self._status = "cancelled"
299298
self.progress = None
300299
return True
301300

@@ -318,7 +317,7 @@ def stop(self, timeout=None, exception=ActionKilledException):
318317
# If the thread has stopped
319318
if not self.is_alive():
320319
# Break
321-
self._status = "stopped"
320+
self._status = "cancelled"
322321
return True
323322
# If the timeout tracker stopped before the thread died, kill it
324323
logging.warning(f"Forcefully terminating thread {self}")

0 commit comments

Comments
 (0)