runnable 0.50.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- extensions/README.md +0 -0
- extensions/__init__.py +0 -0
- extensions/catalog/README.md +0 -0
- extensions/catalog/any_path.py +214 -0
- extensions/catalog/file_system.py +52 -0
- extensions/catalog/minio.py +72 -0
- extensions/catalog/pyproject.toml +14 -0
- extensions/catalog/s3.py +11 -0
- extensions/job_executor/README.md +0 -0
- extensions/job_executor/__init__.py +236 -0
- extensions/job_executor/emulate.py +70 -0
- extensions/job_executor/k8s.py +553 -0
- extensions/job_executor/k8s_job_spec.yaml +37 -0
- extensions/job_executor/local.py +35 -0
- extensions/job_executor/local_container.py +161 -0
- extensions/job_executor/pyproject.toml +16 -0
- extensions/nodes/README.md +0 -0
- extensions/nodes/__init__.py +0 -0
- extensions/nodes/conditional.py +301 -0
- extensions/nodes/fail.py +78 -0
- extensions/nodes/loop.py +394 -0
- extensions/nodes/map.py +477 -0
- extensions/nodes/parallel.py +281 -0
- extensions/nodes/pyproject.toml +15 -0
- extensions/nodes/stub.py +93 -0
- extensions/nodes/success.py +78 -0
- extensions/nodes/task.py +156 -0
- extensions/pipeline_executor/README.md +0 -0
- extensions/pipeline_executor/__init__.py +871 -0
- extensions/pipeline_executor/argo.py +1266 -0
- extensions/pipeline_executor/emulate.py +119 -0
- extensions/pipeline_executor/local.py +226 -0
- extensions/pipeline_executor/local_container.py +369 -0
- extensions/pipeline_executor/mocked.py +159 -0
- extensions/pipeline_executor/pyproject.toml +16 -0
- extensions/run_log_store/README.md +0 -0
- extensions/run_log_store/__init__.py +0 -0
- extensions/run_log_store/any_path.py +100 -0
- extensions/run_log_store/chunked_fs.py +122 -0
- extensions/run_log_store/chunked_minio.py +141 -0
- extensions/run_log_store/file_system.py +91 -0
- extensions/run_log_store/generic_chunked.py +549 -0
- extensions/run_log_store/minio.py +114 -0
- extensions/run_log_store/pyproject.toml +15 -0
- extensions/secrets/README.md +0 -0
- extensions/secrets/dotenv.py +62 -0
- extensions/secrets/pyproject.toml +15 -0
- runnable/__init__.py +108 -0
- runnable/catalog.py +141 -0
- runnable/cli.py +484 -0
- runnable/context.py +730 -0
- runnable/datastore.py +1058 -0
- runnable/defaults.py +159 -0
- runnable/entrypoints.py +390 -0
- runnable/exceptions.py +137 -0
- runnable/executor.py +561 -0
- runnable/gantt.py +1646 -0
- runnable/graph.py +501 -0
- runnable/names.py +546 -0
- runnable/nodes.py +593 -0
- runnable/parameters.py +217 -0
- runnable/pickler.py +96 -0
- runnable/sdk.py +1277 -0
- runnable/secrets.py +92 -0
- runnable/tasks.py +1268 -0
- runnable/telemetry.py +142 -0
- runnable/utils.py +423 -0
- runnable-0.50.0.dist-info/METADATA +189 -0
- runnable-0.50.0.dist-info/RECORD +72 -0
- runnable-0.50.0.dist-info/WHEEL +4 -0
- runnable-0.50.0.dist-info/entry_points.txt +53 -0
- runnable-0.50.0.dist-info/licenses/LICENSE +201 -0
runnable/secrets.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, ConfigDict
|
|
6
|
+
|
|
7
|
+
from runnable import defaults, exceptions
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(defaults.LOGGER_NAME)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# --8<-- [start:docs]
|
|
13
|
+
class BaseSecrets(ABC, BaseModel):
|
|
14
|
+
"""
|
|
15
|
+
A base class for Secrets Handler.
|
|
16
|
+
All implementations should extend this class.
|
|
17
|
+
|
|
18
|
+
Raises:
|
|
19
|
+
NotImplementedError: Base class and not implemented
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
service_name: str = ""
|
|
23
|
+
service_type: str = "secrets"
|
|
24
|
+
model_config = ConfigDict(extra="forbid")
|
|
25
|
+
|
|
26
|
+
@abstractmethod
|
|
27
|
+
def get(self, name: str) -> str:
|
|
28
|
+
"""
|
|
29
|
+
Return the secret by name.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
name (str): The name of the secret to return.
|
|
33
|
+
|
|
34
|
+
Raises:
|
|
35
|
+
NotImplementedError: Base class and hence not implemented.
|
|
36
|
+
exceptions.SecretNotFoundError: Secret not found in the secrets manager.
|
|
37
|
+
"""
|
|
38
|
+
raise NotImplementedError
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# --8<-- [end:docs]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class DoNothingSecretManager(BaseSecrets):
|
|
45
|
+
"""
|
|
46
|
+
Does nothing secret manager
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
service_name: str = "do-nothing"
|
|
50
|
+
|
|
51
|
+
def get(self, name: str) -> str:
|
|
52
|
+
"""
|
|
53
|
+
If a name is provided, return None else return empty dict.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
name (str): The name of the secret to retrieve
|
|
57
|
+
|
|
58
|
+
Raises:
|
|
59
|
+
exceptions.SecretNotFoundError: Secret not found in the secrets manager.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
[str]: The value of the secret
|
|
63
|
+
"""
|
|
64
|
+
return ""
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class EnvSecretsManager(BaseSecrets):
|
|
68
|
+
"""
|
|
69
|
+
A secret manager which uses environment variables for secrets.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
service_name: str = "env-secrets"
|
|
73
|
+
|
|
74
|
+
def get(self, name: str) -> str:
|
|
75
|
+
"""
|
|
76
|
+
If a name is provided, return None else return empty dict.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
name (str): The name of the secret to retrieve
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
exceptions.SecretNotFoundError: Secret not found in the secrets manager.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
[str]: The value of the secret
|
|
86
|
+
"""
|
|
87
|
+
try:
|
|
88
|
+
return os.environ[name]
|
|
89
|
+
except KeyError:
|
|
90
|
+
raise exceptions.SecretNotFoundError(
|
|
91
|
+
secret_name=name, secret_setting="environment variables"
|
|
92
|
+
)
|