-
Notifications
You must be signed in to change notification settings - Fork 104
Workflow sandbox #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflow sandbox #164
Changes from all commits
d935689
fc4634a
85e4cd4
49332e8
d1cbed8
1c036bf
70b0672
bc83389
11c7ba2
27b8fbe
c6f2fb5
d0dfe0e
25d5ff6
1a0da34
47a9932
2313157
e7755f7
7e66172
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
from .worker import load_default_build_id | ||
from .workflow import _WorkflowWorker | ||
from .workflow_instance import UnsandboxedWorkflowRunner, WorkflowRunner | ||
from .workflow_sandbox import SandboxedWorkflowRunner | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -49,7 +50,8 @@ def __init__( | |
*, | ||
workflows: Sequence[Type], | ||
workflow_task_executor: Optional[concurrent.futures.ThreadPoolExecutor] = None, | ||
workflow_runner: WorkflowRunner = UnsandboxedWorkflowRunner(), | ||
workflow_runner: WorkflowRunner = SandboxedWorkflowRunner(), | ||
unsandboxed_workflow_runner: WorkflowRunner = UnsandboxedWorkflowRunner(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a stable option? Should it be marked experimental? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's a stable option. It is what is run when you do |
||
namespace: str = "ReplayNamespace", | ||
data_converter: temporalio.converter.DataConverter = temporalio.converter.default(), | ||
interceptors: Sequence[Interceptor] = [], | ||
|
@@ -70,6 +72,7 @@ def __init__( | |
workflows=list(workflows), | ||
workflow_task_executor=workflow_task_executor, | ||
workflow_runner=workflow_runner, | ||
unsandboxed_workflow_runner=unsandboxed_workflow_runner, | ||
namespace=namespace, | ||
data_converter=data_converter, | ||
interceptors=interceptors, | ||
|
@@ -146,6 +149,7 @@ async def replay_workflows( | |
workflows=self._config["workflows"], | ||
workflow_task_executor=self._config["workflow_task_executor"], | ||
workflow_runner=self._config["workflow_runner"], | ||
unsandboxed_workflow_runner=self._config["unsandboxed_workflow_runner"], | ||
data_converter=self._config["data_converter"], | ||
interceptors=self._config["interceptors"], | ||
debug_mode=self._config["debug_mode"], | ||
|
@@ -235,6 +239,7 @@ class ReplayerConfig(TypedDict, total=False): | |
workflows: Sequence[Type] | ||
workflow_task_executor: Optional[concurrent.futures.ThreadPoolExecutor] | ||
workflow_runner: WorkflowRunner | ||
unsandboxed_workflow_runner: WorkflowRunner | ||
namespace: str | ||
data_converter: temporalio.converter.DataConverter | ||
interceptors: Sequence[Interceptor] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
from .interceptor import Interceptor | ||
from .workflow import _WorkflowWorker | ||
from .workflow_instance import UnsandboxedWorkflowRunner, WorkflowRunner | ||
from .workflow_sandbox import SandboxedWorkflowRunner | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -49,7 +50,8 @@ def __init__( | |
workflows: Sequence[Type] = [], | ||
activity_executor: Optional[concurrent.futures.Executor] = None, | ||
workflow_task_executor: Optional[concurrent.futures.ThreadPoolExecutor] = None, | ||
workflow_runner: WorkflowRunner = UnsandboxedWorkflowRunner(), | ||
workflow_runner: WorkflowRunner = SandboxedWorkflowRunner(), | ||
unsandboxed_workflow_runner: WorkflowRunner = UnsandboxedWorkflowRunner(), | ||
interceptors: Sequence[Interceptor] = [], | ||
build_id: Optional[str] = None, | ||
identity: Optional[str] = None, | ||
|
@@ -96,6 +98,8 @@ def __init__( | |
provided, the caller is responsible for shutting it down after | ||
the worker is shut down. | ||
workflow_runner: Runner for workflows. | ||
unsandboxed_workflow_runner: Runner for workflows that opt-out of | ||
sandboxing. | ||
Comment on lines
+101
to
+102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, is this a stable API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe so, yes |
||
interceptors: Collection of interceptors for this worker. Any | ||
interceptors already on the client that also implement | ||
:py:class:`Interceptor` are prepended to this list and should | ||
|
@@ -202,6 +206,7 @@ def __init__( | |
activity_executor=activity_executor, | ||
workflow_task_executor=workflow_task_executor, | ||
workflow_runner=workflow_runner, | ||
unsandboxed_workflow_runner=unsandboxed_workflow_runner, | ||
interceptors=interceptors, | ||
build_id=build_id, | ||
identity=identity, | ||
|
@@ -246,6 +251,7 @@ def __init__( | |
workflows=workflows, | ||
workflow_task_executor=workflow_task_executor, | ||
workflow_runner=workflow_runner, | ||
unsandboxed_workflow_runner=unsandboxed_workflow_runner, | ||
data_converter=client_config["data_converter"], | ||
interceptors=interceptors, | ||
debug_mode=debug_mode, | ||
|
@@ -378,6 +384,7 @@ class WorkerConfig(TypedDict, total=False): | |
activity_executor: Optional[concurrent.futures.Executor] | ||
workflow_task_executor: Optional[concurrent.futures.ThreadPoolExecutor] | ||
workflow_runner: WorkflowRunner | ||
unsandboxed_workflow_runner: WorkflowRunner | ||
interceptors: Sequence[Interceptor] | ||
build_id: Optional[str] | ||
identity: Optional[str] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's nice