diff --git a/python_modules/dagster/dagster/_core/execution/context/compute.py b/python_modules/dagster/dagster/_core/execution/context/compute.py index 49a10e4568ea8..0e6667653cb85 100644 --- a/python_modules/dagster/dagster/_core/execution/context/compute.py +++ b/python_modules/dagster/dagster/_core/execution/context/compute.py @@ -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 diff --git a/python_modules/dagster/dagster/_core/execution/context/invocation.py b/python_modules/dagster/dagster/_core/execution/context/invocation.py index 30610935997a1..683138dd806d1 100644 --- a/python_modules/dagster/dagster/_core/execution/context/invocation.py +++ b/python_modules/dagster/dagster/_core/execution/context/invocation.py @@ -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