forked from goodboy/tractor
1
0
Fork 0

Allow for error bypass

implicit_runtime
Tyler Goodlet 2021-01-02 21:35:13 -05:00
parent 803152ead5
commit bd3059f01b
1 changed files with 3 additions and 2 deletions

View File

@ -15,11 +15,12 @@ _runtime_vars: Dict[str, Any] = {
} }
def current_actor() -> 'Actor': # type: ignore def current_actor(err_on_no_runtime: bool = True) -> 'Actor': # type: ignore
"""Get the process-local actor instance. """Get the process-local actor instance.
""" """
if _current_actor is None: if _current_actor is None and err_on_no_runtime:
raise RuntimeError("No local actor has been initialized yet") raise RuntimeError("No local actor has been initialized yet")
return _current_actor return _current_actor