Skip to content

omnipy.shared.protocols.compute.job_creator

Protocols for job creator and job config holder contracts.

CLASS DESCRIPTION
IsJobConfigHolder

Protocol for objects that hold mutable job config and engine state.

IsJobCreator

Protocol for nested-context job creators.

IsJobConfigHolder

Bases: Protocol


              flowchart BT
              omnipy.shared.protocols.compute.job_creator.IsJobConfigHolder[IsJobConfigHolder]

              

              click omnipy.shared.protocols.compute.job_creator.IsJobConfigHolder href "" "omnipy.shared.protocols.compute.job_creator.IsJobConfigHolder"
            

Protocol for objects that hold mutable job config and engine state.

METHOD DESCRIPTION
set_config

Replace the shared job configuration used by the holder.

set_engine

Set the engine used by the holder for future applied jobs.

ATTRIBUTE DESCRIPTION
config

Return the shared job configuration associated with the holder.

TYPE: IsJobConfig

engine

Return the engine currently associated with the holder, if any.

TYPE: IsEngine | None

Source code in src/omnipy/shared/protocols/compute/job_creator.py
@runtime_checkable
class IsJobConfigHolder(Protocol):
    """Protocol for objects that hold mutable job config and engine state."""
    @property
    def config(self) -> IsJobConfig:
        # %% Original docstring (managed by expand_docstr_macros.py) %%
        # {{ISJOBCONFIGHOLDER_CONFIG_SUMMARY}}
        #
        # {{ISJOBCONFIGHOLDER_CONFIG_DETAILS}}
        """Return the shared job configuration associated with the holder.

        Returns:
            IsJobConfig: Shared job configuration used for future jobs and runtime lookups.
        """
        ...

    @property
    def engine(self) -> IsEngine | None:
        # %% Original docstring (managed by expand_docstr_macros.py) %%
        # {{ISJOBCONFIGHOLDER_ENGINE_SUMMARY}}
        #
        # {{ISJOBCONFIGHOLDER_ENGINE_DETAILS}}
        """Return the engine currently associated with the holder, if any.

        Returns:
            IsEngine | None: Engine used for decorating applied jobs, or ``None`` when no engine
                has been configured.
        """
        ...

    def set_config(self, config: IsJobConfig) -> None:
        # %% Original docstring (managed by expand_docstr_macros.py) %%
        # {{ISJOBCONFIGHOLDER_SET_CONFIG_SUMMARY}}
        #
        # {{ISJOBCONFIGHOLDER_SET_CONFIG_DETAILS}}
        """Replace the shared job configuration used by the holder.

        Args:
            config: Job configuration object to store for future jobs.
        """
        ...

    def set_engine(self, engine: IsEngine) -> None:
        # %% Original docstring (managed by expand_docstr_macros.py) %%
        # {{ISJOBCONFIGHOLDER_SET_ENGINE_SUMMARY}}
        #
        # {{ISJOBCONFIGHOLDER_SET_ENGINE_DETAILS}}
        """Set the engine used by the holder for future applied jobs.

        Args:
            engine: Engine that should decorate jobs created through this holder.
        """
        ...

config property

config: IsJobConfig

Return the shared job configuration associated with the holder.

RETURNS DESCRIPTION
IsJobConfig

Shared job configuration used for future jobs and runtime lookups.

TYPE: IsJobConfig

engine property

engine: IsEngine | None

Return the engine currently associated with the holder, if any.

RETURNS DESCRIPTION
IsEngine | None

IsEngine | None: Engine used for decorating applied jobs, or None when no engine has been configured.

set_config

set_config(config: IsJobConfig) -> None

Replace the shared job configuration used by the holder.

PARAMETER DESCRIPTION
config

Job configuration object to store for future jobs.

TYPE: IsJobConfig

Source code in src/omnipy/shared/protocols/compute/job_creator.py
def set_config(self, config: IsJobConfig) -> None:
    # %% Original docstring (managed by expand_docstr_macros.py) %%
    # {{ISJOBCONFIGHOLDER_SET_CONFIG_SUMMARY}}
    #
    # {{ISJOBCONFIGHOLDER_SET_CONFIG_DETAILS}}
    """Replace the shared job configuration used by the holder.

    Args:
        config: Job configuration object to store for future jobs.
    """
    ...

set_engine

set_engine(engine: IsEngine) -> None

Set the engine used by the holder for future applied jobs.

PARAMETER DESCRIPTION
engine

Engine that should decorate jobs created through this holder.

TYPE: IsEngine

Source code in src/omnipy/shared/protocols/compute/job_creator.py
def set_engine(self, engine: IsEngine) -> None:
    # %% Original docstring (managed by expand_docstr_macros.py) %%
    # {{ISJOBCONFIGHOLDER_SET_ENGINE_SUMMARY}}
    #
    # {{ISJOBCONFIGHOLDER_SET_ENGINE_DETAILS}}
    """Set the engine used by the holder for future applied jobs.

    Args:
        engine: Engine that should decorate jobs created through this holder.
    """
    ...

IsJobCreator

