Skip to content

Commit

Permalink
revert changes to base class to make dagstermill work - to figure out…
Browse files Browse the repository at this point in the history
… for real later
  • Loading branch information
jamiedemaria committed Nov 15, 2023
1 parent d639c1f commit e64fb39
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
51 changes: 49 additions & 2 deletions python_modules/dagster/dagster/_core/execution/context/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,64 @@ class AbstractComputeMetaclass(ABCMeta):


class AbstractComputeExecutionContext(ABC, metaclass=AbstractComputeMetaclass):
"""Base class for op context implemented by OpExecutionContext, AssetExecutionContext,
"""Base class for op context implemented by OpExecutionContext,
and DagstermillExecutionContext.
"""

"""Base class for op context implemented by OpExecutionContext and DagstermillExecutionContext."""

@abstractmethod
def has_tag(self, key: str) -> bool:
"""Implement this method to check if a logging tag is set."""

@abstractmethod
def get_tag(self, key: str) -> Optional[str]:
"""Implement this method to get a logging tag."""

@property
@abstractmethod
def run_id(self) -> str:
"""The run id for the context."""

@property
@abstractmethod
def op_def(self) -> OpDefinition:
"""The op definition corresponding to the execution step being executed."""

@property
@abstractmethod
def job_def(self) -> JobDefinition:
"""The job being executed."""

@property
@abstractmethod
def run(self) -> DagsterRun:
"""The DagsterRun object corresponding to the execution."""

@property
@abstractmethod
def resources(self) -> Any:
"""Resources available in the execution context."""

@property
@abstractmethod
def log(self) -> DagsterLogManager:
"""The log manager available in the execution context."""

@property
@abstractmethod
def op_config(self) -> Any:
"""The parsed config specific to this op."""


class HasExecutionInfo(ABC):
@property
@abstractmethod
def execution_info(self) -> ExecutionInfo:
"""Implement this method to check if a logging tag is set."""


class OpExecutionContextMetaClass(AbstractComputeMetaclass):
class OpExecutionContextMetaClass(AbstractComputeMetaclass, HasExecutionInfo):
def __instancecheck__(cls, instance) -> bool:
# This makes isinstance(context, OpExecutionContext) throw a deprecation warning when
# context is an AssetExecutionContext. This metaclass can be deleted once AssetExecutionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def bind(
self._op_config = resolve_bound_config(config_from_args or self.op_config, op_def)

self._execution_info = ExecutionInfo(
step_description=f"op {self._alias}", op_execution_context=self
step_description=f'op "{self._alias}"', op_execution_context=self
)

self._requires_typed_event_stream = False
Expand Down

0 comments on commit e64fb39

Please sign in to comment.