resubmit 0.0.4__py3-none-any.whl → 0.0.6__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
@@ -5,27 +5,6 @@ from itertools import product
5
5
  import logging
6
6
 
7
7
 
8
- def _is_regex_spec(val: Any) -> bool:
9
- """Return True if val looks like a regex specifier.
10
-
11
- Accepted forms:
12
- - compiled `re.Pattern`
13
- - tuple (`re.Pattern`, exclude: bool)
14
- - dict with keys `pattern` (re.Pattern) and optional `exclude` (bool)
15
- - string starting with 're:' (e.g. 're:^foo.*') meaning include matches
16
- - string starting with '!re:' meaning exclude matches
17
- """
18
- if hasattr(val, "search") and callable(val.search):
19
- return True
20
- if isinstance(val, tuple) and len(val) >= 1 and hasattr(val[0], "search"):
21
- return True
22
- if isinstance(val, dict) and "pattern" in val:
23
- return True
24
- if isinstance(val, str) and (val.startswith("re:") or val.startswith("!re:")):
25
- return True
26
- return False
27
-
28
-
29
8
  def _normalize_regex_spec(val: Any) -> Tuple[re.Pattern, bool]:
30
9
  """Return (compiled_pattern, exclude_flag) for a given regex spec.
31
10
 
@@ -115,11 +94,6 @@ def create_jobs_dataframe(params: Dict[str, Any]) -> pd.DataFrame:
115
94
  base = k[: -len("_unique")]
116
95
  unique_items[base] = v
117
96
  continue
118
- elif callable(v):
119
- callables[k] = v
120
- elif _is_regex_spec(v):
121
- # treat a regex spec provided under the same key as a filter for that column
122
- regex_specs[k] = v
123
97
  else:
124
98
  static_items[k] = v
125
99
 
@@ -206,7 +180,7 @@ def submit_jobs(
206
180
 
207
181
  jobs_df = create_jobs_dataframe(jobs_args)
208
182
  records = jobs_df.to_dict(orient="records")
209
- from .__submit import submit_jobs as _submit_jobs
183
+ from .__submit import _submit_jobs
210
184
 
211
185
  return _submit_jobs(
212
186
  records,
resubmit/__submit.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from typing import Any, Callable, Iterable, List, Optional, Dict
4
4
 
5
5
 
6
- def submit_jobs(
6
+ def _submit_jobs(
7
7
  jobs_args: Iterable[dict],
8
8
  func: Callable[[List[dict]], Any],
9
9
  *,
@@ -15,6 +15,7 @@ def submit_jobs(
15
15
  block: bool,
16
16
  prompt: bool,
17
17
  local_run: bool,
18
+ job_name: Optional[str] = "resubmit",
18
19
  slurm_additional_parameters: Optional[Dict] = None,
19
20
  ):
20
21
  """Submit jobs described by `jobs_args` where each entry is a dict of kwargs for `func`.
@@ -48,18 +49,13 @@ def submit_jobs(
48
49
  print("submitting jobs")
49
50
  executor = submitit.AutoExecutor(folder=folder)
50
51
 
51
- # default slurm params (keep cluster-specific options out unless explicitly set)
52
- if slurm_additional_parameters is None:
53
- slurm_additional_parameters = {"gpus": num_gpus}
54
- else:
55
- slurm_additional_parameters = dict(slurm_additional_parameters)
56
- slurm_additional_parameters.setdefault("gpus", num_gpus)
57
-
58
52
  print("Slurm additional parameters:", slurm_additional_parameters)
59
53
 
60
54
  executor.update_parameters(
55
+ name=job_name,
61
56
  timeout_min=timeout_min,
62
57
  cpus_per_task=cpus_per_task,
58
+ gpus_per_node=num_gpus,
63
59
  mem_gb=mem_gb,
64
60
  slurm_additional_parameters=slurm_additional_parameters,
65
61
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: resubmit
3
- Version: 0.0.4
3
+ Version: 0.0.6
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=VX2cCD82nibVM4Tf7peeqylyUXRVwH7ZWLGj1CcfzRU,7219
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.6.dist-info/licenses/LICENSE,sha256=v2spsd7N1pKFFh2G8wGP_45iwe5S0DYiJzG4im8Rupc,1066
6
+ resubmit-0.0.6.dist-info/METADATA,sha256=nYs7CVd-qHcAAYdxFQ85LR_g-HMCwSZ49J66HfO2PLY,2976
7
+ resubmit-0.0.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
8
+ resubmit-0.0.6.dist-info/top_level.txt,sha256=BfCexfX-VhUZuNi8sI88i0HF_e3ppausQ76hxPeXjYc,9
9
+ resubmit-0.0.6.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- resubmit/__bookkeeping.py,sha256=FhC9WamX907uyZh7idk-1hfDvX025LOPskUE0KSKypc,8210
2
- resubmit/__debug.py,sha256=8RINyz7eSAiT47d018wR0R3B_u4PllQJCiLy0zTSQDE,887
3
- resubmit/__init__.py,sha256=FLKq6KZeI973gBXzdnSkvK1aEdxF--5V2T82fxyzv0U,219
4
- resubmit/__submit.py,sha256=w3-1_SbB5u9xPpuOUxEvwvH7GXMLWlke_gb4S7RjCRQ,2385
5
- resubmit-0.0.4.dist-info/licenses/LICENSE,sha256=v2spsd7N1pKFFh2G8wGP_45iwe5S0DYiJzG4im8Rupc,1066
6
- resubmit-0.0.4.dist-info/METADATA,sha256=kJ07kk1jUq6zAe3btefCSNFqf9Mvp3ZszzoDYtvA-_E,2976
7
- resubmit-0.0.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
8
- resubmit-0.0.4.dist-info/top_level.txt,sha256=BfCexfX-VhUZuNi8sI88i0HF_e3ppausQ76hxPeXjYc,9
9
- resubmit-0.0.4.dist-info/RECORD,,