Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions lib/pavilion/schedulers/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class SchedulerPluginAdvanced(SchedulerPlugin, ABC):
"""A scheduler plugin that supports automatic node inventories, and as a
consequence chunking and other advanced features."""

KICKOFF_DELAY_SECS = 3

def __init__(self, name, description, priority=SchedulerPlugin.PRIO_COMMON):
"""Initialize tracking of node info and chunks, in addition to the basics."""

Expand Down Expand Up @@ -545,7 +547,12 @@ def _schedule_shared(self, pav_cfg, tests: List[TestRun], node_range: NodeRange,
# Clear the node range - it's only used for flexible scheduling.
node_range = None

script = self.create_kickoff_script(pav_cfg, tests, job.kickoff_log, nodes=picked_nodes)
script = self.create_kickoff_script(
pav_cfg,
tests,
job.kickoff_log,
nodes=picked_nodes,
delay=self.KICKOFF_DELAY_SECS)
script.write(job.kickoff_path)

# Create symlinks for each test to the one test with the kickoff script and
Expand Down Expand Up @@ -599,7 +606,11 @@ def _schedule_indi_flex(self, pav_cfg, tests: List[TestRun],

node_range = calc_node_range(sched_config, len(chunk))

script = self.create_kickoff_script(pav_cfg, test, job.kickoff_log)
script = self.create_kickoff_script(
pav_cfg,
test,
job.kickoff_log,
delay=self.KICKOFF_DELAY_SECS)
script.write(job.kickoff_path)

test.job = job
Expand Down Expand Up @@ -685,7 +696,12 @@ def _schedule_indi_chunk(self, pav_cfg, tests: List[TestRun],
prior_error=err, tests=[test]))
continue

script = self.create_kickoff_script(pav_cfg, test, job.kickoff_log, nodes=picked_nodes)
script = self.create_kickoff_script(
pav_cfg,
test,
job.kickoff_log,
nodes=picked_nodes,
delay=self.KICKOFF_DELAY_SECS)
script.write(job.kickoff_path)

test.job = job
Expand Down Expand Up @@ -716,6 +732,7 @@ def create_kickoff_script(self,
tests: Union[TestRun, List[TestRun]],
log_path: Optional[Path] = None,
nodes: Optional[NodeSet] = None,
delay: float = 0,
isolate: bool = False) -> ScriptComposer:
"""Create the kickoff script."""

Expand Down Expand Up @@ -758,6 +775,9 @@ def create_kickoff_script(self,

script.newline()

if delay > 0:
script.command(f"sleep {delay}")

if isolate:
script = tests[0].make_script(script, "run", isolate=True)
else:
Expand Down
11 changes: 10 additions & 1 deletion lib/pavilion/schedulers/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SchedulerPluginBasic(SchedulerPlugin, ABC):
# A 'Basic' scheduler is concurrent or not - either all tests can run from the same job
# or they must run from separate jobs.
IS_CONCURRENT = True
KICKOFF_DELAY_SECS = 0

def _get_initial_vars(self, sched_config: dict) -> SchedulerVariables:
"""Get the initial variables for the basic scheduler."""
Expand Down Expand Up @@ -98,7 +99,11 @@ def schedule_tests(self, pav_cfg, tests: List[TestRun]) -> List[SchedulerPluginE
for test in test_bin:
test.job = job

script = self.create_kickoff_script(pav_cfg, test_bin, job.kickoff_log)
script = self.create_kickoff_script(
pav_cfg,
test_bin,
job.kickoff_log,
delay=self.KICKOFF_DELAY_SECS)
script.write(job.kickoff_path)

try:
Expand Down Expand Up @@ -134,6 +139,7 @@ def create_kickoff_script(self,
tests: Union[TestRun, List[TestRun]],
log_path: Optional[Path] = None,
nodes: Optional[NodeSet] = None,
delay: float = 0,
isolate: bool = False) -> ScriptComposer:
"""Create the kickoff script."""

Expand Down Expand Up @@ -172,6 +178,9 @@ def create_kickoff_script(self,

script.newline()

if delay > 0:
script.command(f"sleep {delay}")

if isolate:
script = tests[0].make_script(script, "run", isolate=True)
else:
Expand Down
7 changes: 4 additions & 3 deletions lib/pavilion/schedulers/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ def create_kickoff_script(self,
tests: Union[TestRun, List[TestRun]],
log_path: Optional[Path] = None,
nodes: Optional = None,
delay: float = 0,
isolate: bool = False) -> ScriptComposer:
"""Create the kickoff script."""

Expand All @@ -444,9 +445,9 @@ def _create_kickoff_script_stub(self,
job_name: str,
sched_config: dict,
log_path: Optional[Path] = None,
nodes: Union[NodeList, None] = None,
node_range: Union[Tuple[int, int], None] = None,
shebang: str = None,
nodes: Optional[NodeList] = None,
node_range: Optional[Tuple[int, int]] = None,
shebang: Optional[str] = None,
isolate: bool = False) -> ScriptComposer:
"""Generate the kickoff script essentials preamble common to all scheduled
tests.
Expand Down
2 changes: 1 addition & 1 deletion test/tests/sched_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def test_shared_kickoff_no_chunking(self):
self.assertEqual(len(test.job.get_test_id_pairs()), 1)

for test in tests:
test.wait(10)
test.wait(15)

for test in tests:
self.assertEqual(test.results['result'], 'PASS')
Expand Down