oh-my-batch 0.4.7__py3-none-any.whl → 0.4.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.
oh_my_batch/job.py CHANGED
@@ -94,6 +94,25 @@ class BaseJobManager:
94
94
  error = True
95
95
  if error:
96
96
  raise RuntimeError('Some jobs failed')
97
+
98
+ def wait(self, *job_ids, timeout=None, interval=10):
99
+ """
100
+ Wait for jobs to finish
101
+
102
+ :param job_ids: Job ids to wait for
103
+ :param timeout: Timeout in seconds
104
+ :param interval: Interval in seconds for checking job status
105
+ """
106
+ current = time.time()
107
+ while True:
108
+ jobs = [{'id': j, 'state': JobState.NULL} for j in job_ids]
109
+ jobs = self._update_state(jobs)
110
+ if all(JobState.is_terminal(j['state']) for j in jobs):
111
+ break
112
+ if timeout and time.time() - current > timeout:
113
+ logger.error('Timeout, current state: %s', jobs)
114
+ break
115
+ time.sleep(interval)
97
116
 
98
117
  def _update_jobs(self, jobs: List[dict], max_tries: int, submit_opts: str):
99
118
  jobs = self._update_state(jobs)
@@ -135,7 +154,7 @@ class Slurm(BaseJobManager):
135
154
  logger.error('Failed to query job status: %s', log_cp(cp))
136
155
  return jobs
137
156
  out = cp.stdout.decode('utf-8')
138
- logger.info('Job status:\n%s', out)
157
+ logger.debug('Job status:\n%s', out)
139
158
  new_state = parse_csv(out)
140
159
  else:
141
160
  new_state = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oh-my-batch
3
- Version: 0.4.7
3
+ Version: 0.4.8
4
4
  Summary:
5
5
  License: GPL
6
6
  Author: weihong.xu
@@ -44,16 +44,6 @@ To make the best use of `oh-my-batch`, you need to know some shell tips.
44
44
  * [Run multiple line shell script with ssh](https://stackoverflow.com/a/32082912/3099733)
45
45
 
46
46
  ## Use cases
47
- ### Load functions in shell script
48
- You can load useful functions from `oh-my-batch` this way:
49
-
50
- ```bash
51
- eval "$(omb misc export-shell-func)"
52
- # or
53
- omb misc export-shell-func > omb-func.sh && source omb-func.sh
54
- ```
55
-
56
- This will load extra functions to your shell script, for example, `checkpoint`.
57
47
 
58
48
  ### Generate files from different combinations of parameters
59
49
 
@@ -5,11 +5,11 @@ oh_my_batch/assets/functions.sh,sha256=LaiavZBu84D7C1r-dWhf91vPTuHXCMV1DQZUIPVQn
5
5
  oh_my_batch/batch.py,sha256=o4G7AlaBOUNtwCWfO5bGnPA-iWhhq_iJxpALy1oIYb8,3593
6
6
  oh_my_batch/cli.py,sha256=Jyz8q2pUYke3mfJS6F_G9S9hApddgXxQw1BsN6Kfkjc,553
7
7
  oh_my_batch/combo.py,sha256=A5flYsjugcelj105P6Nq4M3kNGtdqh3c7QaSIL3hUcg,9954
8
- oh_my_batch/job.py,sha256=Foq-xyTj01KaCxZXmfXqTZ8orFL9ZVLix2dqT5w-B3Q,6515
8
+ oh_my_batch/job.py,sha256=8qFYscHGzIQhX-HrAGxCCv7h2T8Ls1Fj0gmNEBdP5Go,7227
9
9
  oh_my_batch/misc.py,sha256=G_iOovRCrShBJJCc82QLN0CvMqW4adOefEoY1GedEiw,452
10
10
  oh_my_batch/util.py,sha256=5ve2QcviuF0UHFLrsXmjMTj0ogXJ4g05q1y-yWCFuOk,2409
11
- oh_my_batch-0.4.7.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
- oh_my_batch-0.4.7.dist-info/METADATA,sha256=IbPGeI3srsM97vpX15osZ-dgb3s3pNLqIxsK9IdikT0,5384
13
- oh_my_batch-0.4.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
14
- oh_my_batch-0.4.7.dist-info/entry_points.txt,sha256=ZY2GutSoNjjSyJ4qO2pTeseKUFgoTYdvmgkuZZkwi68,77
15
- oh_my_batch-0.4.7.dist-info/RECORD,,
11
+ oh_my_batch-0.4.8.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
+ oh_my_batch-0.4.8.dist-info/METADATA,sha256=dXaGpQ8Dx7RgtLfdeuZ84uhLw3ZBw43k1FE2VXpY-og,5091
13
+ oh_my_batch-0.4.8.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
14
+ oh_my_batch-0.4.8.dist-info/entry_points.txt,sha256=ZY2GutSoNjjSyJ4qO2pTeseKUFgoTYdvmgkuZZkwi68,77
15
+ oh_my_batch-0.4.8.dist-info/RECORD,,