runnable 0.11.1__py3-none-any.whl → 0.11.2__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.
- runnable/__init__.py +1 -0
- runnable/datastore.py +4 -2
- runnable/extensions/catalog/file_system/implementation.py +1 -1
- runnable/extensions/nodes.py +4 -4
- runnable/extensions/run_log_store/chunked_file_system/implementation.py +1 -1
- runnable/extensions/run_log_store/generic_chunked.py +22 -4
- runnable/tasks.py +21 -3
- {runnable-0.11.1.dist-info → runnable-0.11.2.dist-info}/METADATA +1 -1
- {runnable-0.11.1.dist-info → runnable-0.11.2.dist-info}/RECORD +12 -12
- {runnable-0.11.1.dist-info → runnable-0.11.2.dist-info}/LICENSE +0 -0
- {runnable-0.11.1.dist-info → runnable-0.11.2.dist-info}/WHEEL +0 -0
- {runnable-0.11.1.dist-info → runnable-0.11.2.dist-info}/entry_points.txt +0 -0
runnable/__init__.py
CHANGED
runnable/datastore.py
CHANGED
@@ -312,8 +312,10 @@ class RunLog(BaseModel):
|
|
312
312
|
summary["Catalog Location"] = _context.catalog_handler.get_summary()
|
313
313
|
summary["Full Run log present at: "] = _context.run_log_store.get_summary()
|
314
314
|
|
315
|
-
|
316
|
-
|
315
|
+
run_log = _context.run_log_store.get_run_log_by_id(run_id=_context.run_id, full=True)
|
316
|
+
|
317
|
+
summary["Final Parameters"] = {p: v.description for p, v in run_log.parameters.items()}
|
318
|
+
summary["Collected metrics"] = {p: v.description for p, v in run_log.parameters.items() if v.kind == "metric"}
|
317
319
|
|
318
320
|
return summary
|
319
321
|
|
@@ -226,7 +226,7 @@ class FileSystemCatalog(BaseCatalog):
|
|
226
226
|
for cataloged_file in cataloged_files:
|
227
227
|
if str(cataloged_file).endswith("execution.log"):
|
228
228
|
continue
|
229
|
-
|
229
|
+
|
230
230
|
if cataloged_file.is_file():
|
231
231
|
shutil.copy(cataloged_file, run_catalog / cataloged_file.name)
|
232
232
|
else:
|
runnable/extensions/nodes.py
CHANGED
@@ -505,7 +505,7 @@ class MapNode(CompositeNode):
|
|
505
505
|
for _, v in map_variable.items():
|
506
506
|
for branch_return in self.branch_returns:
|
507
507
|
param_name, param_type = branch_return
|
508
|
-
raw_parameters[f"{
|
508
|
+
raw_parameters[f"{v}_{param_name}"] = param_type.copy()
|
509
509
|
else:
|
510
510
|
for branch_return in self.branch_returns:
|
511
511
|
param_name, param_type = branch_return
|
@@ -606,9 +606,9 @@ class MapNode(CompositeNode):
|
|
606
606
|
param_name, _ = branch_return
|
607
607
|
to_reduce = []
|
608
608
|
for iter_variable in iterate_on:
|
609
|
-
to_reduce.append(params[f"{
|
609
|
+
to_reduce.append(params[f"{iter_variable}_{param_name}"].get_value())
|
610
610
|
|
611
|
-
param_name = f"{
|
611
|
+
param_name = f"{v}_{param_name}"
|
612
612
|
params[param_name].value = reducer_f(to_reduce)
|
613
613
|
params[param_name].reduced = True
|
614
614
|
else:
|
@@ -617,7 +617,7 @@ class MapNode(CompositeNode):
|
|
617
617
|
|
618
618
|
to_reduce = []
|
619
619
|
for iter_variable in iterate_on:
|
620
|
-
to_reduce.append(params[f"{
|
620
|
+
to_reduce.append(params[f"{iter_variable}_{param_name}"].get_value())
|
621
621
|
|
622
622
|
params[param_name].value = reducer_f(*to_reduce)
|
623
623
|
params[param_name].reduced = True
|
@@ -35,10 +35,10 @@ class ChunkedFileSystemRunLogStore(ChunkedRunLogStore):
|
|
35
35
|
name (str): The suffix of the file name to check in the run log store.
|
36
36
|
"""
|
37
37
|
log_folder = self.log_folder_with_run_id(run_id=run_id)
|
38
|
-
|
39
38
|
sub_name = Template(name).safe_substitute({"creation_time": ""})
|
40
39
|
|
41
40
|
matches = list(log_folder.glob(f"{sub_name}*"))
|
41
|
+
|
42
42
|
if matches:
|
43
43
|
if not multiple_allowed:
|
44
44
|
if len(matches) > 1:
|
@@ -7,7 +7,16 @@ from string import Template
|
|
7
7
|
from typing import Any, Dict, Optional, Sequence, Union
|
8
8
|
|
9
9
|
from runnable import defaults, exceptions
|
10
|
-
from runnable.datastore import
|
10
|
+
from runnable.datastore import (
|
11
|
+
BaseRunLogStore,
|
12
|
+
BranchLog,
|
13
|
+
JsonParameter,
|
14
|
+
MetricParameter,
|
15
|
+
ObjectParameter,
|
16
|
+
Parameter,
|
17
|
+
RunLog,
|
18
|
+
StepLog,
|
19
|
+
)
|
11
20
|
|
12
21
|
logger = logging.getLogger(defaults.LOGGER_NAME)
|
13
22
|
|
@@ -164,7 +173,9 @@ class ChunkedRunLogStore(BaseRunLogStore):
|
|
164
173
|
raise Exception(f"Name is required during retrieval for {log_type}")
|
165
174
|
|
166
175
|
naming_pattern = self.naming_pattern(log_type=log_type, name=name)
|
176
|
+
|
167
177
|
matches = self.get_matches(run_id=run_id, name=naming_pattern, multiple_allowed=multiple_allowed)
|
178
|
+
|
168
179
|
if matches:
|
169
180
|
if not multiple_allowed:
|
170
181
|
contents = self._retrieve(name=matches) # type: ignore
|
@@ -370,10 +381,17 @@ class ChunkedRunLogStore(BaseRunLogStore):
|
|
370
381
|
Raises:
|
371
382
|
RunLogNotFoundError: If the run log for run_id is not found in the datastore
|
372
383
|
"""
|
373
|
-
parameters = {}
|
384
|
+
parameters: Dict[str, Parameter] = {}
|
374
385
|
try:
|
375
386
|
parameters_list = self.retrieve(run_id=run_id, log_type=self.LogTypes.PARAMETER, multiple_allowed=True)
|
376
|
-
|
387
|
+
for param in parameters_list:
|
388
|
+
for key, value in param.items():
|
389
|
+
if value["kind"] == "json":
|
390
|
+
parameters[key] = JsonParameter(**value)
|
391
|
+
if value["kind"] == "metric":
|
392
|
+
parameters[key] = MetricParameter(**value)
|
393
|
+
if value["kind"] == "object":
|
394
|
+
parameters[key] = ObjectParameter(**value)
|
377
395
|
except EntityNotFoundError:
|
378
396
|
# No parameters are set
|
379
397
|
pass
|
@@ -401,7 +419,7 @@ class ChunkedRunLogStore(BaseRunLogStore):
|
|
401
419
|
self.store(
|
402
420
|
run_id=run_id,
|
403
421
|
log_type=self.LogTypes.PARAMETER,
|
404
|
-
contents={key: value},
|
422
|
+
contents={key: value.model_dump(by_alias=True)},
|
405
423
|
name=key,
|
406
424
|
)
|
407
425
|
|
runnable/tasks.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import contextlib
|
2
|
+
import copy
|
2
3
|
import importlib
|
3
4
|
import io
|
4
5
|
import json
|
@@ -99,6 +100,20 @@ class BaseTaskType(BaseModel):
|
|
99
100
|
"""
|
100
101
|
raise NotImplementedError()
|
101
102
|
|
103
|
+
def _diff_parameters(
|
104
|
+
self, parameters_in: Dict[str, Parameter], context_params: Dict[str, Parameter]
|
105
|
+
) -> Dict[str, Parameter]:
|
106
|
+
diff: Dict[str, Parameter] = {}
|
107
|
+
for param_name, param in context_params.items():
|
108
|
+
if param_name in parameters_in:
|
109
|
+
if parameters_in[param_name] != param:
|
110
|
+
diff[param_name] = param
|
111
|
+
continue
|
112
|
+
|
113
|
+
diff[param_name] = param
|
114
|
+
|
115
|
+
return diff
|
116
|
+
|
102
117
|
@contextlib.contextmanager
|
103
118
|
def expose_secrets(self):
|
104
119
|
"""Context manager to expose secrets to the execution.
|
@@ -128,7 +143,7 @@ class BaseTaskType(BaseModel):
|
|
128
143
|
if param.reduced is False:
|
129
144
|
context_param = param_name
|
130
145
|
for _, v in map_variable.items(): # type: ignore
|
131
|
-
context_param = f"{
|
146
|
+
context_param = f"{v}_{context_param}"
|
132
147
|
|
133
148
|
if context_param in params:
|
134
149
|
params[param_name].value = params[context_param].value
|
@@ -147,6 +162,8 @@ class BaseTaskType(BaseModel):
|
|
147
162
|
|
148
163
|
log_file = open(log_file_name, "w")
|
149
164
|
|
165
|
+
parameters_in = copy.deepcopy(params)
|
166
|
+
|
150
167
|
f = io.StringIO()
|
151
168
|
try:
|
152
169
|
with contextlib.redirect_stdout(f):
|
@@ -168,7 +185,8 @@ class BaseTaskType(BaseModel):
|
|
168
185
|
|
169
186
|
# Update parameters
|
170
187
|
# This should only update the parameters that are changed at the root level.
|
171
|
-
self.
|
188
|
+
diff_parameters = self._diff_parameters(parameters_in=parameters_in, context_params=params)
|
189
|
+
self._context.run_log_store.set_parameters(parameters=diff_parameters, run_id=self._context.run_id)
|
172
190
|
|
173
191
|
|
174
192
|
def task_return_to_parameter(task_return: TaskReturns, value: Any) -> Parameter:
|
@@ -259,7 +277,7 @@ class PythonTaskType(BaseTaskType): # pylint: disable=too-few-public-methods
|
|
259
277
|
param_name = task_return.name
|
260
278
|
if map_variable:
|
261
279
|
for _, v in map_variable.items():
|
262
|
-
param_name = f"{
|
280
|
+
param_name = f"{v}_{param_name}"
|
263
281
|
|
264
282
|
output_parameters[param_name] = output_parameter
|
265
283
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
runnable/__init__.py,sha256=
|
1
|
+
runnable/__init__.py,sha256=V3Ihmzbb56k0qCNiBxB8ELDhgffhr_qctIy8qL0o4QM,924
|
2
2
|
runnable/catalog.py,sha256=22OECi5TrpHErxYIhfx-lJ2vgBUi4-5V9CaYEVm98hE,4138
|
3
3
|
runnable/cli.py,sha256=RILUrEfzernuKD3dNdXPBkqN_1OgE5GosYRuInj0FVs,9618
|
4
4
|
runnable/context.py,sha256=QhiXJHRcEBfSKB1ijvL5yB9w44x0HCe7VEiwK1cUJ9U,1124
|
5
|
-
runnable/datastore.py,sha256=
|
5
|
+
runnable/datastore.py,sha256=ViyAyjZQuJkRE1Q8CEEkVJXRKCmozQPe4_ZPl1X3wxo,27773
|
6
6
|
runnable/defaults.py,sha256=MOX7I2S6yO4FphZaZREFQca94a20oO8uvzXLd6GLKQs,4703
|
7
7
|
runnable/entrypoints.py,sha256=a8M7vb954as_ni7lM0t65czXQj2AHjB-KrQJ3zt3sWo,16397
|
8
8
|
runnable/exceptions.py,sha256=6NIYoTAzdKyGQ9PvW1Hu7b80OS746395KiGDhM7ThH8,2526
|
@@ -10,7 +10,7 @@ runnable/executor.py,sha256=xfBighQ5t_vejohip000XfxLwsgechUE1ZMIJWrZbUA,14484
|
|
10
10
|
runnable/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
runnable/extensions/catalog/__init__.py,sha256=uXZ6D-Myr_J4HnBA4F5Hd7LZ0IAjQiFQYxRhMzejhQc,761
|
12
12
|
runnable/extensions/catalog/file_system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
runnable/extensions/catalog/file_system/implementation.py,sha256=
|
13
|
+
runnable/extensions/catalog/file_system/implementation.py,sha256=mFPsAwPMNGWbHczpQ84o3mfkPkOEz5zjsT7a3rqNzoE,9092
|
14
14
|
runnable/extensions/catalog/k8s_pvc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
runnable/extensions/catalog/k8s_pvc/implementation.py,sha256=oJDDI0APT7lrtjWmzYJRDHLGn3Vhbn2MdFSRYvFBUpY,436
|
16
16
|
runnable/extensions/catalog/k8s_pvc/integration.py,sha256=OfrHbNFN8sR-wsVa4os3ajmWJFSd5H4KOHGVAmjRZTQ,1850
|
@@ -29,10 +29,10 @@ runnable/extensions/executor/mocked/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQ
|
|
29
29
|
runnable/extensions/executor/mocked/implementation.py,sha256=ChdUyUsiXXjG_v80d0uLp76Nz4jqqGEry36gs9gNn9k,5082
|
30
30
|
runnable/extensions/executor/retry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
runnable/extensions/executor/retry/implementation.py,sha256=ZBSYpxSiAIt-SXPD-qIPP-MMo8b7sQ6UKOTJemAjXlI,6625
|
32
|
-
runnable/extensions/nodes.py,sha256=
|
32
|
+
runnable/extensions/nodes.py,sha256=Z2LuAxeZpx1pKZmI7G2u90jAm0sdi4U2pqCIFmm0JB4,31965
|
33
33
|
runnable/extensions/run_log_store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
34
|
runnable/extensions/run_log_store/chunked_file_system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
-
runnable/extensions/run_log_store/chunked_file_system/implementation.py,sha256=
|
35
|
+
runnable/extensions/run_log_store/chunked_file_system/implementation.py,sha256=EW2P8lr3eH-pIOsMTJPr5eb-iWc48GQ97W15JzkpC_4,3326
|
36
36
|
runnable/extensions/run_log_store/chunked_k8s_pvc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
runnable/extensions/run_log_store/chunked_k8s_pvc/implementation.py,sha256=iGzy-s1eT_kAJP7XgzDLmEMOGrBLvACIiGE_wM62jGE,579
|
38
38
|
runnable/extensions/run_log_store/chunked_k8s_pvc/integration.py,sha256=atzdTy5HJ-bZsd6AzDP8kYRI1TshKxviBKeqY359TUs,1979
|
@@ -40,7 +40,7 @@ runnable/extensions/run_log_store/db/implementation_FF.py,sha256=oEiG5ASWYYbwlBb
|
|
40
40
|
runnable/extensions/run_log_store/db/integration_FF.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
41
41
|
runnable/extensions/run_log_store/file_system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
42
|
runnable/extensions/run_log_store/file_system/implementation.py,sha256=WxxfGCaDAB5zHMM3zv9aeDwXZ4DhtyzjXOjfjvyDoZ4,4288
|
43
|
-
runnable/extensions/run_log_store/generic_chunked.py,sha256=
|
43
|
+
runnable/extensions/run_log_store/generic_chunked.py,sha256=PtYK1dheKYdxODwu_ygpGRIHIepgLVaIORSqvsrg0No,19876
|
44
44
|
runnable/extensions/run_log_store/k8s_pvc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
45
|
runnable/extensions/run_log_store/k8s_pvc/implementation.py,sha256=tLgXy9HUB_vlFVQ0Itk6PpNU3GlCOILN4vA3fm80jXI,542
|
46
46
|
runnable/extensions/run_log_store/k8s_pvc/integration.py,sha256=lxQg327mwC0ykhNp5Kg34a9g8o1DzJAhfkiqMGmsABs,1873
|
@@ -57,10 +57,10 @@ runnable/parameters.py,sha256=KGGW8_uoIK2hd3EwzzBmoHBOrai3fh-SESNPpJRTfj4,5161
|
|
57
57
|
runnable/pickler.py,sha256=5SDNf0miMUJ3ZauhQdzwk8_t-9jeOqaTjP5bvRnu9sU,2685
|
58
58
|
runnable/sdk.py,sha256=JsM27GUc3c57ZepK996FHtfzXP6FGs8MP-s96RC-_fo,27648
|
59
59
|
runnable/secrets.py,sha256=dakb7WRloWVo-KpQp6Vy4rwFdGi58BTlT4OifQY106I,2324
|
60
|
-
runnable/tasks.py,sha256=
|
60
|
+
runnable/tasks.py,sha256=CKmZoQAHAQgQLGEX3S0l6qvDL5hcqHoUyTXH_gHe61M,21261
|
61
61
|
runnable/utils.py,sha256=okZFGbJWqStl5Rq5vLhNUQZDv_vhcT58bq9MDrTVxhc,19449
|
62
|
-
runnable-0.11.
|
63
|
-
runnable-0.11.
|
64
|
-
runnable-0.11.
|
65
|
-
runnable-0.11.
|
66
|
-
runnable-0.11.
|
62
|
+
runnable-0.11.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
63
|
+
runnable-0.11.2.dist-info/METADATA,sha256=5FKWYUkN4EidqFwOckXPOY0DZFqJykmaJdZAf1w__Yo,17020
|
64
|
+
runnable-0.11.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
65
|
+
runnable-0.11.2.dist-info/entry_points.txt,sha256=Wy-dimdD2REO2a36Ri84fqGqA5iwGy2RIbdgRNtCNdM,1540
|
66
|
+
runnable-0.11.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|