summaryrefslogtreecommitdiff
path: root/taskflow/utils/threading_utils.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-09-12 18:49:29 -0700
committerJoshua Harlow <harlowja@gmail.com>2014-12-19 20:48:23 -0800
commit2a8fde1798dbcaab53d0a1aba9740f729ba64f83 (patch)
tree5775cedd629a9892cb06df0615bcefb7995577d1 /taskflow/utils/threading_utils.py
parent1467772a7b898442b5e69797f9c5616872d8238b (diff)
downloadtaskflow-2a8fde1798dbcaab53d0a1aba9740f729ba64f83.tar.gz
Get the basics of a process executor working
Since we support various executors (threaded and distributed) the next best executor when a threaded executor will not perform and a distributed one requires to much setup is a local process based one so it would be great to support this where we can. Things that are currently (likely never) not going to work: * Non-pickleable/non-copyable tasks * Tasks that return non-pickleable/non-copyable results * Tasks that use non-pickleable/non-copyable args/kwargs Part of blueprint process-executor Change-Id: I966ae01d390c7217b858db3feb2db949ce5c08d1
Diffstat (limited to 'taskflow/utils/threading_utils.py')
-rw-r--r--taskflow/utils/threading_utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/taskflow/utils/threading_utils.py b/taskflow/utils/threading_utils.py
index b3749bc..5048401 100644
--- a/taskflow/utils/threading_utils.py
+++ b/taskflow/utils/threading_utils.py
@@ -40,6 +40,13 @@ else:
Event = threading.Event
+def is_alive(thread):
+ """Helper to determine if a thread is alive (handles none safely)."""
+ if not thread:
+ return False
+ return thread.is_alive()
+
+
def get_ident():
"""Return the 'thread identifier' of the current thread."""
return _thread.get_ident()