Skip to content

Commit

Permalink
Correction to handling "cores per task" resource allocation. (#105)
Browse files Browse the repository at this point in the history
* Docstring corrections.

* Removal of quotes around value.

* Removal of default cores per task from StudyStep.

* Addition of a default for Flux.

* Correction of a bad variable reference.
  • Loading branch information
FrankD412 committed Jun 1, 2018
1 parent 5d83c6c commit 8035e8d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions maestrowf/datastructures/core/executiongraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ def mark_restart(self):
self.status = State.TIMEDOUT
# Designating a restart limit of zero as an unlimited restart setting.
# Otherwise, if we're less than restart limit, attempt another restart.
if self._restart_limit == 0 or \
self._num_restarts < self._restart_limit:
if self.restart_limit == 0 or \
self._num_restarts < self.restart_limit:
self._num_restarts += 1
return True
else:
Expand Down
8 changes: 4 additions & 4 deletions maestrowf/datastructures/core/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self):
"nodes": "",
"procs": "",
"gpus": "",
"cores per task": 1,
"cores per task": "",
"walltime": "",
"reservation": ""
}
Expand Down Expand Up @@ -216,7 +216,7 @@ def output_path(self):

def add_step(self, step):
"""
Helper method for adding steps to a Study instance.
Add a step to a study.
For this helper to be most effective, it recommended to apply steps in
the order that they will be encountered. The method attempts to be
Expand Down Expand Up @@ -263,7 +263,7 @@ def walk_study(self, src=SOURCE):
def setup(self, submission_attempts=1, restart_limit=1, throttle=0,
use_tmp=False):
"""
Method for executing initial setup of a Study.
Perform initial setup of a study.
The method is used for going through and actually acquiring each
dependency, substituting variables, sources and labels. Also sets up
Expand Down Expand Up @@ -673,7 +673,7 @@ def _setup_linear(self):

def stage(self):
"""
Method that produces the expanded DAG representing the Study.
Generate the execution graph for a Study.
Staging creates an ExecutionGraph based on the combinations generated
by the ParameterGeneration object stored in an instance of a Study.
Expand Down
2 changes: 1 addition & 1 deletion maestrowf/datastructures/yamlspecification.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self):
@classmethod
def load_specification(cls, path):
"""
Method for loading a study specification.
Load a study specification.
:param path: Path to a study specification.
:returns: A specification object containing the information from path.
Expand Down
3 changes: 2 additions & 1 deletion maestrowf/interfaces/script/fluxscriptadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,12 @@ def submit(self, step, path, cwd, job_map=None, env=None):
# return SubmissionCode.ERROR, -1

walltime = self._convert_walltime_to_seconds(step.run["walltime"])
cores_per_task = step.run.get("cores per task", 1)
jobspec = {
"nnodes": step.run["nodes"],
# NOTE: interface doesn"t allow multiple here yet
"ntasks": step.run["nodes"],
"ncores": step.run["cores per task"] * step.run["procs"],
"ncores": cores_per_task * step.run["procs"],
"gpus": step.run.get("gpus", 0),
"environ": get_environment(), # TODO: revisit
"options": {"stdio-delay-commit": 1},
Expand Down
2 changes: 1 addition & 1 deletion maestrowf/interfaces/script/slurmscriptadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def get_parallelize_command(self, procs, nodes=None, **kwargs):
if value:
args += [
self._cmd_flags[key],
"\"{}\"".format(str(value))
"{}".format(str(value))
]

return " ".join(args)
Expand Down

0 comments on commit 8035e8d

Please sign in to comment.