runnable 0.28.7__py3-none-any.whl → 0.29.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/job_executor/k8s.py +8 -9
- extensions/job_executor/local.py +7 -5
- extensions/job_executor/local_container.py +7 -5
- extensions/nodes/nodes.py +15 -195
- extensions/nodes/torch.py +169 -0
- extensions/nodes/torch_config.py +33 -0
- extensions/pipeline_executor/__init__.py +10 -14
- extensions/pipeline_executor/argo.py +1 -3
- extensions/pipeline_executor/local.py +6 -10
- extensions/pipeline_executor/local_container.py +10 -12
- extensions/pipeline_executor/mocked.py +6 -12
- extensions/pipeline_executor/retry.py +6 -10
- extensions/run_log_store/generic_chunked.py +1 -2
- extensions/secrets/dotenv.py +1 -1
- extensions/tasks/torch.py +52 -0
- runnable/__init__.py +1 -0
- runnable/entrypoints.py +2 -2
- runnable/executor.py +6 -11
- runnable/nodes.py +44 -25
- runnable/sdk.py +46 -4
- runnable/secrets.py +3 -3
- runnable/tasks.py +0 -4
- {runnable-0.28.7.dist-info → runnable-0.29.0.dist-info}/METADATA +3 -1
- {runnable-0.28.7.dist-info → runnable-0.29.0.dist-info}/RECORD +27 -24
- {runnable-0.28.7.dist-info → runnable-0.29.0.dist-info}/entry_points.txt +1 -0
- {runnable-0.28.7.dist-info → runnable-0.29.0.dist-info}/WHEEL +0 -0
- {runnable-0.28.7.dist-info → runnable-0.29.0.dist-info}/licenses/LICENSE +0 -0
runnable/sdk.py
CHANGED
@@ -5,7 +5,7 @@ import os
|
|
5
5
|
import re
|
6
6
|
from abc import ABC, abstractmethod
|
7
7
|
from pathlib import Path
|
8
|
-
from typing import Any, Callable, Dict, List, Optional, Union
|
8
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
|
9
9
|
|
10
10
|
from pydantic import (
|
11
11
|
BaseModel,
|
@@ -34,17 +34,20 @@ from extensions.nodes.nodes import (
|
|
34
34
|
SuccessNode,
|
35
35
|
TaskNode,
|
36
36
|
)
|
37
|
+
from extensions.nodes.torch_config import TorchConfig
|
37
38
|
from runnable import console, defaults, entrypoints, exceptions, graph, utils
|
38
39
|
from runnable.executor import BaseJobExecutor, BasePipelineExecutor
|
39
40
|
from runnable.nodes import TraversalNode
|
40
41
|
from runnable.tasks import BaseTaskType as RunnableTask
|
41
42
|
from runnable.tasks import TaskReturns
|
42
43
|
|
43
|
-
# TODO: This might have to be an extension
|
44
|
-
|
45
44
|
logger = logging.getLogger(defaults.LOGGER_NAME)
|
46
45
|
|
47
|
-
StepType = Union[
|
46
|
+
StepType = Union[
|
47
|
+
"Stub", "PythonTask", "NotebookTask", "ShellTask", "Parallel", "Map", "Torch"
|
48
|
+
]
|
49
|
+
if TYPE_CHECKING:
|
50
|
+
from extensions.nodes.torch import TorchNode
|
48
51
|
|
49
52
|
|
50
53
|
def pickled(name: str) -> TaskReturns:
|
@@ -456,6 +459,45 @@ class Stub(BaseTraversal):
|
|
456
459
|
return StubNode.parse_from_config(self.model_dump(exclude_none=True))
|
457
460
|
|
458
461
|
|
462
|
+
class Torch(BaseTraversal, TorchConfig):
|
463
|
+
# Its a wrapper of a python task
|
464
|
+
# TODO: Is there a way to not sync these with the torch node in extensions?
|
465
|
+
function: Callable = Field(exclude=True)
|
466
|
+
catalog: Optional[Catalog] = Field(default=None, alias="catalog")
|
467
|
+
overrides: Dict[str, Any] = Field(default_factory=dict, alias="overrides")
|
468
|
+
returns: List[Union[str, TaskReturns]] = Field(
|
469
|
+
default_factory=list, alias="returns"
|
470
|
+
)
|
471
|
+
secrets: List[str] = Field(default_factory=list)
|
472
|
+
|
473
|
+
@computed_field
|
474
|
+
def command_type(self) -> str:
|
475
|
+
return "python"
|
476
|
+
|
477
|
+
@computed_field
|
478
|
+
def command(self) -> str:
|
479
|
+
module = self.function.__module__
|
480
|
+
name = self.function.__name__
|
481
|
+
|
482
|
+
return f"{module}.{name}"
|
483
|
+
|
484
|
+
def create_node(self) -> TorchNode:
|
485
|
+
if not self.next_node:
|
486
|
+
if not (self.terminate_with_failure or self.terminate_with_success):
|
487
|
+
raise AssertionError(
|
488
|
+
"A node not being terminated must have a user defined next node"
|
489
|
+
)
|
490
|
+
|
491
|
+
if self.on_failure:
|
492
|
+
self.on_failure = self.on_failure.steps[0].name # type: ignore
|
493
|
+
|
494
|
+
from extensions.nodes.torch import TorchNode
|
495
|
+
|
496
|
+
return TorchNode.parse_from_config(
|
497
|
+
self.model_dump(exclude_none=True, by_alias=True)
|
498
|
+
)
|
499
|
+
|
500
|
+
|
459
501
|
class Parallel(BaseTraversal):
|
460
502
|
"""
|
461
503
|
A node that executes multiple branches in parallel.
|
runnable/secrets.py
CHANGED
@@ -29,7 +29,7 @@ class BaseSecrets(ABC, BaseModel):
|
|
29
29
|
return context.run_context
|
30
30
|
|
31
31
|
@abstractmethod
|
32
|
-
def get(self, name: str
|
32
|
+
def get(self, name: str) -> str:
|
33
33
|
"""
|
34
34
|
Return the secret by name.
|
35
35
|
|
@@ -53,7 +53,7 @@ class DoNothingSecretManager(BaseSecrets):
|
|
53
53
|
|
54
54
|
service_name: str = "do-nothing"
|
55
55
|
|
56
|
-
def get(self, name: str
|
56
|
+
def get(self, name: str) -> str:
|
57
57
|
"""
|
58
58
|
If a name is provided, return None else return empty dict.
|
59
59
|
|
@@ -76,7 +76,7 @@ class EnvSecretsManager(BaseSecrets):
|
|
76
76
|
|
77
77
|
service_name: str = "env-secrets"
|
78
78
|
|
79
|
-
def get(self, name: str
|
79
|
+
def get(self, name: str) -> str:
|
80
80
|
"""
|
81
81
|
If a name is provided, return None else return empty dict.
|
82
82
|
|
runnable/tasks.py
CHANGED
@@ -93,7 +93,6 @@ class BaseTaskType(BaseModel):
|
|
93
93
|
def execute_command(
|
94
94
|
self,
|
95
95
|
map_variable: TypeMapVariable = None,
|
96
|
-
**kwargs,
|
97
96
|
) -> StepAttempt:
|
98
97
|
"""The function to execute the command.
|
99
98
|
|
@@ -271,7 +270,6 @@ class PythonTaskType(BaseTaskType): # pylint: disable=too-few-public-methods
|
|
271
270
|
def execute_command(
|
272
271
|
self,
|
273
272
|
map_variable: TypeMapVariable = None,
|
274
|
-
**kwargs,
|
275
273
|
) -> StepAttempt:
|
276
274
|
"""Execute the notebook as defined by the command."""
|
277
275
|
attempt_log = StepAttempt(status=defaults.FAIL, start_time=str(datetime.now()))
|
@@ -441,7 +439,6 @@ class NotebookTaskType(BaseTaskType):
|
|
441
439
|
def execute_command(
|
442
440
|
self,
|
443
441
|
map_variable: TypeMapVariable = None,
|
444
|
-
**kwargs,
|
445
442
|
) -> StepAttempt:
|
446
443
|
"""Execute the python notebook as defined by the command.
|
447
444
|
|
@@ -620,7 +617,6 @@ class ShellTaskType(BaseTaskType):
|
|
620
617
|
def execute_command(
|
621
618
|
self,
|
622
619
|
map_variable: TypeMapVariable = None,
|
623
|
-
**kwargs,
|
624
620
|
) -> StepAttempt:
|
625
621
|
# Using shell=True as we want to have chained commands to be executed in the same shell.
|
626
622
|
"""Execute the shell command as defined by the command.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: runnable
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.29.0
|
4
4
|
Summary: Add your description here
|
5
5
|
Author-email: "Vammi, Vijay" <vijay.vammi@astrazeneca.com>
|
6
6
|
License-File: LICENSE
|
@@ -26,6 +26,8 @@ Provides-Extra: notebook
|
|
26
26
|
Requires-Dist: ploomber-engine>=0.0.33; extra == 'notebook'
|
27
27
|
Provides-Extra: s3
|
28
28
|
Requires-Dist: cloudpathlib[s3]; extra == 's3'
|
29
|
+
Provides-Extra: torch
|
30
|
+
Requires-Dist: torch>=2.6.0; extra == 'torch'
|
29
31
|
Description-Content-Type: text/markdown
|
30
32
|
|
31
33
|
|
@@ -8,56 +8,59 @@ extensions/catalog/pyproject.toml,sha256=lLNxY6v04c8I5QK_zKw_E6sJTArSJRA_V-79kta
|
|
8
8
|
extensions/catalog/s3.py,sha256=Sw5t8_kVRprn3uGGJCiHn7M9zw1CLaCOFj6YErtfG0o,287
|
9
9
|
extensions/job_executor/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
extensions/job_executor/__init__.py,sha256=E2R6GV5cZTlZdqA5SVJ6ajZFh4oruM0k8AKHkpOZ3W8,5772
|
11
|
-
extensions/job_executor/k8s.py,sha256=
|
11
|
+
extensions/job_executor/k8s.py,sha256=erzw4UOsOf2JSOiQio5stgW_rMryAsIQSBd8wiL6nBY,16214
|
12
12
|
extensions/job_executor/k8s_job_spec.yaml,sha256=7aFpxHdO_p6Hkc3YxusUOuAQTD1Myu0yTPX9DrhxbOg,1158
|
13
|
-
extensions/job_executor/local.py,sha256=
|
14
|
-
extensions/job_executor/local_container.py,sha256=
|
13
|
+
extensions/job_executor/local.py,sha256=raobGxwoqZN8c-yCsAa0CDuPLWKuyEttB37U5wsqGF4,1968
|
14
|
+
extensions/job_executor/local_container.py,sha256=8-dLhzY34pOVjJ_x0VmeTwVvYkESXBnp4j-XLsSsgBk,6688
|
15
15
|
extensions/job_executor/pyproject.toml,sha256=UIEgiCYHTXcRWSByNMFuKJFKgxTBpQqTqyUecIsb_Vc,286
|
16
16
|
extensions/nodes/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
extensions/nodes/nodes.py,sha256=
|
17
|
+
extensions/nodes/nodes.py,sha256=s9ub1dqy4qHjRQG6YElCdL7rCOTYNs9RUIrStZ6tEB4,28256
|
18
18
|
extensions/nodes/pyproject.toml,sha256=YTu-ETN3JNFSkMzzWeOwn4m-O2nbRH-PmiPBALDCUw4,278
|
19
|
+
extensions/nodes/torch.py,sha256=kB4a72YMcrxDDzbR5LffODtrdA7vUo9dRJlaVr8KEEM,5570
|
20
|
+
extensions/nodes/torch_config.py,sha256=yDvDADpnLhQsNtfH8qIztLHQ2LhYiOJEWljxpH9GZzs,1222
|
19
21
|
extensions/pipeline_executor/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
-
extensions/pipeline_executor/__init__.py,sha256=
|
21
|
-
extensions/pipeline_executor/argo.py,sha256=
|
22
|
-
extensions/pipeline_executor/local.py,sha256=
|
23
|
-
extensions/pipeline_executor/local_container.py,sha256=
|
24
|
-
extensions/pipeline_executor/mocked.py,sha256=
|
22
|
+
extensions/pipeline_executor/__init__.py,sha256=9ZMHcieSYdTiYyjSkc8eT8yhOlKEUFnrbrdbqdOgvP0,24195
|
23
|
+
extensions/pipeline_executor/argo.py,sha256=LlXtzcbJyOossTNd-gdC4xrkPe9qYxRc0czdNzNQzlY,34497
|
24
|
+
extensions/pipeline_executor/local.py,sha256=orBIhG8QJesA3YqWhsuczjhhlKD_1s62MRNerxv9_Tg,1858
|
25
|
+
extensions/pipeline_executor/local_container.py,sha256=PvMXy-zFTnT9hj7jjz1VkaPVJ9Dkrhnd7Hs6eqLMXZ8,12398
|
26
|
+
extensions/pipeline_executor/mocked.py,sha256=0sMmypuvstBIv9uQg-WAcPrF3oOFpeEXNi6N8Nzdnl0,5680
|
25
27
|
extensions/pipeline_executor/pyproject.toml,sha256=ykTX7srR10PBYb8LsIwEj8vIPPIEZQ5V_R7VYbZ-ido,291
|
26
|
-
extensions/pipeline_executor/retry.py,sha256=
|
28
|
+
extensions/pipeline_executor/retry.py,sha256=6ClFXJYtr0M6nWIZiI-mbUGshobOtVH_KADN8JCfvH0,6881
|
27
29
|
extensions/run_log_store/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
30
|
extensions/run_log_store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
31
|
extensions/run_log_store/any_path.py,sha256=0nN_LHbm2W6AHkerQmsVHq3EoybFQF8lxpCicacHo8Y,2861
|
30
32
|
extensions/run_log_store/chunked_fs.py,sha256=wHMKcAx6uFI4OOTp7QWCdGq9WvEFesbLp9VxHZU28l0,3341
|
31
33
|
extensions/run_log_store/chunked_minio.py,sha256=Itfkw4Ycf0uLCqxH3Uk_itmVgT7ipJp05yKfD22WBiY,4007
|
32
34
|
extensions/run_log_store/file_system.py,sha256=hhrbhSnuzv8yzBr6DAu45NT8-sawPP86WA2-LY70vjw,2781
|
33
|
-
extensions/run_log_store/generic_chunked.py,sha256=
|
35
|
+
extensions/run_log_store/generic_chunked.py,sha256=EnhRxlqm1jG-Tdxul4sY8OeCX5fK9FY2v8DZanX9-5o,20455
|
34
36
|
extensions/run_log_store/minio.py,sha256=omrKDSdRzmnVBg9xXkkdQb-icBIgBDRdpmwGRlMyCGk,3453
|
35
37
|
extensions/run_log_store/pyproject.toml,sha256=YnmXsFvFG9uv_c0spLYBsNI_1sbktqxtHsOuClyvZ3g,288
|
36
38
|
extensions/run_log_store/db/implementation_FF.py,sha256=euTnh0xzNF0e_DyfHQ4W-kG1AwTr8u7OuO3_cZkR5bM,5237
|
37
39
|
extensions/run_log_store/db/integration_FF.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
40
|
extensions/secrets/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
-
extensions/secrets/dotenv.py,sha256=
|
41
|
+
extensions/secrets/dotenv.py,sha256=nADHXI6KJ_LUYOIe5EbtYH-21OBebSNVr0Pjb1GlZ7w,1573
|
40
42
|
extensions/secrets/pyproject.toml,sha256=mLJNImNcBlbLKHh-0ugVWT9V83R4RibyyYDtBCSqVF4,282
|
41
|
-
|
43
|
+
extensions/tasks/torch.py,sha256=uNO4qYMawNH5hPecANCiSUQZnUC8yqw3-rxtM526CeA,1955
|
44
|
+
runnable/__init__.py,sha256=swvqdCjeddn40o4zjsluyahdVcU0r1arSRrxmRsvFEQ,673
|
42
45
|
runnable/catalog.py,sha256=W_erYbLZ-ffuA9RQuWVqz1DUJOuWayf32ne32IDbAbc,4358
|
43
46
|
runnable/cli.py,sha256=3BiKSj95h2Drn__YlchMPZ5rBMafuRb2OGIsVpbsO5Y,8788
|
44
47
|
runnable/context.py,sha256=by5uepmuCP0dmM9BmsliXihSes5QEFejwAsmekcqylE,1388
|
45
48
|
runnable/datastore.py,sha256=ZobM1aVkgeUJ2fZYt63IFDsoNzObwc93hdByegS5YKQ,32396
|
46
49
|
runnable/defaults.py,sha256=3o9IVGryyCE6PoQTOoaIaHHTbJGEzmdXMcwzOhwAYoI,3518
|
47
|
-
runnable/entrypoints.py,sha256=
|
50
|
+
runnable/entrypoints.py,sha256=cDbhtmLUWdBh9K6hNusfQpSd5NadcX8V1K2JEDf_YAg,18984
|
48
51
|
runnable/exceptions.py,sha256=LFbp0-Qxg2PAMLEVt7w2whhBxSG-5pzUEv5qN-Rc4_c,3003
|
49
|
-
runnable/executor.py,sha256=
|
52
|
+
runnable/executor.py,sha256=F0gQjJ10VQSlilqaxYm1gRdXpjmx5DqBP0KCPmz85zg,15021
|
50
53
|
runnable/graph.py,sha256=poQz5zcvq89ju_u5sYlunQLPbHnXTaUmjcvstPwvT4U,16536
|
51
54
|
runnable/names.py,sha256=vn92Kv9ANROYSZX6Z4z1v_WA3WiEdIYmG6KEStBFZug,8134
|
52
|
-
runnable/nodes.py,sha256=
|
55
|
+
runnable/nodes.py,sha256=d1eLttMAcV7CTwTEqOuNwZqItANoLUkXJ73Xp-srlyI,17811
|
53
56
|
runnable/parameters.py,sha256=sT3DNGczivP9z7r4Cp_brbudg1z4J-zjmvrq3ppIrVs,5089
|
54
57
|
runnable/pickler.py,sha256=ydJ_eti_U1F4l-YacFp7BWm6g5vTn04UXye25S1HVok,2684
|
55
|
-
runnable/sdk.py,sha256=
|
56
|
-
runnable/secrets.py,sha256=
|
57
|
-
runnable/tasks.py,sha256=
|
58
|
+
runnable/sdk.py,sha256=6OO_vsRuGSjVhME2AJEljs0cjobjIQKa2E3mGoILkZA,35237
|
59
|
+
runnable/secrets.py,sha256=4L_dBFxTgr8r_hHUD6RlZEtqaOHDRsFG5PXO5wlvMI0,2324
|
60
|
+
runnable/tasks.py,sha256=Qb1IhVxHv68E7vf3M3YCf7MGRHyjmsEEYBpEpiZ4mRI,29062
|
58
61
|
runnable/utils.py,sha256=hBr7oGwGL2VgfITlQCTz-a1iwvvf7Mfl-HY8UdENZac,19929
|
59
|
-
runnable-0.
|
60
|
-
runnable-0.
|
61
|
-
runnable-0.
|
62
|
-
runnable-0.
|
63
|
-
runnable-0.
|
62
|
+
runnable-0.29.0.dist-info/METADATA,sha256=1jW9CmQUxqDClGKzNPZGMlq1B7M4y8p9FwQf0Cz1bZg,10115
|
63
|
+
runnable-0.29.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
64
|
+
runnable-0.29.0.dist-info/entry_points.txt,sha256=PrjKrlfXPZaV_7hz8orGu4FDnatLqnhPOXljyllszdw,1880
|
65
|
+
runnable-0.29.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
66
|
+
runnable-0.29.0.dist-info/RECORD,,
|
@@ -21,6 +21,7 @@ parallel = extensions.nodes.nodes:ParallelNode
|
|
21
21
|
stub = extensions.nodes.nodes:StubNode
|
22
22
|
success = extensions.nodes.nodes:SuccessNode
|
23
23
|
task = extensions.nodes.nodes:TaskNode
|
24
|
+
torch = extensions.nodes.torch:TorchNode
|
24
25
|
|
25
26
|
[pickler]
|
26
27
|
pickle = runnable.pickler:NativePickler
|
File without changes
|
File without changes
|