diff --git a/cognite/extractorutils/unstable/configuration/loaders.py b/cognite/extractorutils/unstable/configuration/loaders.py index e7c3f0a..4a8313f 100644 --- a/cognite/extractorutils/unstable/configuration/loaders.py +++ b/cognite/extractorutils/unstable/configuration/loaders.py @@ -12,6 +12,9 @@ from cognite.extractorutils.unstable.configuration.exceptions import InvalidConfigError from cognite.extractorutils.unstable.configuration.models import ConfigModel +__all__ = ["ConfigFormat", "load_file", "load_from_cdf", "load_io", "load_dict"] + + _T = TypeVar("_T", bound=ConfigModel) diff --git a/cognite/extractorutils/unstable/configuration/models.py b/cognite/extractorutils/unstable/configuration/models.py index 8791ebd..d4373c8 100644 --- a/cognite/extractorutils/unstable/configuration/models.py +++ b/cognite/extractorutils/unstable/configuration/models.py @@ -19,6 +19,21 @@ from cognite.extractorutils.configtools._util import _load_certificate_data from cognite.extractorutils.exceptions import InvalidConfigError +__all__ = [ + "ConfigModel", + "AuthenticationConfig", + "TimeIntervalConfig", + "ConnectionConfig", + "CronConfig", + "IntervalConfig", + "ScheduleConfig", + "LogLevel", + "LogFileHandlerConfig", + "LogConsoleHandlerConfig", + "LogHandlerConfig", + "ExtractorConfig", +] + class ConfigModel(BaseModel): model_config = ConfigDict( diff --git a/cognite/extractorutils/unstable/core/__main__.py b/cognite/extractorutils/unstable/core/__main__.py deleted file mode 100644 index b8e9d06..0000000 --- a/cognite/extractorutils/unstable/core/__main__.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -Example of how you would build an extractor with the new base class -""" - -from cognite.extractorutils.unstable.configuration.models import ExtractorConfig - -from .base import Extractor -from .runtime import Runtime - - -class MyConfig(ExtractorConfig): - parameter_one: int - parameter_two: str - - -class MyExtractor(Extractor[MyConfig]): - NAME = "Test extractor" - EXTERNAL_ID = "test-extractor" - DESCRIPTION = "Test of the new runtime" - VERSION = "1.0.0" - CONFIG_TYPE = MyConfig - - def run(self) -> None: - self.logger.info("Started!") - if not self.cancellation_token.wait(10): - raise ValueError("Oops") - - -if __name__ == "__main__": - runtime = Runtime(MyExtractor) - runtime.run() diff --git a/cognite/extractorutils/unstable/core/base.py b/cognite/extractorutils/unstable/core/base.py index 1d71d29..7f3ba12 100644 --- a/cognite/extractorutils/unstable/core/base.py +++ b/cognite/extractorutils/unstable/core/base.py @@ -30,6 +30,8 @@ from cognite.extractorutils.unstable.scheduling import TaskScheduler from cognite.extractorutils.util import now +__all__ = ["ConfigType", "ConfigRevision", "Extractor"] + ConfigType = TypeVar("ConfigType", bound=ExtractorConfig) ConfigRevision = Union[Literal["local"], int] diff --git a/cognite/extractorutils/unstable/core/errors.py b/cognite/extractorutils/unstable/core/errors.py index 2df0172..9669cfe 100644 --- a/cognite/extractorutils/unstable/core/errors.py +++ b/cognite/extractorutils/unstable/core/errors.py @@ -8,6 +8,8 @@ if typing.TYPE_CHECKING: from .base import Extractor +__all__ = ["Error", "ErrorLevel"] + class ErrorLevel(Enum): warning = "warning" diff --git a/cognite/extractorutils/unstable/core/runtime.py b/cognite/extractorutils/unstable/core/runtime.py index 732c8f6..5fedfbd 100644 --- a/cognite/extractorutils/unstable/core/runtime.py +++ b/cognite/extractorutils/unstable/core/runtime.py @@ -22,6 +22,8 @@ from ._messaging import RuntimeMessage from .base import ConfigRevision, ConfigType, Extractor, FullConfig +__all__ = ["Runtime", "ExtractorType"] + ExtractorType = TypeVar("ExtractorType", bound=Extractor) diff --git a/cognite/extractorutils/unstable/core/tasks.py b/cognite/extractorutils/unstable/core/tasks.py index a87dd4a..0c5020e 100644 --- a/cognite/extractorutils/unstable/core/tasks.py +++ b/cognite/extractorutils/unstable/core/tasks.py @@ -4,6 +4,8 @@ from cognite.extractorutils.unstable.configuration.models import ScheduleConfig +__all__ = ["ScheduledTask", "ContinuousTask", "StartupTask", "Task"] + @dataclass class _Task(ABC):