yuclid 0.1.5__py3-none-any.whl → 0.1.8__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.
- yuclid/__init__.py +1 -1
- yuclid/run.py +54 -58
- {yuclid-0.1.5.dist-info → yuclid-0.1.8.dist-info}/METADATA +1 -1
- yuclid-0.1.8.dist-info/RECORD +11 -0
- yuclid-0.1.5.dist-info/RECORD +0 -11
- {yuclid-0.1.5.dist-info → yuclid-0.1.8.dist-info}/WHEEL +0 -0
- {yuclid-0.1.5.dist-info → yuclid-0.1.8.dist-info}/entry_points.txt +0 -0
- {yuclid-0.1.5.dist-info → yuclid-0.1.8.dist-info}/top_level.txt +0 -0
yuclid/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.1.
|
1
|
+
__version__ = "0.1.8"
|
yuclid/run.py
CHANGED
@@ -13,11 +13,19 @@ def substitute_point_yvars(x, point_map, point_id):
|
|
13
13
|
# replace ${yuclid.<name>} and ${yuclid.@} with point values
|
14
14
|
value_pattern = r"\$\{yuclid\.([a-zA-Z0-9_]+)(?:\.value)?\}"
|
15
15
|
name_pattern = r"\$\{yuclid\.([a-zA-Z0-9_]+)\.name\}"
|
16
|
+
matches = re.findall(name_pattern, x)
|
17
|
+
for name in matches:
|
18
|
+
if name not in point_map:
|
19
|
+
report(
|
20
|
+
LogLevel.FATAL,
|
21
|
+
f"point variable '{name}' not found in point_map",
|
22
|
+
hint=f"available variables: {', '.join(point_map.keys())}",
|
23
|
+
)
|
16
24
|
y = re.sub(value_pattern, lambda m: str(point_map[m.group(1)]["value"]), x)
|
17
25
|
y = re.sub(name_pattern, lambda m: str(point_map[m.group(1)]["name"]), y)
|
18
26
|
if point_id is not None:
|
19
27
|
value_pattern = r"\$\{yuclid\.\@\}"
|
20
|
-
y = re.sub(value_pattern, lambda m: f"{point_id}
|
28
|
+
y = re.sub(value_pattern, lambda m: f"{point_id}", y)
|
21
29
|
return y
|
22
30
|
|
23
31
|
|
@@ -32,69 +40,55 @@ def substitute_global_yvars(x, subspace):
|
|
32
40
|
return y
|
33
41
|
|
34
42
|
|
35
|
-
def
|
36
|
-
|
43
|
+
def validate_point_yvars(space, exps):
|
44
|
+
for exp in exps:
|
45
|
+
matches = re.findall(
|
46
|
+
r"\$\{yuclid\.([a-zA-Z0-9_@]+)(?:\.(?:name|value|names|values))?\}", exp
|
47
|
+
)
|
48
|
+
for dim in matches:
|
49
|
+
if dim not in space and dim != "@":
|
50
|
+
report(LogLevel.FATAL, f"invalid variable 'yuclid.{dim}'", exp)
|
37
51
|
|
38
52
|
|
39
|
-
def
|
40
|
-
for
|
41
|
-
|
53
|
+
def validate_global_yvars(space, exps):
|
54
|
+
for exp in exps:
|
55
|
+
exp = str(exp)
|
56
|
+
point_matches = re.findall(
|
57
|
+
r"\$\{yuclid\.([a-zA-Z0-9_@]+)(?:\.(?:name|value))?\}", exp
|
58
|
+
)
|
59
|
+
for dim in point_matches:
|
42
60
|
hint = (
|
43
61
|
"maybe you meant ${{yuclid.{}.names}} or ${{yuclid.{}.values}}?".format(
|
44
|
-
|
62
|
+
dim, dim
|
45
63
|
)
|
46
64
|
)
|
47
65
|
report(
|
48
66
|
LogLevel.FATAL,
|
49
|
-
|
50
|
-
value,
|
67
|
+
"wrong use of yuclid point variable 'yuclid.{}'".format(dim),
|
51
68
|
hint=hint,
|
52
69
|
)
|
70
|
+
global_matches = re.findall(
|
71
|
+
r"\$\{yuclid\.([a-zA-Z0-9_@]+)\.(?:names|values)\}", exp
|
72
|
+
)
|
73
|
+
for dim in global_matches:
|
74
|
+
if dim not in space:
|
75
|
+
report(LogLevel.FATAL, f"invalid variable 'yuclid.{dim}'", exp)
|
53
76
|
|
54
77
|
|
55
|
-
def
|
56
|
-
|
78
|
+
def validate_yvars_in_env(space, env):
|
79
|
+
validate_global_yvars(space, env.values())
|
57
80
|
|
58
|
-
# global setup
|
59
|
-
for command in setup["global"]:
|
60
|
-
# match ${yuclid.<name>}
|
61
|
-
# for all matches, check if the name is in on_dims
|
62
|
-
names = re.findall(get_yvar_pattern(), command)
|
63
|
-
for name in names:
|
64
|
-
hint = (
|
65
|
-
"maybe you meant ${{yuclid.{}.names}} or ${{yuclid.{}.values}}?".format(
|
66
|
-
name, name
|
67
|
-
)
|
68
|
-
)
|
69
|
-
report(
|
70
|
-
LogLevel.FATAL,
|
71
|
-
f"cannot use yuclid point variables in global setup",
|
72
|
-
command,
|
73
|
-
hint=hint,
|
74
|
-
)
|
75
81
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
if name not in on_dims:
|
87
|
-
hint = "available variables: {}".format(
|
88
|
-
", ".join(["${{yuclid.{}}}".format(d) for d in on_dims])
|
89
|
-
)
|
90
|
-
if name == "@":
|
91
|
-
hint = ". ${yuclid.@} is reserved for trial commands"
|
92
|
-
report(
|
93
|
-
LogLevel.FATAL,
|
94
|
-
f"invalid yuclid variable '{name}' in point setup",
|
95
|
-
command,
|
96
|
-
hint=hint,
|
97
|
-
)
|
82
|
+
def validate_yvars_in_setup(space, setup):
|
83
|
+
validate_global_yvars(space, setup["global"])
|
84
|
+
|
85
|
+
for point in setup["point"]:
|
86
|
+
validate_point_yvars(space, point["commands"])
|
87
|
+
|
88
|
+
|
89
|
+
def validate_yvars_in_trials(space, trials):
|
90
|
+
commands = [trial["command"] for trial in trials]
|
91
|
+
validate_point_yvars(space, commands)
|
98
92
|
|
99
93
|
|
100
94
|
def load_json(f):
|
@@ -420,7 +414,7 @@ def normalize_data(json_data):
|
|
420
414
|
"trial references unknown metrics",
|
421
415
|
", ".join(trial["metrics"]),
|
422
416
|
hint="available metrics: {}".format(
|
423
|
-
", ".join(
|
417
|
+
", ".join({m["name"] for m in normalized["metrics"]})
|
424
418
|
),
|
425
419
|
)
|
426
420
|
|
@@ -770,7 +764,7 @@ def run_point_trials(settings, data, execution, f, i, point):
|
|
770
764
|
|
771
765
|
if command_output.returncode != 0:
|
772
766
|
hint = "check the following files for more details:\n"
|
773
|
-
hint += f"{point_id}.out\n{point_id}.err
|
767
|
+
hint += f"{point_id}.out\n{point_id}.err"
|
774
768
|
report(
|
775
769
|
LogLevel.ERROR,
|
776
770
|
point_to_string(point),
|
@@ -792,7 +786,7 @@ def run_point_trials(settings, data, execution, f, i, point):
|
|
792
786
|
|
793
787
|
def complain():
|
794
788
|
hint = "check the following files for more details:\n"
|
795
|
-
hint += f"{point_id}.out\n{point_id}.err\n
|
789
|
+
hint += f"{point_id}.out\n{point_id}.err\n"
|
796
790
|
report(
|
797
791
|
LogLevel.ERROR,
|
798
792
|
point_to_string(point),
|
@@ -1158,8 +1152,8 @@ def normalize_point_setup(point_setup, space):
|
|
1158
1152
|
# check validity of 'parallel' fields
|
1159
1153
|
for item in normalized_items:
|
1160
1154
|
parallel = item["parallel"]
|
1161
|
-
if not isinstance(parallel, (bool, list)) or
|
1162
|
-
|
1155
|
+
if not isinstance(parallel, (bool, list)) or (
|
1156
|
+
isinstance(parallel, list) and any(not isinstance(x, str) for x in parallel)
|
1163
1157
|
):
|
1164
1158
|
report(
|
1165
1159
|
LogLevel.FATAL,
|
@@ -1227,7 +1221,7 @@ def run_experiments(settings, data, order, env, preset_name=None):
|
|
1227
1221
|
|
1228
1222
|
def validate_settings(data, settings):
|
1229
1223
|
if settings["metrics"]:
|
1230
|
-
valid =
|
1224
|
+
valid = {x["name"] for x in data["metrics"]}
|
1231
1225
|
wrong = [m for m in settings["metrics"] if m not in valid]
|
1232
1226
|
if len(wrong) > 0:
|
1233
1227
|
hint = "available metrics: {}".format(", ".join(valid))
|
@@ -1245,8 +1239,10 @@ def launch(args):
|
|
1245
1239
|
validate_settings(data, settings)
|
1246
1240
|
env = build_environment(settings, data)
|
1247
1241
|
order = define_order(settings, data)
|
1248
|
-
validate_yvars_in_env(env)
|
1249
|
-
validate_yvars_in_setup(data)
|
1242
|
+
validate_yvars_in_env(data["space"], data["env"])
|
1243
|
+
validate_yvars_in_setup(data["space"], data["setup"])
|
1244
|
+
validate_yvars_in_trials(data["space"], data["trials"])
|
1245
|
+
|
1250
1246
|
validate_presets(settings, data)
|
1251
1247
|
|
1252
1248
|
if len(settings["presets"]) > 0:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: yuclid
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.8
|
4
4
|
Summary: Run experiments and interactively plot results across combinations of user-specified dimensions
|
5
5
|
Author-email: Federico Sossai <federico.sossai@gmail.com>
|
6
6
|
Project-URL: Homepage, https://github.com/fsossai/yuclid
|
@@ -0,0 +1,11 @@
|
|
1
|
+
yuclid/__init__.py,sha256=1CUarGSwycOh0GKIcMutmmKE9j9E4B6-Jji1lJFY5Aw,21
|
2
|
+
yuclid/cli.py,sha256=YZzxJty5wlUhCOEELvEcJeQb_lQ1Qc89RG4_s5IyKWU,6224
|
3
|
+
yuclid/log.py,sha256=GR_FVfNroumuonKguAPd6H1rKjxJKRc8tAS2sVNTbzE,1655
|
4
|
+
yuclid/plot.py,sha256=R6IXw6hHuXYFx1MjTKLCIqBfdNORStVEoDidAr-jEuE,29697
|
5
|
+
yuclid/run.py,sha256=wVa87CWV2w9bUXG76mQpKh-MG0xFc1R4vKKb1j1Qt1s,44891
|
6
|
+
yuclid/spread.py,sha256=4Ci3nsu8n_dhG-AK2IWHKRElQ8oaGdw14LrgNu79biM,4938
|
7
|
+
yuclid-0.1.8.dist-info/METADATA,sha256=kthBAHmTsA6KC1vzVFCWbb8lT_tOET6V-5Oh0JuwdQM,673
|
8
|
+
yuclid-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
+
yuclid-0.1.8.dist-info/entry_points.txt,sha256=2AvTtyt5iBnjr6HnjqH_3PeSoq9UzIbT92qivmEbOYA,43
|
10
|
+
yuclid-0.1.8.dist-info/top_level.txt,sha256=cL5mb4h_4etwTsqhPvSnoVBXImIzPFGd3rINV1nEjPo,7
|
11
|
+
yuclid-0.1.8.dist-info/RECORD,,
|
yuclid-0.1.5.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
yuclid/__init__.py,sha256=Nmswip0IUvJenHIhdfSyTYurDcwWTvOQ8mPDREtwE1o,21
|
2
|
-
yuclid/cli.py,sha256=YZzxJty5wlUhCOEELvEcJeQb_lQ1Qc89RG4_s5IyKWU,6224
|
3
|
-
yuclid/log.py,sha256=GR_FVfNroumuonKguAPd6H1rKjxJKRc8tAS2sVNTbzE,1655
|
4
|
-
yuclid/plot.py,sha256=R6IXw6hHuXYFx1MjTKLCIqBfdNORStVEoDidAr-jEuE,29697
|
5
|
-
yuclid/run.py,sha256=N6zAxYFOOfVGxlY55IIR62jl1HJm4xVQcQjl-a6f_U4,45076
|
6
|
-
yuclid/spread.py,sha256=4Ci3nsu8n_dhG-AK2IWHKRElQ8oaGdw14LrgNu79biM,4938
|
7
|
-
yuclid-0.1.5.dist-info/METADATA,sha256=T6IqTWuc7V7JPG4xmKezpyE0mbRMGnLB11-jBwGoY5c,673
|
8
|
-
yuclid-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
-
yuclid-0.1.5.dist-info/entry_points.txt,sha256=2AvTtyt5iBnjr6HnjqH_3PeSoq9UzIbT92qivmEbOYA,43
|
10
|
-
yuclid-0.1.5.dist-info/top_level.txt,sha256=cL5mb4h_4etwTsqhPvSnoVBXImIzPFGd3rINV1nEjPo,7
|
11
|
-
yuclid-0.1.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|