Bases: IsNestedContext, IsJobConfigHolder, Protocol


              flowchart BT
              omnipy.shared.protocols.compute.job_creator.IsJobCreator[IsJobCreator]
              omnipy.shared.protocols.compute.mixins.IsNestedContext[IsNestedContext]
              omnipy.shared.protocols.compute.job_creator.IsJobConfigHolder[IsJobConfigHolder]

                              omnipy.shared.protocols.compute.mixins.IsNestedContext --> omnipy.shared.protocols.compute.job_creator.IsJobCreator
                
                omnipy.shared.protocols.compute.job_creator.IsJobConfigHolder --> omnipy.shared.protocols.compute.job_creator.IsJobCreator
                


              click omnipy.shared.protocols.compute.job_creator.IsJobCreator href "" "omnipy.shared.protocols.compute.job_creator.IsJobCreator"
              click omnipy.shared.protocols.compute.mixins.IsNestedContext href "" "omnipy.shared.protocols.compute.mixins.IsNestedContext"
              click omnipy.shared.protocols.compute.job_creator.IsJobConfigHolder href "" "omnipy.shared.protocols.compute.job_creator.IsJobConfigHolder"
            

Protocol for nested-context job creators.

METHOD DESCRIPTION
set_config

Replace the shared job configuration used by the holder.

set_engine

Set the engine used by the holder for future applied jobs.

ATTRIBUTE DESCRIPTION
config

Return the shared job configuration associated with the holder.

TYPE: IsJobConfig

engine

Return the engine currently associated with the holder, if any.

TYPE: IsEngine | None

nested_context_level

Return the current depth of nested job-execution contexts.

TYPE: int

time_of_cur_toplevel_nested_context_run

Return the start time for the active top-level execution context, if any.

TYPE: datetime | None

Source code in src/omnipy/shared/protocols/compute/job_creator.py
@runtime_checkable
class IsJobCreator(IsNestedContext, IsJobConfigHolder, Protocol):
    """Protocol for nested-context job creators."""
    @property
    def nested_context_level(self) -> int:
        # %% Original docstring (managed by expand_docstr_macros.py) %%
        # {{ISJOBCREATOR_NESTED_CONTEXT_LEVEL_SUMMARY}}
        #
        # {{ISJOBCREATOR_NESTED_CONTEXT_LEVEL_DETAILS}}
        """Return the current depth of nested job-execution contexts.

        Returns:
            int: Number of currently active nested execution contexts.
        """
        ...

    @property
    def time_of_cur_toplevel_nested_context_run(self) -> datetime | None:
        # %% Original docstring (managed by expand_docstr_macros.py) %%
        # {{ISJOBCREATOR_TIME_OF_CUR_TOPLEVEL_NESTED_CONTEXT_RUN_SUMMARY}}
        #
        # {{ISJOBCREATOR_TIME_OF_CUR_TOPLEVEL_NESTED_CONTEXT_RUN_DETAILS}}
        """Return the start time for the active top-level execution context, if any.

        Returns:
            datetime | None: Timestamp recorded when the outermost execution context started, or
                ``None`` when no top-level context is active.
        """
        ...

config property

config: IsJobConfig

Return the shared job configuration associated with the holder.

RETURNS DESCRIPTION
IsJobConfig

Shared job configuration used for future jobs and runtime lookups.

TYPE: IsJobConfig

engine property

engine: IsEngine | None

Return the engine currently associated with the holder, if any.

RETURNS DESCRIPTION
IsEngine | None

IsEngine | None: Engine used for decorating applied jobs, or None when no engine has been configured.

nested_context_level property

nested_context_level: int

Return the current depth of nested job-execution contexts.

RETURNS DESCRIPTION
int

Number of currently active nested execution contexts.

TYPE: int

time_of_cur_toplevel_nested_context_run property

time_of_cur_toplevel_nested_context_run: datetime | None

Return the start time for the active top-level execution context, if any.

RETURNS DESCRIPTION
datetime | None

datetime | None: Timestamp recorded when the outermost execution context started, or None when no top-level context is active.

set_config

set_config(config: IsJobConfig) -> None

Replace the shared job configuration used by the holder.

PARAMETER DESCRIPTION
config

Job configuration object to store for future jobs.

TYPE: IsJobConfig

Source code in src/omnipy/shared/protocols/compute/job_creator.py
def set_config(self, config: IsJobConfig) -> None:
    # %% Original docstring (managed by expand_docstr_macros.py) %%
    # {{ISJOBCONFIGHOLDER_SET_CONFIG_SUMMARY}}
    #
    # {{ISJOBCONFIGHOLDER_SET_CONFIG_DETAILS}}
    """Replace the shared job configuration used by the holder.

    Args:
        config: Job configuration object to store for future jobs.
    """
    ...

set_engine

set_engine(engine: IsEngine) -> None

Set the engine used by the holder for future applied jobs.

PARAMETER DESCRIPTION
engine

Engine that should decorate jobs created through this holder.

TYPE: IsEngine

Source code in src/omnipy/shared/protocols/compute/job_creator.py
def set_engine(self, engine: IsEngine) -> None:
    # %% Original docstring (managed by expand_docstr_macros.py) %%
    # {{ISJOBCONFIGHOLDER_SET_ENGINE_SUMMARY}}
    #
    # {{ISJOBCONFIGHOLDER_SET_ENGINE_DETAILS}}
    """Set the engine used by the holder for future applied jobs.

    Args:
        engine: Engine that should decorate jobs created through this holder.
    """
    ...