experimaestro 1.5.9__py3-none-any.whl → 1.5.12__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.

Potentially problematic release.


This version of experimaestro might be problematic. Click here for more details.

experimaestro/cli/jobs.py CHANGED
@@ -50,90 +50,100 @@ def process(
50
50
  perform=False,
51
51
  fullpath=False,
52
52
  ):
53
- path = workspace.path
54
- for p in (path / "xp").glob("*"):
55
- if experiment and p.name != experiment:
56
- continue
53
+ from .filter import createFilter, JobInformation
54
+ from experimaestro.scheduler import JobState
57
55
 
58
- from .filter import createFilter, JobInformation
59
- from experimaestro.scheduler import JobState
56
+ _filter = createFilter(filter) if filter else lambda x: True
60
57
 
61
- _filter = createFilter(filter) if filter else lambda x: True
58
+ # Get all jobs from experiments
59
+ job2xp = {}
60
+
61
+ path = workspace.path
62
+ for p in (path / "xp").glob("*"):
63
+ for job in p.glob("jobs/*/*"):
64
+ job_path = job.resolve()
65
+ if job_path.is_dir():
66
+ *_, scriptname = job_path.parent.name.rsplit(".", 1)
67
+ job2xp.setdefault(scriptname, set()).add(p.name)
62
68
 
63
- print(f"* Experiment {p.name}")
64
69
  if (p / "jobs.bak").is_dir():
65
- cprint(" Experiment has not finished yet", "red")
66
- if not perform and (kill or clean):
70
+ cprint(f" Experiment {p.name} has not finished yet", "red")
71
+ if (not perform) and (kill or clean):
67
72
  cprint(" Preventing kill/clean (use --force if you want to)", "yellow")
68
73
  kill = False
69
74
  clean = False
70
- print()
71
75
 
72
- for job in p.glob("jobs/*/*"):
73
- info = None
74
- p = job.resolve()
75
- if p.is_dir():
76
- *_, scriptname = p.parent.name.rsplit(".", 1)
77
-
78
- info = JobInformation(p, scriptname)
79
- job_path = (
80
- str(job.resolve()) if fullpath else f"{job.parent.name}/{job.name}"
81
- )
76
+ # Now, process jobs
77
+ for job in path.glob("jobs/*/*"):
78
+ info = None
79
+ p = job.resolve()
80
+ if p.is_dir():
81
+ *_, scriptname = p.parent.name.rsplit(".", 1)
82
+ xps = job2xp.get(scriptname, set())
83
+ if experiment and experiment not in xps:
84
+ continue
82
85
 
83
- if filter:
84
- if not _filter(info):
85
- continue
86
-
87
- if info.state is None:
88
- print(colored(f"NODIR {job_path}", "red"), end="")
89
- elif info.state.running():
90
- if kill:
91
- if perform:
92
- process = info.getprocess()
93
- if process is None:
94
- cprint(
95
- "internal error – no process could be retrieved",
96
- "red",
97
- )
98
- else:
99
- cprint(f"KILLING {process}", "light_red")
100
- process.kill()
101
- else:
102
- print("KILLING (not performing)", process)
103
- print(
104
- colored(f"{info.state.name:8}{job_path}", "yellow"),
105
- end="",
106
- )
107
- elif info.state == JobState.DONE:
108
- print(
109
- colored(f"DONE {job_path}", "green"),
110
- end="",
111
- )
112
- elif info.state == JobState.ERROR:
113
- print(colored(f"FAIL {job_path}", "red"), end="")
114
- else:
115
- print(
116
- colored(f"{info.state.name:8}{job_path}", "red"),
117
- end="",
118
- )
86
+ info = JobInformation(p, scriptname)
87
+ job_str = (
88
+ (str(job.resolve()) if fullpath else f"{job.parent.name}/{job.name}")
89
+ + " "
90
+ + ",".join(xps)
91
+ )
119
92
 
120
- else:
121
- if not ready:
93
+ if filter:
94
+ if not _filter(info):
122
95
  continue
123
- print(colored(f"READY {job_path}", "yellow"), end="")
124
96
 
