hpcflow-new2 0.2.0a157__py3-none-any.whl → 0.2.0a158__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.
hpcflow/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.0a157"
1
+ __version__ = "0.2.0a158"
@@ -307,10 +307,14 @@ class ElementResources(JSONLike):
307
307
 
308
308
  # "direct_posix" scheduler is valid on Windows if using WSL:
309
309
  cfg_lookup = f"{self.scheduler}_posix" if "wsl" in self.shell else self.scheduler
310
- cfg_sched = self.app.config.schedulers.get(cfg_lookup, {})
310
+ cfg_sched = copy.deepcopy(self.app.config.schedulers.get(cfg_lookup, {}))
311
311
 
312
312
  # merge defaults scheduler args from config:
313
- self.scheduler_args = {**cfg_sched.get("defaults", {}), **self.scheduler_args}
313
+ cfg_defs = cfg_sched.get("defaults", {})
314
+ cfg_opts = cfg_defs.pop("options", {})
315
+ opts = {**cfg_opts, **self.scheduler_args.get("options", {})}
316
+ self.scheduler_args["options"] = opts
317
+ self.scheduler_args = {**cfg_defs, **self.scheduler_args}
314
318
 
315
319
  def validate_against_machine(self):
316
320
  """Validate the values for `os_name`, `shell` and `scheduler` against those
@@ -16,7 +16,7 @@ class NullScheduler:
16
16
  ):
17
17
  self.shebang_args = shebang_args or self.DEFAULT_SHEBANG_ARGS
18
18
  self.shell_args = shell_args or self.DEFAULT_SHELL_ARGS
19
- self.options = options or []
19
+ self.options = options or {}
20
20
 
21
21
  @property
22
22
  def unique_properties(self):
@@ -163,7 +163,16 @@ class SGEPosix(Scheduler):
163
163
  opts.append(self.format_array_request(num_elements))
164
164
 
165
165
  opts.extend(self.format_std_stream_file_option_lines(is_array, sub_idx))
166
- opts.extend([f"{self.js_cmd} {opt}" for opt in self.options])
166
+
167
+ for opt_k, opt_v in self.options.items():
168
+ if isinstance(opt_v, list):
169
+ for i in opt_v:
170
+ opts.append(f"{self.js_cmd} {opt_k} {i}")
171
+ elif opt_v:
172
+ opts.append(f"{self.js_cmd} {opt_k} {opt_v}")
173
+ elif opt_v is None:
174
+ opts.append(f"{self.js_cmd} {opt_k}")
175
+
167
176
  return "\n".join(opts) + "\n"
168
177
 
169
178
  def get_version_info(self):
@@ -348,7 +348,16 @@ class SlurmPosix(Scheduler):
348
348
  opts.append(self.format_array_request(num_elements, resources))
349
349
 
350
350
  opts.extend(self.format_std_stream_file_option_lines(is_array, sub_idx))
351
- opts.extend([f"{self.js_cmd} {opt}" for opt in self.options])
351
+
352
+ for opt_k, opt_v in self.options.items():
353
+ if isinstance(opt_v, list):
354
+ for i in opt_v:
355
+ opts.append(f"{self.js_cmd} {opt_k} {i}")
356
+ elif opt_v:
357
+ opts.append(f"{self.js_cmd} {opt_k} {opt_v}")
358
+ elif opt_v is None:
359
+ opts.append(f"{self.js_cmd} {opt_k}")
360
+
352
361
  return "\n".join(opts) + "\n"
353
362
 
354
363
  def get_version_info(self):
@@ -516,3 +516,28 @@ def test_unique_schedulers_two_direct_and_SLURM(new_null_config, tmp_path):
516
516
  scheds = sub.get_unique_schedulers()
517
517
 
518
518
  assert len(scheds) == 2
519
+
520
+
521
+ def test_scheduler_config_defaults(new_null_config, tmp_path):
522
+ """Check default options defined in the config are merged into jobscript resources."""
523
+ hf.config.set("schedulers.direct.defaults.options", {"a": "c"})
524
+
525
+ t1 = hf.Task(
526
+ schema=hf.task_schemas.test_t1_ps,
527
+ inputs={"p1": 1},
528
+ resources={"any": {"scheduler": "direct"}},
529
+ )
530
+ t2 = hf.Task(
531
+ schema=hf.task_schemas.test_t1_ps,
532
+ inputs={"p1": 1},
533
+ resources={
534
+ "any": {"scheduler": "direct", "scheduler_args": {"options": {"a": "b"}}}
535
+ },
536
+ )
537
+ wkt = hf.WorkflowTemplate(name="temp", tasks=[t1, t2])
538
+ wk = hf.Workflow.from_template(
539
+ template=wkt,
540
+ )
541
+ sub = wk.add_submission()
542
+ assert sub.jobscripts[0].resources.scheduler_args == {"options": {"a": "c"}}
543
+ assert sub.jobscripts[1].resources.scheduler_args == {"options": {"a": "b"}}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hpcflow-new2
3
- Version: 0.2.0a157
3
+ Version: 0.2.0a158
4
4
  Summary: Computational workflow management
5
5
  License: MIT
6
6
  Author: aplowman
@@ -1,7 +1,7 @@
1
1
  hpcflow/__init__.py,sha256=WIETuRHeOp2SqUqHUzpjQ-lk9acbYv-6aWOhZPRdlhs,64
2
2
  hpcflow/__pyinstaller/__init__.py,sha256=YOzBlPSck6slucv6lJM9K80JtsJWxXRL00cv6tRj3oc,98
3
3
  hpcflow/__pyinstaller/hook-hpcflow.py,sha256=SeMopsPkhCyd9gqIrzwFNRj3ZlkUlUYl-74QYz61mo4,1089
4
- hpcflow/_version.py,sha256=3A1lqInyVzzYwV66mjif-BdT030UEBJiy9U5kCvivCc,26
4
+ hpcflow/_version.py,sha256=r8ptXPZcFJexuxp2d9u747EhQ1a07r3A3SkNJOWkTjw,26
5
5
  hpcflow/app.py,sha256=GQsMq_sjjXxMLLiIPF1ZvyapW_7IgsxALCCwMiqmC8I,1520
6
6
  hpcflow/cli.py,sha256=G2J3D9v6MnMWOWMMWK6UEKLn_6wnV9lT_qygEBBxg-I,66
7
7
  hpcflow/data/demo_data_manifest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -47,7 +47,7 @@ hpcflow/sdk/core/__init__.py,sha256=GcIklEsXy3M5PWpmxyhd2KoI0u6HjXRIjD_aR1bgRjo,
47
47
  hpcflow/sdk/core/actions.py,sha256=ad8oQlLL_wxXnurao0ABLLKm0yA4lHyoBwR06PAk8Jg,74184
48
48
  hpcflow/sdk/core/command_files.py,sha256=oEW6g6f_cQFmRAgP1DTWPZPhufXcRi56yJZWaS8fU28,18161
49
49
  hpcflow/sdk/core/commands.py,sha256=-Tiu7zVVwWr1xiTXVB9oH3E4g09ebRRtHSRrMdFDCRY,12060
50
- hpcflow/sdk/core/element.py,sha256=nKKvUDP-rLECq-1nP4Fv0OfUA7GKmE3df37ku0ZyKzQ,45408
50
+ hpcflow/sdk/core/element.py,sha256=S7MMXycpQXNbXZ_HyXICM8zMW4RRC32k5SDb9UbXQj8,45614
51
51
  hpcflow/sdk/core/environment.py,sha256=DGUz1NvliKh6opP0IueGHD69rn_8wFLhDsq6kAmEgM4,4849
52
52
  hpcflow/sdk/core/errors.py,sha256=AaJWGyKUuHlAAP2LcVIg7D7aw2noL06G4OzP89sUcxU,8712
53
53
  hpcflow/sdk/core/json_like.py,sha256=LRZsUd1tn8zXC8fESeiXs7Eko-VdnB8zcXiqixKVcZM,18874
@@ -89,10 +89,10 @@ hpcflow/sdk/runtime.py,sha256=-n8OHcbhSVCGGlyWcJvadpsUAIJzzuWVXkZav1RQSio,9555
89
89
  hpcflow/sdk/submission/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
90
90
  hpcflow/sdk/submission/jobscript.py,sha256=XoFiD6qbWOVG30bRtiAfys-erTbv4g6PWGRxSux0kP4,44170
91
91
  hpcflow/sdk/submission/jobscript_info.py,sha256=PsaOENLpp2OUKTQO3wRO64TPOgvzdFh9gfNu56X-uBw,1164
92
- hpcflow/sdk/submission/schedulers/__init__.py,sha256=4DJBmYNXC9GWuQXC3Ank64V6TBURLqtngb_okLuI9GY,2636
92
+ hpcflow/sdk/submission/schedulers/__init__.py,sha256=sLhK3Usr0gMrKMlbwthIwhT3aSSRwciJFDAMrNWLMLk,2636
93
93
  hpcflow/sdk/submission/schedulers/direct.py,sha256=J4naNvWJ_4UfjiXu46cdM4qI19p2mKSGngLaD2wKU3s,5539
94
- hpcflow/sdk/submission/schedulers/sge.py,sha256=k9K8Ai5IIXj8-nZn75jj7a3Hv7bklSLTETbfE4MLvi0,10612
95
- hpcflow/sdk/submission/schedulers/slurm.py,sha256=tN3-92Nh0DjDnEEhWN8iu6eBrA0t8Gs_IfQlR8rYRgw,22116
94
+ hpcflow/sdk/submission/schedulers/sge.py,sha256=ZciDi9YcGcQhGrEZeKMfVaDQEK70Sthz9DNc1XDRqXA,10900
95
+ hpcflow/sdk/submission/schedulers/slurm.py,sha256=epZDlKhtEafFmE4BPRag7UwwyjIcaYmblYfMX7qioWA,22404
96
96
  hpcflow/sdk/submission/schedulers/utils.py,sha256=Ar3DYO6pmS9S-gZWBCsB6afHvgaReqgAaQ719NWGd2U,364
97
97
  hpcflow/sdk/submission/shells/__init__.py,sha256=dN5pg-5OoeTlqOMtK-0N4ZxbLUgzjIm__dnPnKxAA1k,1169
98
98
  hpcflow/sdk/submission/shells/base.py,sha256=AszYb14J7QMHlttRFdM9GJkzf6USERhfWJ10jwppAb8,2302
@@ -136,7 +136,7 @@ hpcflow/tests/unit/test_runtime.py,sha256=HjHPTS3UkX1LcwheFgpp4px_VlRis8KAE2Hoeq
136
136
  hpcflow/tests/unit/test_schema_input.py,sha256=spkTtvNuheh-y29Tsx7YRX6y3dV80vXx0hcg0jVfMp4,12084
137
137
  hpcflow/tests/unit/test_shell.py,sha256=FDtQ9fHRhSKiVtxMJ8BRisoeSvvk8zmJndTB4LlhqGc,3442
138
138
  hpcflow/tests/unit/test_slurm.py,sha256=ewfNuXXUEEelAxcd7MBbAQ-RCvU8xBenHTAyfXYF-R0,1064
139
- hpcflow/tests/unit/test_submission.py,sha256=E8ku48TeCpAQlYDci30D-hf0YvzbT3jpm-emAaS02Is,15764
139
+ hpcflow/tests/unit/test_submission.py,sha256=fPemvWs7rMelKW_2ctEUUjnckGQFXgDzlFRYVY19eJs,16659
140
140
  hpcflow/tests/unit/test_task.py,sha256=94TwyjlhKMRRXTQjys2a1PiK7A-rCzhnvrkk4vRz39I,70000
141
141
  hpcflow/tests/unit/test_task_schema.py,sha256=7a7o42gQhrZPMXfH0a6sGzFCJnuFrbDEl9u3u_bFsgw,3624
142
142
  hpcflow/tests/unit/test_utils.py,sha256=aWfhGDJWGlBfk7yi0hcrPlcd159MX0V0MwsndureeP8,13466
@@ -146,7 +146,7 @@ hpcflow/tests/unit/test_workflow_template.py,sha256=EItRqUyXpU2z_z1rvpRqa848YOkX
146
146
  hpcflow/tests/workflows/test_jobscript.py,sha256=9sp1o0g72JZbv2QlOl5v7wCZEFjotxiIKGNUxVaFgaA,724
147
147
  hpcflow/tests/workflows/test_workflows.py,sha256=xai6FRtGqG4lStJk6KmsqPUSuvqs9FrsBOxMVALshIs,13400
148
148
  hpcflow/viz_demo.ipynb,sha256=1QdnVsk72vihv2L6hOGyk318uEa22ZSgGxQCa7hW2oo,6238
149
- hpcflow_new2-0.2.0a157.dist-info/METADATA,sha256=baUKpho4GBFRJc0aY9gZyQ69IKVC4vkbazI6ehsnMbY,2516
150
- hpcflow_new2-0.2.0a157.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
151
- hpcflow_new2-0.2.0a157.dist-info/entry_points.txt,sha256=aoGtCnFdfPcXfBdu2zZyMOJoz6fPgdR0elqsgrE-USU,106
152
- hpcflow_new2-0.2.0a157.dist-info/RECORD,,
149
+ hpcflow_new2-0.2.0a158.dist-info/METADATA,sha256=wxcx45hPRHvCWTzK0ngk9acWCwIuSkheHwf0A3VEcBI,2516
150
+ hpcflow_new2-0.2.0a158.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
151
+ hpcflow_new2-0.2.0a158.dist-info/entry_points.txt,sha256=aoGtCnFdfPcXfBdu2zZyMOJoz6fPgdR0elqsgrE-USU,106
152
+ hpcflow_new2-0.2.0a158.dist-info/RECORD,,