mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 21:42:22 +00:00
remove run_in_isolation: cannot pickle nested classes
This commit is contained in:
1
openbb_sdk/sdk/core/README.md
vendored
1
openbb_sdk/sdk/core/README.md
vendored
@@ -144,7 +144,6 @@ Update your system settings by modifying the `.openbb_sdk/system_settings.json`
|
||||
|
||||
```{json}
|
||||
{
|
||||
"run_in_isolation": null,
|
||||
"dbms_uri": null
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import multiprocessing
|
||||
import warnings
|
||||
from contextlib import nullcontext
|
||||
from copy import deepcopy
|
||||
@@ -189,16 +188,6 @@ class StaticCommandRunner:
|
||||
logging_manager: LoggingManager = LoggingManager()
|
||||
charting_manager: ChartingManager = ChartingManager()
|
||||
|
||||
@staticmethod
|
||||
def __run_in_isolation(func, args=None, kwargs=None) -> OBBject:
|
||||
args = args or ()
|
||||
kwargs = kwargs or {}
|
||||
|
||||
with multiprocessing.Pool(processes=1) as pool:
|
||||
result = pool.apply(func=func, args=args, kwds=kwargs)
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def __command(
|
||||
cls, system_settings: SystemSettings, func: Callable, kwargs: Dict[str, Any]
|
||||
@@ -211,10 +200,7 @@ class StaticCommandRunner:
|
||||
)
|
||||
|
||||
with context_manager as warning_list:
|
||||
if system_settings.run_in_isolation:
|
||||
obbject = cls.__run_in_isolation(func=func, kwargs=kwargs)
|
||||
else:
|
||||
obbject = func(**kwargs)
|
||||
obbject = func(**kwargs)
|
||||
|
||||
obbject.provider = getattr(
|
||||
kwargs.get("provider_choices", None), "provider", None
|
||||
|
||||
@@ -47,10 +47,6 @@ class SystemSettings(Tagged):
|
||||
test_mode: bool = False
|
||||
debug_mode: bool = False
|
||||
headless: bool = False
|
||||
run_in_isolation: bool = FrozenField(
|
||||
default=False,
|
||||
description="Whether or not to run each command in total isolation.",
|
||||
)
|
||||
|
||||
class Config:
|
||||
validate_assignment = True
|
||||
|
||||
@@ -15,7 +15,6 @@ class SystemService:
|
||||
"test_mode",
|
||||
"headless",
|
||||
"debug_mode",
|
||||
"run_in_isolation",
|
||||
"dbms_uri",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user