Skip to content

Commit

Permalink
start interface to begin discussion
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Sep 13, 2023
1 parent b0a418e commit 9508725
Showing 1 changed file with 75 additions and 1 deletion.
76 changes: 75 additions & 1 deletion python_modules/dagster-ext/dagster_ext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,80 @@ def upload_messages_chunk(self, payload: IO, index: int) -> None:
# ########################


class IContext(ABC):
"""Base class for asset context implemented by AssetExecutionContext and ExtContext."""

@property
@abstractmethod
def is_asset_step(self) -> bool:
"""TODO."""

@property
@abstractmethod
def asset_key(self) -> str:
"""TODO."""

@property
@abstractmethod
def asset_keys(self) -> Sequence[str]:
"""TODO."""

@property
@abstractmethod
def provenance(self) -> Optional[ExtDataProvenance]:
"""TODO."""

@property
@abstractmethod
def provenance_by_asset_key(self) -> Mapping[str, Optional[ExtDataProvenance]]:
"""TODO."""

@property
@abstractmethod
def code_version(self) -> Optional[str]:
"""TODO."""

@property
@abstractmethod
def code_version_by_asset_key(self) -> Mapping[str, Optional[str]]:
"""TODO."""

@property
@abstractmethod
def is_partition_step(self) -> bool:
"""TODO."""

@property
@abstractmethod
def partition_key(self) -> str:
"""TODO."""

@property
@abstractmethod
def partition_key_range(self) -> Optional["ExtPartitionKeyRange"]:
"""TODO."""

@property
@abstractmethod
def partition_time_window(self) -> Optional["ExtTimeWindow"]:
"""TODO."""

@property
@abstractmethod
def run_id(self) -> str:
"""TODO."""

@property
@abstractmethod
def job_name(self) -> Optional[str]:
"""TODO."""

@property
@abstractmethod
def retry_number(self) -> int:
"""TODO."""


def init_dagster_ext(
*,
context_loader: Optional[ExtContextLoader] = None,
Expand Down Expand Up @@ -570,7 +644,7 @@ def init_dagster_ext(
return context


class ExtContext:
class ExtContext(IContext):
_instance: ClassVar[Optional["ExtContext"]] = None

@classmethod
Expand Down

0 comments on commit 9508725

Please sign in to comment.