resubmit 0.0.7__py3-none-any.whl → 0.0.9__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.
resubmit/__bookkeeping.py CHANGED
@@ -153,6 +153,7 @@ def submit_jobs(
153
153
  block: bool = False,
154
154
  prompt: bool = True,
155
155
  local_run: bool = False,
156
+ debug: bool = False,
156
157
  job_name: Optional[str] = "resubmit",
157
158
  slurm_additional_parameters: Dict | None = None,
158
159
  ) -> Any:
@@ -174,6 +175,8 @@ def submit_jobs(
174
175
  block: Whether to block until jobs complete.
175
176
  prompt: Whether to prompt for confirmation before submission.
176
177
  local_run: If True, runs the function locally instead of submitting.
178
+ debug: If True, it runs only the first job in the queue for debugging.
179
+ job_name: Name of the job.
177
180
  slurm_additional_parameters: Additional Slurm parameters as a dict. If not provided, defaults to {"gpus": num_gpus}.
178
181
  Returns:
179
182
  The result of `submit_jobs` from `.__submit`.
@@ -194,6 +197,7 @@ def submit_jobs(
194
197
  block=block,
195
198
  prompt=prompt,
196
199
  local_run=local_run,
200
+ debug=debug,
197
201
  job_name=job_name,
198
202
  slurm_additional_parameters=slurm_additional_parameters,
199
203
  )
resubmit/__submit.py CHANGED
@@ -15,12 +15,28 @@ def _submit_jobs(
15
15
  block: bool,
16
16
  prompt: bool,
17
17
  local_run: bool,
18
+ debug: bool = False,
18
19
  job_name: Optional[str] = "resubmit",
19
20
  slurm_additional_parameters: Optional[Dict] = None,
20
21
  ):
21
22
  """Submit jobs described by `jobs_args` where each entry is a dict of kwargs for `func`.
22
23
 
23
- - If `local_run` is True, the function is called directly: `func(jobs_args)`.
24
+ Args:
25
+ jobs_args: Iterable of dicts of job parameters.
26
+ func: Function to be submitted for each job.
27
+ timeout_min: Job timeout in minutes.
28
+ cpus_per_task: Number of CPUs per task.
29
+ mem_gb: Memory in GB.
30
+ num_gpus: Number of GPUs.
31
+ folder: Folder for logs.
32
+ block: Whether to block until jobs complete.
33
+ prompt: Whether to prompt for confirmation before submission.
34
+ local_run: If True, runs the function locally instead of submitting.
35
+ debug: If True, runs only the first job in the queue for debugging.
36
+ job_name: Name of the job.
37
+ slurm_additional_parameters: Additional Slurm parameters as a dict. If not provided,
38
+
39
+ - If `local_run` is True, the function is called directly on the local machine: `func(jobs_args[0])`.
24
40
  - Otherwise, submits via submitit.AutoExecutor and returns job objects or, if `block` is True, waits and returns results.
25
41
 
26
42
  Optional Slurm settings `constraint` and `reservation` can be provided via explicit
@@ -30,12 +46,16 @@ def _submit_jobs(
30
46
  """
31
47
  jobs_list = list(jobs_args) if not isinstance(jobs_args, list) else jobs_args
32
48
 
49
+ if debug:
50
+ print("Debug mode: only running the first job locally")
51
+ return func(jobs_list[0])
52
+
33
53
  if len(jobs_list) == 0:
34
54
  print("No jobs to run exiting")
35
55
  return
36
56
 
37
57
  if local_run:
38
- print("Running locally (local_run=True)")
58
+ print("Running the jobs locally (local_run=True)")
39
59
  return func(jobs_list)
40
60
 
41
61
  if prompt:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: resubmit
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: Small wrapper around submitit to simplify cluster submissions
5
5
  Author: Amir Mehrpanah
6
6
  License: MIT
@@ -0,0 +1,9 @@
1
+ resubmit/__bookkeeping.py,sha256=5BurUVe7VHJWnU_rT7e0U04d7hybR6YSYZUbOexk3AM,7448
2
+ resubmit/__debug.py,sha256=8RINyz7eSAiT47d018wR0R3B_u4PllQJCiLy0zTSQDE,887
3
+ resubmit/__init__.py,sha256=FLKq6KZeI973gBXzdnSkvK1aEdxF--5V2T82fxyzv0U,219
4
+ resubmit/__submit.py,sha256=_UR1vrmHK5H2G-R0_nm7G7Xy3RW2R1DXSyrrRZ2081c,3038
5
+ resubmit-0.0.9.dist-info/licenses/LICENSE,sha256=v2spsd7N1pKFFh2G8wGP_45iwe5S0DYiJzG4im8Rupc,1066
6
+ resubmit-0.0.9.dist-info/METADATA,sha256=SFZ6WuiTjgI3uWg2-mXx5j1snX_MzZD14OEQR2OVwOM,2976
7
+ resubmit-0.0.9.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
8
+ resubmit-0.0.9.dist-info/top_level.txt,sha256=BfCexfX-VhUZuNi8sI88i0HF_e3ppausQ76hxPeXjYc,9
9
+ resubmit-0.0.9.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- resubmit/__bookkeeping.py,sha256=6Q6IvstSCQH75WY430AbtOWFHWu9lVDnaJD4RJuCLrA,7288
2
- resubmit/__debug.py,sha256=8RINyz7eSAiT47d018wR0R3B_u4PllQJCiLy0zTSQDE,887
3
- resubmit/__init__.py,sha256=FLKq6KZeI973gBXzdnSkvK1aEdxF--5V2T82fxyzv0U,219
4
- resubmit/__submit.py,sha256=SgtZFb-Yi7zIv9BGVyXgbsjca_s6_kZlA9mBO9ZWGtg,2149
5
- resubmit-0.0.7.dist-info/licenses/LICENSE,sha256=v2spsd7N1pKFFh2G8wGP_45iwe5S0DYiJzG4im8Rupc,1066
6
- resubmit-0.0.7.dist-info/METADATA,sha256=IGWx0_wsZe0s4POwQnhK_SsA2SzEzRZxPNoQNaDNFYk,2976
7
- resubmit-0.0.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
8
- resubmit-0.0.7.dist-info/top_level.txt,sha256=BfCexfX-VhUZuNi8sI88i0HF_e3ppausQ76hxPeXjYc,9
9
- resubmit-0.0.7.dist-info/RECORD,,