remove run_in_isolation: cannot pickle nested classes

This commit is contained in:
Diogo Sousa
2023-08-22 14:30:33 +01:00
parent b847a91743
commit fa93242f67
4 changed files with 1 additions and 21 deletions

View File

@@ -144,7 +144,6 @@ Update your system settings by modifying the `.openbb_sdk/system_settings.json`
```{json}
{
"run_in_isolation": null,
"dbms_uri": null
}
```

View File

@@ -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

View File

@@ -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

View File

@@ -15,7 +15,6 @@ class SystemService:
"test_mode",
"headless",
"debug_mode",
"run_in_isolation",
"dbms_uri",
}