From 9508725c11aff0acf273c521358c4f69d3d6c815 Mon Sep 17 00:00:00 2001 From: JamieDeMaria Date: Wed, 13 Sep 2023 13:10:16 -0400 Subject: [PATCH] start interface to begin discussion --- .../dagster-ext/dagster_ext/__init__.py | 76 ++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/python_modules/dagster-ext/dagster_ext/__init__.py b/python_modules/dagster-ext/dagster_ext/__init__.py index 54527e58bc1ba..81dd672e096b6 100644 --- a/python_modules/dagster-ext/dagster_ext/__init__.py +++ b/python_modules/dagster-ext/dagster_ext/__init__.py @@ -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, @@ -570,7 +644,7 @@ def init_dagster_ext( return context -class ExtContext: +class ExtContext(IContext): _instance: ClassVar[Optional["ExtContext"]] = None @classmethod