Skip to content

Commit

Permalink
Enhance shell batch setting to apply to scheduler scripts. (#183)
Browse files Browse the repository at this point in the history
* Extension of shebang feature to allow users to specify shells.

* Addition of debug message to print kwargs.

* Addition of kwargs.

* Addition of basic batch settings to LULESH sample.

* Addition of kwargs to Flux adapters.

* Docstring tweaks.

* Docstring update.
  • Loading branch information
Francesco Di Natale authored and FrankD412 committed May 28, 2022
1 parent 36baee1 commit af02c7d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion maestrowf/abstracts/interfaces/scriptadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def submit(self, step, path, cwd, job_map=None, env=None):
@abstractmethod
def key(self):
"""
The key to be used in workflow specification to describe the adapter.
Return the key name for a ScriptAdapter..
This is used to register the adapter in the ScriptAdapterFactory
and when writing the workflow specification.
Expand Down
3 changes: 1 addition & 2 deletions maestrowf/interfaces/script/fluxscriptadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def __init__(self, **kwargs):
:param **kwargs: A dictionary with default settings for the adapter.
"""
super(FluxScriptAdapter, self).__init__()
super(FluxScriptAdapter, self).__init__(**kwargs)

# NOTE: These libraries are compiled at runtime when an allocation
# is spun up.
Expand All @@ -513,7 +513,6 @@ def __init__(self, **kwargs):
self.add_batch_parameter("nodes", kwargs.pop("nodes", "1"))
self._addl_args = kwargs.get("args", [])

self._exec = "#!/bin/bash"
# Header is only for informational purposes.
self._header = {
"nodes": "#INFO (nodes) {nodes}",
Expand Down
5 changes: 2 additions & 3 deletions maestrowf/interfaces/script/localscriptadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ def __init__(self, **kwargs):
:param **kwargs: A dictionary with default settings for the adapter.
"""
super(LocalScriptAdapter, self).__init__()

self._exec = kwargs.pop("shell", "/bin/bash")
LOGGER.debug("kwargs\n--------------------------\n%s", kwargs)
super(LocalScriptAdapter, self).__init__(**kwargs)

def _write_script(self, ws_path, step):
"""
Expand Down
13 changes: 5 additions & 8 deletions maestrowf/maestro.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,11 @@ def run_study(args):
# If performing a dry run, drive sleep time down to generate scripts.
sleeptime = 1
else:
# else, use args to decide sleeptime
sleeptime = args.sleeptime

batch = {"type": "local"}
if spec.batch:
batch = spec.batch
if "type" not in batch:
batch["type"] = "local"
if "type" not in spec.batch:
spec.batch["type"] = "local"

exec_dag.set_adapter(spec.batch)

# Copy the spec to the output directory
shutil.copy(args.specification, study.output_path)

Expand Down
3 changes: 3 additions & 0 deletions samples/lulesh/lulesh_sample1_macosx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ env:
url: https://github.com/LLNL/LULESH.git
tag: 2.0.3

batch:
shell: /bin/bash

study:
- name: make-lulesh
description: Build the serial version of LULESH.
Expand Down

0 comments on commit af02c7d

Please sign in to comment.