1
0
Fork 0
tractor/tractor/_state.py

16 lines
339 B
Python
Raw Normal View History

2018-07-14 20:09:05 +00:00
"""
Per process state
"""
2018-08-31 21:16:24 +00:00
from typing import Optional
2018-07-14 20:09:05 +00:00
2018-08-31 21:16:24 +00:00
_current_actor: Optional['Actor'] = None # type: ignore
def current_actor() -> 'Actor': # type: ignore
2018-07-14 20:09:05 +00:00
"""Get the process-local actor instance.
"""
if not _current_actor:
raise RuntimeError("No actor instance has been defined yet?")
2018-07-14 20:09:05 +00:00
return _current_actor