Skip to content

Commit

Permalink
add doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Sep 22, 2023
1 parent 49b0a60 commit 1448509
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1370,50 +1370,69 @@ def __init__(self, op_execution_context: OpExecutionContext) -> None:
@public
@property
def op_execution_context(self) -> OpExecutionContext:
"""An instance of OpExecutionContext created for the execution of this step."""
return self._op_execution_context

# IContext interface methods
@public
@property
def asset_key(self) -> AssetKey:
"""The AssetKey for the current asset. Errors if the current step is not an asset, or is a
multi_asset. For multi_assets, use asset_keys.
"""
return self._op_execution_context.asset_key

@property
def asset_keys(self) -> Sequence[AssetKey]:
def asset_keys(self) -> AbstractSet[AssetKey]:
"""The set of AssetKeys that are being materialized by the current asset. Errors if the current
step is not an asset.
"""
return self._asset_keys

@property
def provenance(self) -> Optional[DataProvenance]:
"""The data provenance for the current asset. For multi_assets, use provenance_by_asset_key."""
return self._provenance_by_asset_key[self.asset_key]

@property
def provenance_by_asset_key(self) -> Mapping[AssetKey, Optional[DataProvenance]]:
"""A dictionary of AssetKey: DataProvenance of the provenance of each asset being materialized
by the current asset.
"""
return self._provenance_by_asset_key

@property
def code_version(self) -> Optional[str]:
"""The code version for the current asset. For multi_assets, use code_version_by_asset_key."""
return self.code_version_by_asset_key[self.asset_key]

@property
def code_version_by_asset_key(self) -> Mapping[AssetKey, Optional[str]]:
"""A dictionary of AssetKey: code version of the code version of each asset being materialized
by the current asset.
"""
return self._code_version_by_asset_key

@public
@property
def is_partitioned(self) -> bool:
"""True if the current execution is partitioned."""
return self._op_execution_context.has_partition_key

@public
@property
def run_id(self) -> str:
"""The run id of the current execution."""
return self._op_execution_context.run_id

@property
def job_name(self) -> Optional[str]:
"""The name of the currently executing job."""
return self.op_execution_context.job_name

@property
def retry_number(self) -> int:
"""The number of attempted retries for this step."""
return self.op_execution_context.retry_number

# Additional methods
Expand All @@ -1433,6 +1452,7 @@ def dagster_run(self) -> DagsterRun:
@public
@property
def pdb(self) -> ForkedPdb:
"""An instance of pdb for debugging."""
return self._op_execution_context.pdb

@public
Expand All @@ -1444,11 +1464,15 @@ def log(self) -> DagsterLogManager:
@public
@property
def assets_def(self) -> AssetsDefinition:
"""The AssetsDefinition for the current asset."""
return self._assets_def

@public
@property
def check_specs_by_asset_key(self) -> Mapping[AssetKey, AssetCheckSpec]:
"""A dictionary of AssetKey: AssetCheckSpec of the AssetCheckSpec for each asset being materialized
by the current asset.
"""
return self._check_specs_by_asset_key

@public
Expand Down

0 comments on commit 1448509

Please sign in to comment.