runnable 0.10.0__py3-none-any.whl → 0.11.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- runnable/__init__.py +16 -8
- runnable/catalog.py +8 -1
- runnable/cli.py +2 -0
- runnable/context.py +5 -3
- runnable/datastore.py +96 -12
- runnable/defaults.py +9 -9
- runnable/entrypoints.py +43 -24
- runnable/exceptions.py +4 -0
- runnable/extensions/catalog/file_system/implementation.py +8 -1
- runnable/extensions/executor/__init__.py +87 -29
- runnable/extensions/executor/argo/implementation.py +8 -4
- runnable/extensions/executor/local/implementation.py +1 -0
- runnable/extensions/nodes.py +90 -13
- runnable/extensions/run_log_store/chunked_file_system/implementation.py +6 -1
- runnable/extensions/run_log_store/file_system/implementation.py +6 -0
- runnable/graph.py +11 -0
- runnable/integration.py +4 -17
- runnable/nodes.py +9 -0
- runnable/parameters.py +3 -1
- runnable/sdk.py +65 -16
- runnable/tasks.py +135 -53
- runnable/utils.py +2 -1
- {runnable-0.10.0.dist-info → runnable-0.11.1.dist-info}/METADATA +2 -3
- {runnable-0.10.0.dist-info → runnable-0.11.1.dist-info}/RECORD +27 -31
- {runnable-0.10.0.dist-info → runnable-0.11.1.dist-info}/entry_points.txt +0 -4
- runnable/experiment_tracker.py +0 -139
- runnable/extensions/experiment_tracker/__init__.py +0 -0
- runnable/extensions/experiment_tracker/mlflow/__init__.py +0 -0
- runnable/extensions/experiment_tracker/mlflow/implementation.py +0 -94
- {runnable-0.10.0.dist-info → runnable-0.11.1.dist-info}/LICENSE +0 -0
- {runnable-0.10.0.dist-info → runnable-0.11.1.dist-info}/WHEEL +0 -0
@@ -1,49 +1,45 @@
|
|
1
|
-
runnable/__init__.py,sha256=
|
2
|
-
runnable/catalog.py,sha256=
|
3
|
-
runnable/cli.py,sha256=
|
4
|
-
runnable/context.py,sha256=
|
5
|
-
runnable/datastore.py,sha256=
|
6
|
-
runnable/defaults.py,sha256=
|
7
|
-
runnable/entrypoints.py,sha256=
|
8
|
-
runnable/exceptions.py,sha256=
|
1
|
+
runnable/__init__.py,sha256=C5ySSfN_vHWFTscnxLx3tfMjKT3Bs9jfUjXnDvun33Y,870
|
2
|
+
runnable/catalog.py,sha256=22OECi5TrpHErxYIhfx-lJ2vgBUi4-5V9CaYEVm98hE,4138
|
3
|
+
runnable/cli.py,sha256=RILUrEfzernuKD3dNdXPBkqN_1OgE5GosYRuInj0FVs,9618
|
4
|
+
runnable/context.py,sha256=QhiXJHRcEBfSKB1ijvL5yB9w44x0HCe7VEiwK1cUJ9U,1124
|
5
|
+
runnable/datastore.py,sha256=EgKi4_b5g6KbInpjMyw8Xwr-EgcSGi1Lx2u5vp4amSQ,27672
|
6
|
+
runnable/defaults.py,sha256=MOX7I2S6yO4FphZaZREFQca94a20oO8uvzXLd6GLKQs,4703
|
7
|
+
runnable/entrypoints.py,sha256=a8M7vb954as_ni7lM0t65czXQj2AHjB-KrQJ3zt3sWo,16397
|
8
|
+
runnable/exceptions.py,sha256=6NIYoTAzdKyGQ9PvW1Hu7b80OS746395KiGDhM7ThH8,2526
|
9
9
|
runnable/executor.py,sha256=xfBighQ5t_vejohip000XfxLwsgechUE1ZMIJWrZbUA,14484
|
10
|
-
runnable/experiment_tracker.py,sha256=bX2Vr73f3bsdnWqxjMSSiKA-WwqkUHfUzJQqZoQBpvY,3668
|
11
10
|
runnable/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
11
|
runnable/extensions/catalog/__init__.py,sha256=uXZ6D-Myr_J4HnBA4F5Hd7LZ0IAjQiFQYxRhMzejhQc,761
|
13
12
|
runnable/extensions/catalog/file_system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
runnable/extensions/catalog/file_system/implementation.py,sha256=
|
13
|
+
runnable/extensions/catalog/file_system/implementation.py,sha256=9j920o9SULdcVp1Mr8FgeuV-Sv5bR3w5tcohChxHnak,9130
|
15
14
|
runnable/extensions/catalog/k8s_pvc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
15
|
runnable/extensions/catalog/k8s_pvc/implementation.py,sha256=oJDDI0APT7lrtjWmzYJRDHLGn3Vhbn2MdFSRYvFBUpY,436
|
17
16
|
runnable/extensions/catalog/k8s_pvc/integration.py,sha256=OfrHbNFN8sR-wsVa4os3ajmWJFSd5H4KOHGVAmjRZTQ,1850
|
18
|
-
runnable/extensions/executor/__init__.py,sha256=
|
17
|
+
runnable/extensions/executor/__init__.py,sha256=eV3q_dL2cRqYaJ8RWV6Xk1__KMWMM2hUnQFT7Z5pRso,26698
|
19
18
|
runnable/extensions/executor/argo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
-
runnable/extensions/executor/argo/implementation.py,sha256=
|
19
|
+
runnable/extensions/executor/argo/implementation.py,sha256=_BfxCe742S6uV-7PuQ53KjzwY-8Rq-5y9txOXMYf20U,43670
|
21
20
|
runnable/extensions/executor/argo/specification.yaml,sha256=wXQcm2gOQYqy-IOQIhucohS32ZrHKCfGA5zZ0RraPYc,1276
|
22
21
|
runnable/extensions/executor/k8s_job/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
22
|
runnable/extensions/executor/k8s_job/implementation_FF.py,sha256=1IfVG1GRcJcVFzQ-WhkJsmzdJuj51QMxXylY9UrWM0U,10259
|
24
23
|
runnable/extensions/executor/k8s_job/integration_FF.py,sha256=pG6HKhPMgCRIgu1PAnBvsfJQE1FxcjuSiC2I-Hn5sWo,2165
|
25
24
|
runnable/extensions/executor/local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
-
runnable/extensions/executor/local/implementation.py,sha256=
|
25
|
+
runnable/extensions/executor/local/implementation.py,sha256=e8Tzv-FgQmJeUXVut96jeNERTR83JVG_zkQZMEjCVAs,2469
|
27
26
|
runnable/extensions/executor/local_container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
27
|
runnable/extensions/executor/local_container/implementation.py,sha256=6kYMgdgE5JxZkVAidxsBSpqkHvyKMfEctgZWSZQEpXA,13979
|
29
28
|
runnable/extensions/executor/mocked/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
29
|
runnable/extensions/executor/mocked/implementation.py,sha256=ChdUyUsiXXjG_v80d0uLp76Nz4jqqGEry36gs9gNn9k,5082
|
31
30
|
runnable/extensions/executor/retry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
31
|
runnable/extensions/executor/retry/implementation.py,sha256=ZBSYpxSiAIt-SXPD-qIPP-MMo8b7sQ6UKOTJemAjXlI,6625
|
33
|
-
runnable/extensions/
|
34
|
-
runnable/extensions/experiment_tracker/mlflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
-
runnable/extensions/experiment_tracker/mlflow/implementation.py,sha256=sc1Wm1LCf7wBX0BYVx3YVdwsR72AE0qIrzl7cEfIl58,3045
|
36
|
-
runnable/extensions/nodes.py,sha256=Em-vs21ZfhyvFh-s6NZVhcUydSrX_mY8mb8-NUAO_w8,29883
|
32
|
+
runnable/extensions/nodes.py,sha256=5soHRhfT8FY2vnQa4kvRqeVphTq_t-GSw-ExNZfgB30,31965
|
37
33
|
runnable/extensions/run_log_store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
34
|
runnable/extensions/run_log_store/chunked_file_system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
-
runnable/extensions/run_log_store/chunked_file_system/implementation.py,sha256=
|
35
|
+
runnable/extensions/run_log_store/chunked_file_system/implementation.py,sha256=wtOeREr9QyIuMHLCT7o_eDCJVCDsBvwmk89kos3dhfQ,3326
|
40
36
|
runnable/extensions/run_log_store/chunked_k8s_pvc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
41
37
|
runnable/extensions/run_log_store/chunked_k8s_pvc/implementation.py,sha256=iGzy-s1eT_kAJP7XgzDLmEMOGrBLvACIiGE_wM62jGE,579
|
42
38
|
runnable/extensions/run_log_store/chunked_k8s_pvc/integration.py,sha256=atzdTy5HJ-bZsd6AzDP8kYRI1TshKxviBKeqY359TUs,1979
|
43
39
|
runnable/extensions/run_log_store/db/implementation_FF.py,sha256=oEiG5ASWYYbwlBbnryKarQENB-L_yOsnZahbj2U0GdQ,5155
|
44
40
|
runnable/extensions/run_log_store/db/integration_FF.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
41
|
runnable/extensions/run_log_store/file_system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
46
|
-
runnable/extensions/run_log_store/file_system/implementation.py,sha256=
|
42
|
+
runnable/extensions/run_log_store/file_system/implementation.py,sha256=WxxfGCaDAB5zHMM3zv9aeDwXZ4DhtyzjXOjfjvyDoZ4,4288
|
47
43
|
runnable/extensions/run_log_store/generic_chunked.py,sha256=rcY5f-MIYUUiM5iQnDHICOh7cKiOUSCeaxcBG9_fz-U,19390
|
48
44
|
runnable/extensions/run_log_store/k8s_pvc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
45
|
runnable/extensions/run_log_store/k8s_pvc/implementation.py,sha256=tLgXy9HUB_vlFVQ0Itk6PpNU3GlCOILN4vA3fm80jXI,542
|
@@ -53,18 +49,18 @@ runnable/extensions/secrets/dotenv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
|
|
53
49
|
runnable/extensions/secrets/dotenv/implementation.py,sha256=3J5pofWahdZbnwnETwpspE5-PKyvmZF_vkfwA1X_bkA,3365
|
54
50
|
runnable/extensions/secrets/env_secrets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
51
|
runnable/extensions/secrets/env_secrets/implementation.py,sha256=5XiHdJvIr0-jkl4fGfEf26UsgE5Q2Z4oCc0RwjlJdJA,1236
|
56
|
-
runnable/graph.py,sha256=
|
57
|
-
runnable/integration.py,sha256=
|
52
|
+
runnable/graph.py,sha256=18IpGYw5kgHP32m12WwXscx-kG5Kx-AuWS1LFbMfBLg,16202
|
53
|
+
runnable/integration.py,sha256=eb9qJVZR7Ehg0N1UnGPuyjJvoA-xQ1-xP7AlZHUXHqM,6705
|
58
54
|
runnable/names.py,sha256=vn92Kv9ANROYSZX6Z4z1v_WA3WiEdIYmG6KEStBFZug,8134
|
59
|
-
runnable/nodes.py,sha256
|
60
|
-
runnable/parameters.py,sha256
|
55
|
+
runnable/nodes.py,sha256=UqR-bJx0Hi7uLSUw_saB7VsNdFh3POKtdgsEPsasHfE,16576
|
56
|
+
runnable/parameters.py,sha256=KGGW8_uoIK2hd3EwzzBmoHBOrai3fh-SESNPpJRTfj4,5161
|
61
57
|
runnable/pickler.py,sha256=5SDNf0miMUJ3ZauhQdzwk8_t-9jeOqaTjP5bvRnu9sU,2685
|
62
|
-
runnable/sdk.py,sha256=
|
58
|
+
runnable/sdk.py,sha256=JsM27GUc3c57ZepK996FHtfzXP6FGs8MP-s96RC-_fo,27648
|
63
59
|
runnable/secrets.py,sha256=dakb7WRloWVo-KpQp6Vy4rwFdGi58BTlT4OifQY106I,2324
|
64
|
-
runnable/tasks.py,sha256=
|
65
|
-
runnable/utils.py,sha256=
|
66
|
-
runnable-0.
|
67
|
-
runnable-0.
|
68
|
-
runnable-0.
|
69
|
-
runnable-0.
|
70
|
-
runnable-0.
|
60
|
+
runnable/tasks.py,sha256=CH0W7evAZK5hco0medJS6DwHRr06bng7oB7xk0Xh6zQ,20618
|
61
|
+
runnable/utils.py,sha256=okZFGbJWqStl5Rq5vLhNUQZDv_vhcT58bq9MDrTVxhc,19449
|
62
|
+
runnable-0.11.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
63
|
+
runnable-0.11.1.dist-info/METADATA,sha256=IKuld8eA9gcb6y7YZaO-3Dpmw2x4U2wnPg0eag1fewU,17020
|
64
|
+
runnable-0.11.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
65
|
+
runnable-0.11.1.dist-info/entry_points.txt,sha256=Wy-dimdD2REO2a36Ri84fqGqA5iwGy2RIbdgRNtCNdM,1540
|
66
|
+
runnable-0.11.1.dist-info/RECORD,,
|
@@ -12,10 +12,6 @@ local-container=runnable.extensions.executor.local_container.implementation:Loca
|
|
12
12
|
mocked=runnable.extensions.executor.mocked.implementation:MockedExecutor
|
13
13
|
retry=runnable.extensions.executor.retry.implementation:RetryExecutor
|
14
14
|
|
15
|
-
[experiment_tracker]
|
16
|
-
do-nothing=runnable.experiment_tracker:DoNothingTracker
|
17
|
-
mlflow=runnable.extensions.experiment_tracker.mlflow.implementation:MLFlowExperimentTracker
|
18
|
-
|
19
15
|
[nodes]
|
20
16
|
dag=runnable.extensions.nodes:DagNode
|
21
17
|
fail=runnable.extensions.nodes:FailNode
|
runnable/experiment_tracker.py
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
import contextlib
|
2
|
-
import json
|
3
|
-
import logging
|
4
|
-
import os
|
5
|
-
from abc import ABC, abstractmethod
|
6
|
-
from collections import defaultdict
|
7
|
-
from typing import Any, ContextManager, Dict, Tuple, Union
|
8
|
-
|
9
|
-
from pydantic import BaseModel, ConfigDict
|
10
|
-
|
11
|
-
import runnable.context as context
|
12
|
-
from runnable import defaults
|
13
|
-
from runnable.utils import remove_prefix
|
14
|
-
|
15
|
-
logger = logging.getLogger(defaults.LOGGER_NAME)
|
16
|
-
|
17
|
-
|
18
|
-
def retrieve_step_details(key: str) -> Tuple[str, int]:
|
19
|
-
key = remove_prefix(key, defaults.TRACK_PREFIX)
|
20
|
-
data = key.split(defaults.STEP_INDICATOR)
|
21
|
-
|
22
|
-
key = data[0].lower()
|
23
|
-
step = 0
|
24
|
-
|
25
|
-
if len(data) > 1:
|
26
|
-
step = int(data[1])
|
27
|
-
|
28
|
-
return key, step
|
29
|
-
|
30
|
-
|
31
|
-
def get_tracked_data() -> Dict[str, Any]:
|
32
|
-
tracked_data: Dict[str, Any] = defaultdict(dict)
|
33
|
-
for env_var, value in os.environ.items():
|
34
|
-
if env_var.startswith(defaults.TRACK_PREFIX):
|
35
|
-
key, step = retrieve_step_details(env_var)
|
36
|
-
|
37
|
-
# print(value, type(value))
|
38
|
-
try:
|
39
|
-
value = json.loads(value)
|
40
|
-
except json.decoder.JSONDecodeError:
|
41
|
-
logger.warning(f"Tracker {key} could not be JSON decoded, adding the literal value")
|
42
|
-
|
43
|
-
tracked_data[key][step] = value
|
44
|
-
del os.environ[env_var]
|
45
|
-
|
46
|
-
for key, value in tracked_data.items():
|
47
|
-
if len(value) == 1:
|
48
|
-
tracked_data[key] = value[0]
|
49
|
-
|
50
|
-
return tracked_data
|
51
|
-
|
52
|
-
|
53
|
-
# --8<-- [start:docs]
|
54
|
-
|
55
|
-
|
56
|
-
class BaseExperimentTracker(ABC, BaseModel):
|
57
|
-
"""
|
58
|
-
Base Experiment tracker class definition.
|
59
|
-
"""
|
60
|
-
|
61
|
-
service_name: str = ""
|
62
|
-
service_type: str = "experiment_tracker"
|
63
|
-
|
64
|
-
@property
|
65
|
-
def _context(self):
|
66
|
-
return context.run_context
|
67
|
-
|
68
|
-
model_config = ConfigDict(extra="forbid")
|
69
|
-
|
70
|
-
@property
|
71
|
-
def client_context(self) -> ContextManager:
|
72
|
-
"""
|
73
|
-
Returns the client context.
|
74
|
-
"""
|
75
|
-
return contextlib.nullcontext()
|
76
|
-
|
77
|
-
def publish_data(self, tracked_data: Dict[str, Any]):
|
78
|
-
for key, value in tracked_data.items():
|
79
|
-
if isinstance(value, dict):
|
80
|
-
for key2, value2 in value.items():
|
81
|
-
self.log_metric(key, value2, step=key2)
|
82
|
-
continue
|
83
|
-
self.log_metric(key, value)
|
84
|
-
|
85
|
-
@abstractmethod
|
86
|
-
def log_metric(self, key: str, value: Union[int, float], step: int = 0):
|
87
|
-
"""
|
88
|
-
Sets the metric in the experiment tracking.
|
89
|
-
|
90
|
-
Args:
|
91
|
-
key (str): The key against you want to store the value
|
92
|
-
value (float): The value of the metric
|
93
|
-
step (int): Optional step at which it was recorded
|
94
|
-
|
95
|
-
Raises:
|
96
|
-
NotImplementedError: Base class, hence not implemented
|
97
|
-
"""
|
98
|
-
raise NotImplementedError
|
99
|
-
|
100
|
-
@abstractmethod
|
101
|
-
def log_parameter(self, key: str, value: Any):
|
102
|
-
"""
|
103
|
-
Logs a parameter in the experiment tracking.
|
104
|
-
|
105
|
-
Args:
|
106
|
-
key (str): The key against you want to store the value
|
107
|
-
value (any): The value of the metric
|
108
|
-
|
109
|
-
Raises:
|
110
|
-
NotImplementedError: Base class, hence not implemented
|
111
|
-
"""
|
112
|
-
pass
|
113
|
-
|
114
|
-
|
115
|
-
# --8<-- [end:docs]
|
116
|
-
|
117
|
-
|
118
|
-
class DoNothingTracker(BaseExperimentTracker):
|
119
|
-
"""
|
120
|
-
A Do nothing tracker
|
121
|
-
"""
|
122
|
-
|
123
|
-
service_name: str = "do-nothing"
|
124
|
-
|
125
|
-
def log_metric(self, key: str, value: Union[int, float], step: int = 0):
|
126
|
-
"""
|
127
|
-
Sets the metric in the experiment tracking.
|
128
|
-
|
129
|
-
Args:
|
130
|
-
key (str): The key against you want to store the value
|
131
|
-
value (float): The value of the metric
|
132
|
-
"""
|
133
|
-
...
|
134
|
-
|
135
|
-
def log_parameter(self, key: str, value: Any):
|
136
|
-
"""
|
137
|
-
Since this is a Do nothing tracker, we don't need to log anything.
|
138
|
-
"""
|
139
|
-
...
|
File without changes
|
File without changes
|
@@ -1,94 +0,0 @@
|
|
1
|
-
import functools
|
2
|
-
import logging
|
3
|
-
from typing import Any, Union
|
4
|
-
|
5
|
-
from pydantic import ConfigDict, PrivateAttr
|
6
|
-
|
7
|
-
from runnable import defaults
|
8
|
-
from runnable.experiment_tracker import BaseExperimentTracker
|
9
|
-
|
10
|
-
logger = logging.getLogger(defaults.NAME)
|
11
|
-
|
12
|
-
|
13
|
-
class MLFlowExperimentTracker(BaseExperimentTracker):
|
14
|
-
"""
|
15
|
-
A MLFlow experiment tracker.
|
16
|
-
|
17
|
-
TODO: Need to set up credentials from secrets
|
18
|
-
"""
|
19
|
-
|
20
|
-
service_name: str = "mlflow"
|
21
|
-
|
22
|
-
server_url: str
|
23
|
-
autolog: bool = False
|
24
|
-
|
25
|
-
_default_experiment_name: str = PrivateAttr(default="Default")
|
26
|
-
_active_run_id: str = PrivateAttr(default="")
|
27
|
-
_client: Any = PrivateAttr(default=None)
|
28
|
-
|
29
|
-
model_config = ConfigDict(extra="forbid")
|
30
|
-
|
31
|
-
def model_post_init(self, __context: Any) -> None:
|
32
|
-
try:
|
33
|
-
import mlflow
|
34
|
-
except ImportError:
|
35
|
-
raise Exception("You need to install mlflow to use MLFlowExperimentTracker.")
|
36
|
-
|
37
|
-
self._client = mlflow
|
38
|
-
|
39
|
-
self._client.set_tracking_uri(self.server_url)
|
40
|
-
|
41
|
-
if self.autolog:
|
42
|
-
self._client.autolog(log_models=False)
|
43
|
-
|
44
|
-
@functools.cached_property
|
45
|
-
def experiment_id(self):
|
46
|
-
experiment_name = self._default_experiment_name
|
47
|
-
|
48
|
-
# If a tag is provided, we should create that as our experiment
|
49
|
-
if self._context.tag:
|
50
|
-
experiment_name = self._context.tag
|
51
|
-
|
52
|
-
experiment = self._client.get_experiment_by_name(experiment_name)
|
53
|
-
if not experiment:
|
54
|
-
# Create the experiment and get it.
|
55
|
-
experiment = self._client.create_experiment(experiment_name)
|
56
|
-
experiment = self._client.get_experiment(experiment)
|
57
|
-
|
58
|
-
return experiment.experiment_id
|
59
|
-
|
60
|
-
@functools.cached_property
|
61
|
-
def run_name(self):
|
62
|
-
return self._context.run_id
|
63
|
-
|
64
|
-
@property
|
65
|
-
def client_context(self):
|
66
|
-
if self._active_run_id:
|
67
|
-
return self._client.start_run(
|
68
|
-
run_id=self._active_run_id, experiment_id=self.experiment_id, run_name=self.run_name
|
69
|
-
)
|
70
|
-
|
71
|
-
active_run = self._client.start_run(run_name=self.run_name, experiment_id=self.experiment_id)
|
72
|
-
self._active_run_id = active_run.info.run_id
|
73
|
-
return active_run
|
74
|
-
|
75
|
-
def log_metric(self, key: str, value: Union[int, float], step: int = 0):
|
76
|
-
"""
|
77
|
-
Sets the metric in the experiment tracking.
|
78
|
-
|
79
|
-
Args:
|
80
|
-
key (str): The key against you want to store the value
|
81
|
-
value (Any): The value of the metric
|
82
|
-
"""
|
83
|
-
if not isinstance(value, float) or isinstance(value, int):
|
84
|
-
msg = f"Only float/int values are accepted as metrics. Setting the metric {key} as parameter {key}_{step}"
|
85
|
-
logger.warning(msg)
|
86
|
-
self.log_parameter(key=key, value=value, step=step)
|
87
|
-
return
|
88
|
-
|
89
|
-
with self.client_context as _:
|
90
|
-
self._client.log_metric(key, float(value), step=step or None)
|
91
|
-
|
92
|
-
def log_parameter(self, key: str, value: Any, step: int = 0):
|
93
|
-
with self.client_context as _:
|
94
|
-
self._client.log_param(key + f"_{str(step)}", value)
|
File without changes
|
File without changes
|