125
- if tags:
126
- print(f""" {" ".join(f"{k}={v}" for k, v in info.tags.items())}""")
97
+ if info.state is None:
98
+ print(colored(f"NODIR {job_str}", "red"), end="")
99
+ elif info.state.running():
100
+ if kill:
101
+ if perform:
102
+ process = info.getprocess()
103
+ if process is None:
104
+ cprint(
105
+ "internal error – no process could be retrieved",
106
+ "red",
107
+ )
108
+ else:
109
+ cprint(f"KILLING {process}", "light_red")
110
+ process.kill()
111
+ else:
112
+ print("KILLING (not performing)", process)
113
+ print(
114
+ colored(f"{info.state.name:8}{job_str}", "yellow"),
115
+ end="",
116
+ )
117
+ elif info.state == JobState.DONE:
118
+ print(
119
+ colored(f"DONE {job_str}", "green"),
120
+ end="",
121
+ )
122
+ elif info.state == JobState.ERROR:
123
+ print(colored(f"FAIL {job_str}", "red"), end="")
124
+ else:
125
+ print(
126
+ colored(f"{info.state.name:8}{job_str}", "red"),
127
+ end="",
128
+ )
129
+
130
+ else:
131
+ if not ready:
132
+ continue
133
+ print(colored(f"READY {job_path}", "yellow"), end="")
134
+
135
+ if tags:
136
+ print(f""" {" ".join(f"{k}={v}" for k, v in info.tags.items())}""")
137
+ else:
138
+ print()
139
+
140
+ if clean and info.state and info.state.finished():
141
+ if perform:
142
+ cprint("Cleaning...", "red")
143
+ rmtree(p)
127
144
  else:
128
- print()
129
-
130
- if clean and info.state and info.state.finished():
131
- if perform:
132
- cprint("Cleaning...", "red")
133
- rmtree(p)
134
- else:
135
- cprint("Cleaning... (not performed)", "red")
136
- print()
145
+ cprint("Cleaning... (not performed)", "red")
146
+ print()
137
147
 
138
148
 
139
149
  @click.option("--experiment", default=None, help="Restrict to this experiment")
@@ -1,5 +1,11 @@
1
+ try:
2
+ from pathlib import Path, _posix_flavour
3
+ except ImportError:
4
+ # Avoids problem with python 3.12 where this module does not work
5
+ # anyways
6
+ _posix_flavour = None
7
+
1
8
  from dataclasses import dataclass
2
- from pathlib import Path, _posix_flavour
3
9
  import io
4
10
  import os
5
11
  import re
@@ -1,14 +1,18 @@
1
+ import sys
2
+ import pytest
1
3
  from experimaestro.connectors.ssh import SshPath
2
4
 
3
5
  # --- Test SSH path and SSH path manipulation
4
6
 
5
7
 
8
+ @pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python3.10 or higher")
6
9
  def test_absolute():
7
10
  path = SshPath("ssh://host//a/path")
8
11
  assert path.host == "host"
9
12
  assert path.is_absolute()
10
13
 
11
14
 
15
+ @pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python3.10 or higher")
12
16
  def test_relative():
13
17
  path = SshPath("ssh://host")
14
18
  assert path.host == "host"
@@ -17,6 +21,7 @@ def test_relative():
17
21
  assert not path.is_absolute()
18
22
 
19
23
 
24
+ @pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python3.10 or higher")
20
25
  def test_relative_withpath():
21
26
  path = SshPath("ssh://host/relative/path")
22
27
  assert path.host == "host"
@@ -24,6 +29,7 @@ def test_relative_withpath():
24
29
  assert not path.is_absolute()
25
30
 
26
31
 
32
+ @pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python3.10 or higher")
27
33
  def test_relative_absolute():
28
34
  path = SshPath("ssh://host") / "/absolute/path"
29
35
  assert path.host == "host"
@@ -31,6 +37,7 @@ def test_relative_absolute():
31
37
  assert path.is_absolute()
32
38
 
33
39
 
40
+ @pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python3.10 or higher")
34
41
  def test_relative_compose():
35
42
  path = SshPath("ssh://host/abc") / "relative/path"
36
43
  assert path.host == "host"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: experimaestro
3
- Version: 1.5.9
3
+ Version: 1.5.12
4
4
  Summary: "Experimaestro is a computer science experiment manager"
5
5
  Home-page: https://github.com/experimaestro/experimaestro-python
6
6
  License: GPL-3
@@ -4,13 +4,13 @@ experimaestro/annotations.py,sha256=dcpFmo01T12S_y5nIBIQjiXsGsq5S80ZB-58o8tW9wA,
4
4
  experimaestro/checkers.py,sha256=ZCMbnE_GFC5compWjt-fuHhPImi9fCPjImF8Ow9NqK8,696
5
5
  experimaestro/cli/__init__.py,sha256=mzc-qqTFtZnFwCQl7IiwlYXEx08kLGwdntWayCerZ6E,9610
6
6
  experimaestro/cli/filter.py,sha256=0jJrD_2cWydovjLO32vTFTK-TxXSs9P8Zxp5WaBF5AE,5790
7
- experimaestro/cli/jobs.py,sha256=eWDZ2ObdySshDujFQdkmChxD9TS53270ckTXggGFXQc,7630
7
+ experimaestro/cli/jobs.py,sha256=3cXo9-qNgtVG0ct5Kod082iXu2snczQsMss-AQvJjV0,7769
8
8
  experimaestro/click.py,sha256=6BkeQHEgcxaxzq3xEvEEzwzuBj5-dkfrpOGikuA8L00,1377
