oh-my-batch 0.1.0.dev1__py3-none-any.whl → 0.1.0.dev2__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.
- oh_my_batch/job.py +20 -27
- {oh_my_batch-0.1.0.dev1.dist-info → oh_my_batch-0.1.0.dev2.dist-info}/METADATA +1 -1
- {oh_my_batch-0.1.0.dev1.dist-info → oh_my_batch-0.1.0.dev2.dist-info}/RECORD +6 -6
- {oh_my_batch-0.1.0.dev1.dist-info → oh_my_batch-0.1.0.dev2.dist-info}/LICENSE +0 -0
- {oh_my_batch-0.1.0.dev1.dist-info → oh_my_batch-0.1.0.dev2.dist-info}/WHEEL +0 -0
- {oh_my_batch-0.1.0.dev1.dist-info → oh_my_batch-0.1.0.dev2.dist-info}/entry_points.txt +0 -0
oh_my_batch/job.py
CHANGED
@@ -12,29 +12,22 @@ from .util import expand_globs, shell_run, parse_csv
|
|
12
12
|
|
13
13
|
logger = logging.getLogger(__name__)
|
14
14
|
|
15
|
+
class JobState:
|
16
|
+
NULL = 0
|
17
|
+
PENDING = 1
|
18
|
+
RUNNING = 2
|
19
|
+
CANCELLED = 3
|
20
|
+
COMPLETED = 4
|
21
|
+
FAILED = 5
|
22
|
+
UNKNOWN = 6
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
obj.terminal = terminal
|
24
|
-
obj.status_name = status_name
|
25
|
-
return obj
|
26
|
-
|
27
|
-
value: int # type: ignore
|
28
|
-
terminal: bool
|
29
|
-
status_name: str
|
30
|
-
|
31
|
-
NULL = (0, True, "NULL")
|
32
|
-
PENDING = (1, False, "PENDING")
|
33
|
-
RUNNING = (2, False, "RUNNING")
|
34
|
-
CANCELLED = (3, True, "CANCELLED")
|
35
|
-
COMPLETED = (4, True, "COMPLETED")
|
36
|
-
FAILED = (5, True, "FAILED")
|
37
|
-
UNKNOWN = (6, False, "UNKNOWN")
|
24
|
+
@classmethod
|
25
|
+
def is_terminal(cls, state: int):
|
26
|
+
return state in (JobState.NULL, JobState.COMPLETED, JobState.FAILED, JobState.CANCELLED)
|
27
|
+
|
28
|
+
@classmethod
|
29
|
+
def is_success(cls, state: int):
|
30
|
+
return state == JobState.COMPLETED
|
38
31
|
|
39
32
|
|
40
33
|
def new_job(script: str):
|
@@ -84,7 +77,7 @@ class BaseJobManager:
|
|
84
77
|
break
|
85
78
|
|
86
79
|
# stop if all jobs are terminal and not job to be submitted
|
87
|
-
if (all(j['state']
|
80
|
+
if (all(JobState.is_terminal(j['state']) for j in jobs) and
|
88
81
|
not any(should_submit(j, max_tries) for j in jobs)):
|
89
82
|
break
|
90
83
|
|
@@ -129,8 +122,8 @@ class Slurm(BaseJobManager):
|
|
129
122
|
logger.warning('Unknown job %s state: %s',row['JobID'], row['State'])
|
130
123
|
break
|
131
124
|
else:
|
132
|
-
job['
|
133
|
-
|
125
|
+
if job['id']:
|
126
|
+
logger.error('Job %s not found in sacct output', job['id'])
|
134
127
|
|
135
128
|
# check if there are jobs to be (re)submitted
|
136
129
|
for job in jobs:
|
@@ -170,8 +163,8 @@ class Slurm(BaseJobManager):
|
|
170
163
|
|
171
164
|
|
172
165
|
def should_submit(job: dict, max_tries: int):
|
173
|
-
state:
|
174
|
-
if not state
|
166
|
+
state: int = job['state']
|
167
|
+
if not JobState.is_terminal(state):
|
175
168
|
return False
|
176
169
|
if job['tries'] >= max_tries:
|
177
170
|
return False
|
@@ -5,10 +5,10 @@ oh_my_batch/assets/functions.sh,sha256=eORxFefV-XrWbG-2I6u-c8uf1XxOQ31LaeVHBumwz
|
|
5
5
|
oh_my_batch/batch.py,sha256=e73N-xwxMvgxnWwFMp33PQD1Dy-T-ATjANlwtPRHPQM,3016
|
6
6
|
oh_my_batch/cli.py,sha256=G_JxqX0Zbx_EbcDxXbYjJ_4O-EOhmkF1lcMWgQ5ZPqo,375
|
7
7
|
oh_my_batch/combo.py,sha256=AHFD5CLoczqtjcfl2Rb4A2ucoQU40-cWtDOYjtP-yY4,7680
|
8
|
-
oh_my_batch/job.py,sha256=
|
8
|
+
oh_my_batch/job.py,sha256=_fETBYpuSd_hNHKnXSwYcSU3OXtU7PO-P2QMfhE-Wfs,5788
|
9
9
|
oh_my_batch/util.py,sha256=H8B4zVNH5xRp-NG_uypgvtmz2YSpXy_6LK5ROv6SYrc,2116
|
10
|
-
oh_my_batch-0.1.0.
|
11
|
-
oh_my_batch-0.1.0.
|
12
|
-
oh_my_batch-0.1.0.
|
13
|
-
oh_my_batch-0.1.0.
|
14
|
-
oh_my_batch-0.1.0.
|
10
|
+
oh_my_batch-0.1.0.dev2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
11
|
+
oh_my_batch-0.1.0.dev2.dist-info/METADATA,sha256=Novvp5-MhKR9J0Q6Al833vA6GjT7EVRtDv4ADmnluxk,4456
|
12
|
+
oh_my_batch-0.1.0.dev2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
13
|
+
oh_my_batch-0.1.0.dev2.dist-info/entry_points.txt,sha256=ZY2GutSoNjjSyJ4qO2pTeseKUFgoTYdvmgkuZZkwi68,77
|
14
|
+
oh_my_batch-0.1.0.dev2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|