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.
Files changed (72) hide show
  1. extensions/README.md +0 -0
  2. extensions/__init__.py +0 -0
  3. extensions/catalog/README.md +0 -0
  4. extensions/catalog/any_path.py +214 -0
  5. extensions/catalog/file_system.py +52 -0
  6. extensions/catalog/minio.py +72 -0
  7. extensions/catalog/pyproject.toml +14 -0
  8. extensions/catalog/s3.py +11 -0
  9. extensions/job_executor/README.md +0 -0
  10. extensions/job_executor/__init__.py +236 -0
  11. extensions/job_executor/emulate.py +70 -0
  12. extensions/job_executor/k8s.py +553 -0
  13. extensions/job_executor/k8s_job_spec.yaml +37 -0
  14. extensions/job_executor/local.py +35 -0
  15. extensions/job_executor/local_container.py +161 -0
  16. extensions/job_executor/pyproject.toml +16 -0
  17. extensions/nodes/README.md +0 -0
  18. extensions/nodes/__init__.py +0 -0
  19. extensions/nodes/conditional.py +301 -0
  20. extensions/nodes/fail.py +78 -0
  21. extensions/nodes/loop.py +394 -0
  22. extensions/nodes/map.py +477 -0
  23. extensions/nodes/parallel.py +281 -0
  24. extensions/nodes/pyproject.toml +15 -0
  25. extensions/nodes/stub.py +93 -0
  26. extensions/nodes/success.py +78 -0
  27. extensions/nodes/task.py +156 -0
  28. extensions/pipeline_executor/README.md +0 -0
  29. extensions/pipeline_executor/__init__.py +871 -0
  30. extensions/pipeline_executor/argo.py +1266 -0
  31. extensions/pipeline_executor/emulate.py +119 -0
  32. extensions/pipeline_executor/local.py +226 -0
  33. extensions/pipeline_executor/local_container.py +369 -0
  34. extensions/pipeline_executor/mocked.py +159 -0
  35. extensions/pipeline_executor/pyproject.toml +16 -0
  36. extensions/run_log_store/README.md +0 -0
  37. extensions/run_log_store/__init__.py +0 -0
  38. extensions/run_log_store/any_path.py +100 -0
  39. extensions/run_log_store/chunked_fs.py +122 -0
  40. extensions/run_log_store/chunked_minio.py +141 -0
  41. extensions/run_log_store/file_system.py +91 -0
  42. extensions/run_log_store/generic_chunked.py +549 -0
  43. extensions/run_log_store/minio.py +114 -0
  44. extensions/run_log_store/pyproject.toml +15 -0
  45. extensions/secrets/README.md +0 -0
  46. extensions/secrets/dotenv.py +62 -0
  47. extensions/secrets/pyproject.toml +15 -0
  48. runnable/__init__.py +108 -0
  49. runnable/catalog.py +141 -0
  50. runnable/cli.py +484 -0
  51. runnable/context.py +730 -0
  52. runnable/datastore.py +1058 -0
  53. runnable/defaults.py +159 -0
  54. runnable/entrypoints.py +390 -0
  55. runnable/exceptions.py +137 -0
  56. runnable/executor.py +561 -0
  57. runnable/gantt.py +1646 -0
  58. runnable/graph.py +501 -0
  59. runnable/names.py +546 -0
  60. runnable/nodes.py +593 -0
  61. runnable/parameters.py +217 -0
  62. runnable/pickler.py +96 -0
  63. runnable/sdk.py +1277 -0
  64. runnable/secrets.py +92 -0
  65. runnable/tasks.py +1268 -0
  66. runnable/telemetry.py +142 -0
  67. runnable/utils.py +423 -0
  68. runnable-0.50.0.dist-info/METADATA +189 -0
  69. runnable-0.50.0.dist-info/RECORD +72 -0
  70. runnable-0.50.0.dist-info/WHEEL +4 -0
  71. runnable-0.50.0.dist-info/entry_points.txt +53 -0
  72. 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
+ )