9
9
  experimaestro/commandline.py,sha256=NS1ubme8DTJtDS2uWwdHLQiZsl6TSK1LkNxu39c3-cw,9463
10
10
  experimaestro/compat.py,sha256=dQqE2ZNHLM2wtdfp7fBRYMfC33qNehVf9J6FGRBUQhs,171
11
11
  experimaestro/connectors/__init__.py,sha256=hxcBSeVLk_7oyiIlS3l-9dGg1NGtShwvRD1tS7f8D2M,5461
12
12
  experimaestro/connectors/local.py,sha256=6tlaZb0tvNS2mjsapiVbfY7kIfLICJad137VXBMz-xo,5816
13
- experimaestro/connectors/ssh.py,sha256=88z0MYJl_K2jJTX5NBx4w5DJ_UGEbN40SPs2x9dfB-Q,8260
13
+ experimaestro/connectors/ssh.py,sha256=Jk-64rwfQ9Gs_cZ8O62YviJ3M2rLaHAln2A2hdAmMW8,8400
14
14
  experimaestro/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  experimaestro/core/arguments.py,sha256=dW32opqNEsULYr6nR7Zk8PqHsSCbLPclfXofw27GTpI,5620
16
16
  experimaestro/core/context.py,sha256=Q8_ngiHRBZ0laavXRJNiDvdCprrnROVTWaHfrwMdlG4,2638
@@ -118,7 +118,7 @@ experimaestro/tests/test_param.py,sha256=FcRF8HbjoW96SR6cTW3fqracLM4BivAsTq0iZvl
118
118
  experimaestro/tests/test_progress.py,sha256=wtIGQzlV3ldd_wMng11LinVESchW-1J954mCJNlG28E,7580
119
119
  experimaestro/tests/test_serializers.py,sha256=xSCezAM9yH_Ix1wr7j0au9SyBv9DtZ7b0zs2-Ynt-VM,2338
120
120
  experimaestro/tests/test_snippets.py,sha256=rojnyDjtmAMnSuDUj6Bv9XEgdP8oQf2nVc132JF8vsM,3081
121
- experimaestro/tests/test_ssh.py,sha256=JhwsS4lJWQeMhtnDfJhQqJ5dwEThqvcNBBgUq1EWvk0,979
121
+ experimaestro/tests/test_ssh.py,sha256=KS1NWltiXrJBSStY9d4mwrexeqgNGWmhxuAU_WLQDAU,1449
122
122
  experimaestro/tests/test_tags.py,sha256=vfW99iFfw3m-pcJPy_-mtZsWbAt_Xw5k-u3dWoJbRWw,2921
123
123
  experimaestro/tests/test_tasks.py,sha256=bUSB_UT1MTN2P_RPHd4AT5NK-DFsgCVeFKSiXu3bEz8,9429
124
124
  experimaestro/tests/test_tokens.py,sha256=cW9qQU4PhbQY4_SgK8ICmKcYq8JVvLRTOYZzdtoS5N8,7826
@@ -139,8 +139,8 @@ experimaestro/utils/jupyter.py,sha256=JcEo2yQK7x3Cr1tNl5FqGMZOICxCv9DwMvL5xsWdQP
139
139
  experimaestro/utils/resources.py,sha256=MaCQL9dLfze3lwyuBVeWF7Ki5fFSE1F0BGWrfaaHi1I,1135
140
140
  experimaestro/utils/settings.py,sha256=jpFMqF0DLL4_P1xGal0zVR5cOrdD8O0Y2IOYvnRgN3k,793
141
141
  experimaestro/xpmutils.py,sha256=S21eMbDYsHfvmZ1HmKpq5Pz5O-1HnCLYxKbyTBbASyQ,638
142
- experimaestro-1.5.9.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
143
- experimaestro-1.5.9.dist-info/METADATA,sha256=qMD6N5IVxH1XZxDVAxFDd3eWBjfnYi22xW7I9RF90hQ,6265
144
- experimaestro-1.5.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
145
- experimaestro-1.5.9.dist-info/entry_points.txt,sha256=TppTNiz5qm5xm1fhAcdLKdCLMrlL-eQggtCrCI00D9c,446
146
- experimaestro-1.5.9.dist-info/RECORD,,
142
+ experimaestro-1.5.12.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
143
+ experimaestro-1.5.12.dist-info/METADATA,sha256=FZvJ_wSsKQCzCNBTM5MiqS2HyptzWQdNQflgXb7ePHE,6266
144
+ experimaestro-1.5.12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
145
+ experimaestro-1.5.12.dist-info/entry_points.txt,sha256=TppTNiz5qm5xm1fhAcdLKdCLMrlL-eQggtCrCI00D9c,446
146
+ experimaestro-1.5.12.dist-info/RECORD,,