Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions temporalio/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Test framework for workflows and activities."""

from .activity import ActivityEnvironment
from .workflow import WorkflowEnvironment
from ._activity import ActivityEnvironment
from ._workflow import WorkflowEnvironment

__all__ = [
"ActivityEnvironment",
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions temporalio/worker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Worker for processing Temporal workflows and/or activities."""

from .activity import SharedHeartbeatSender, SharedStateManager
from .interceptor import (
from ._activity import SharedHeartbeatSender, SharedStateManager
from ._interceptor import (
ActivityInboundInterceptor,
ActivityOutboundInterceptor,
ContinueAsNewInput,
Expand All @@ -19,9 +19,9 @@
WorkflowInterceptorClassInput,
WorkflowOutboundInterceptor,
)
from .replayer import Replayer, ReplayerConfig
from .worker import Worker, WorkerConfig
from .workflow_instance import (
from ._replayer import Replayer, ReplayerConfig
from ._worker import Worker, WorkerConfig
from ._workflow_instance import (
UnsandboxedWorkflowRunner,
WorkflowInstance,
WorkflowInstanceDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import temporalio.converter
import temporalio.exceptions

from .interceptor import (
from ._interceptor import (
ActivityInboundInterceptor,
ActivityOutboundInterceptor,
ExecuteActivityInput,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import temporalio.converter
import temporalio.workflow

from .interceptor import Interceptor
from .worker import load_default_build_id
from .workflow import _WorkflowWorker
from .workflow_instance import UnsandboxedWorkflowRunner, WorkflowRunner
from ._interceptor import Interceptor
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__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import temporalio.exceptions
import temporalio.service

from .activity import SharedStateManager, _ActivityWorker
from .interceptor import Interceptor
from .workflow import _WorkflowWorker
from .workflow_instance import UnsandboxedWorkflowRunner, WorkflowRunner
from ._activity import SharedStateManager, _ActivityWorker
from ._interceptor import Interceptor
from ._workflow import _WorkflowWorker
from ._workflow_instance import UnsandboxedWorkflowRunner, WorkflowRunner
from .workflow_sandbox import SandboxedWorkflowRunner

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
import temporalio.exceptions
import temporalio.workflow

from .interceptor import (
from ._interceptor import (
Interceptor,
WorkflowInboundInterceptor,
WorkflowInterceptorClassInput,
)
from .workflow_instance import WorkflowInstance, WorkflowInstanceDetails, WorkflowRunner
from ._workflow_instance import (
WorkflowInstance,
WorkflowInstanceDetails,
WorkflowRunner,
)

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import temporalio.exceptions
import temporalio.workflow

from .interceptor import (
from ._interceptor import (
ContinueAsNewInput,
ExecuteWorkflowInput,
HandleQueryInput,
Expand Down
4 changes: 2 additions & 2 deletions temporalio/worker/workflow_sandbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
# * https://github.com/GrahamDumpleton/wrapt/issues/130


from .restrictions import (
from ._restrictions import (
RestrictedWorkflowAccessError,
SandboxMatcher,
SandboxRestrictions,
)
from .runner import SandboxedWorkflowRunner
from ._runner import SandboxedWorkflowRunner

__all__ = [
"RestrictedWorkflowAccessError",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import temporalio.workflow

from .restrictions import (
from ._restrictions import (
RestrictedModule,
RestrictedWorkflowAccessError,
RestrictionContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import temporalio.bridge.proto.workflow_activation
import temporalio.bridge.proto.workflow_completion
import temporalio.worker.workflow_instance
import temporalio.worker._workflow_instance

logger = logging.getLogger(__name__)

Expand All @@ -28,8 +28,8 @@ class InSandbox:

def __init__(
self,
instance_details: temporalio.worker.workflow_instance.WorkflowInstanceDetails,
runner_class: Type[temporalio.worker.workflow_instance.WorkflowRunner],
instance_details: temporalio.worker._workflow_instance.WorkflowInstanceDetails,
runner_class: Type[temporalio.worker._workflow_instance.WorkflowRunner],
workflow_class: Type,
) -> None:
"""Create in-sandbox instance."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
import temporalio.bridge.proto.workflow_activation
import temporalio.bridge.proto.workflow_completion
import temporalio.converter
import temporalio.worker.workflow_instance
import temporalio.worker._workflow_instance
import temporalio.workflow

# Workflow instance has to be relative import
from ...worker.workflow_instance import (
from .._workflow_instance import (
UnsandboxedWorkflowRunner,
WorkflowInstance,
WorkflowInstanceDetails,
WorkflowRunner,
)
from .importer import Importer
from .restrictions import RestrictionContext, SandboxRestrictions
from ._importer import Importer
from ._restrictions import RestrictionContext, SandboxRestrictions


class SandboxedWorkflowRunner(WorkflowRunner):
Expand Down Expand Up @@ -127,7 +127,7 @@ def _create_instance(self) -> None:
# Create the sandbox instance
self._run_code(
"with __temporal_importer.applied():\n"
" from temporalio.worker.workflow_sandbox.in_sandbox import InSandbox\n"
" from temporalio.worker.workflow_sandbox._in_sandbox import InSandbox\n"
" __temporal_in_sandbox = InSandbox(__temporal_instance_details, __temporal_runner_class, __temporal_workflow_class)\n",
__temporal_importer=self.importer,
__temporal_instance_details=self.instance_details,
Expand Down
6 changes: 3 additions & 3 deletions tests/worker/test_worker.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import temporalio.worker.worker
import temporalio.worker._worker


def test_load_default_worker_binary_id():
# Just run it twice and confirm it didn't change
val1 = temporalio.worker.worker.load_default_build_id(memoize=False)
val2 = temporalio.worker.worker.load_default_build_id(memoize=False)
val1 = temporalio.worker._worker.load_default_build_id(memoize=False)
val2 = temporalio.worker._worker.load_default_build_id(memoize=False)
assert val1 == val2
4 changes: 2 additions & 2 deletions tests/worker/workflow_sandbox/test_importer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from temporalio.worker.workflow_sandbox.importer import Importer
from temporalio.worker.workflow_sandbox.restrictions import (
from temporalio.worker.workflow_sandbox._importer import Importer
from temporalio.worker.workflow_sandbox._restrictions import (
RestrictedWorkflowAccessError,
RestrictionContext,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/worker/workflow_sandbox/test_restrictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import pytest

from temporalio.worker.workflow_sandbox.restrictions import (
from temporalio.worker.workflow_sandbox._restrictions import (
RestrictedWorkflowAccessError,
RestrictionContext,
SandboxMatcher,
Expand Down
4 changes: 2 additions & 2 deletions tests/worker/workflow_sandbox/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import pytest

import temporalio.worker.workflow_sandbox.restrictions
import temporalio.worker.workflow_sandbox._restrictions
from temporalio import workflow
from temporalio.client import Client, WorkflowFailureError, WorkflowHandle
from temporalio.exceptions import ApplicationError
Expand Down Expand Up @@ -252,7 +252,7 @@ class DateOperatorWorkflow:
async def run(self) -> int:
assert (
type(date(2010, 1, 20))
== temporalio.worker.workflow_sandbox.restrictions._RestrictedProxy
== temporalio.worker.workflow_sandbox._restrictions._RestrictedProxy
)
return (date(2010, 1, 20) - date(2010, 1, 1)).days

Expand Down
2 changes: 1 addition & 1 deletion tests/worker/workflow_sandbox/testmodules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from temporalio.worker.workflow_sandbox.restrictions import (
from temporalio.worker.workflow_sandbox._restrictions import (
SandboxMatcher,
SandboxRestrictions,
)
Expand Down