Skip to content

Commit 12e349a

Browse files
authored
Merge pull request #504 from ExaWorks/ci_add_multi_node_queue
Adds a `multi_node_queue_name` ci config option
2 parents 9ff496b + 0fea445 commit 12e349a

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

testing.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ executors = auto
115115
queue_name =
116116

117117

118+
#
119+
# If a different queue is used for multi-node jobs, specify it here. If empty,
120+
# queue_name is used for both single-node and multi-node jobs.
121+
#
122+
123+
multi_node_queue_name =
124+
125+
118126
#
119127
# If you need a project/account for billing purposes, enter it here.
120128
#

tests/_test_tools.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from executor_test_params import ExecutorTestParams
1010

11-
from psij import JobStatus, JobState, Job, JobExecutor, JobAttributes
11+
from psij import JobStatus, JobState, Job, JobExecutor, JobAttributes, ResourceSpecV1
1212

1313
_QUICK_EXECUTORS = set(['local', 'batch-test'])
1414

@@ -51,11 +51,16 @@ def _get_executor_instance(ep: ExecutorTestParams, job: Optional[Job] = None) ->
5151
if job is not None:
5252
assert job.spec is not None
5353
job.spec.launcher = ep.launcher
54-
job.spec.attributes = JobAttributes(custom_attributes=ep.custom_attributes)
54+
attrs = JobAttributes(custom_attributes=ep.custom_attributes)
55+
job.spec.attributes = attrs
5556
if ep.account is not None:
56-
job.spec.attributes.account = ep.account
57+
attrs.account = ep.account
58+
res = job.spec.resources
5759
if ep.queue_name is not None:
58-
job.spec.attributes.queue_name = ep.queue_name
60+
attrs.queue_name = ep.queue_name
61+
if (res and isinstance(res, ResourceSpecV1) and res.computed_node_count > 1
62+
and ep.multi_node_queue_name is not None):
63+
attrs.queue_name = ep.multi_node_queue_name
5964
return JobExecutor.get_instance(ep.executor, url=ep.url)
6065

6166

tests/ci_runner.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ def run_branch_tests(conf: Dict[str, str], dir: Path, run_id: str, clone: bool =
147147
args.append('--branch-name-override')
148148
args.append(fake_branch_name)
149149
for opt in ['maintainer_email', 'executors', 'server_url', 'key', 'max_age',
150-
'custom_attributes', 'queue_name', 'project_name', 'account']:
150+
'custom_attributes', 'queue_name', 'multi_node_queue_name',
151+
'project_name', 'account']:
151152
try:
152153
val = get_conf(conf, opt)
153-
args.append('--' + opt.replace('_', '-'))
154-
args.append(val)
154+
if val != '':
155+
args.append('--' + opt.replace('_', '-'))
156+
args.append(val)
155157
except KeyError:
156158
# sometimes options get added; when they do, they could prevent
157159
# old test cycles from working, if their configs don't contain

tests/executor_test_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class ExecutorTestParams:
66
"""A class holding executor, launcher, url pairs."""
77

88
def __init__(self, spec: str, queue_name: Optional[str] = None,
9+
multi_node_queue_name: Optional[str] = None,
910
account: Optional[str] = None,
1011
custom_attributes_raw: Optional[Dict[str, Dict[str, object]]] = None) \
1112
-> None:
@@ -19,6 +20,9 @@ def __init__(self, spec: str, queue_name: Optional[str] = None,
1920
url are specified, the string should be formatted as "<executor>::<url>".
2021
queue_name
2122
An optional queue to submit the job to
23+
multi_node_queue_name
24+
An optional multi-node queue name used for multi-node jobs. If not specified,
25+
`queue_name` is used for both single and multi-node jobs.
2226
account
2327
An optional account to use for billing purposes.
2428
custom_attributes
@@ -35,6 +39,10 @@ def __init__(self, spec: str, queue_name: Optional[str] = None,
3539
self.url = None
3640

3741
self.queue_name = queue_name
42+
if multi_node_queue_name is None:
43+
self.multi_node_queue_name = queue_name
44+
else:
45+
self.multi_node_queue_name = multi_node_queue_name
3846
self.account = account
3947
self.custom_attributes_raw = custom_attributes_raw
4048
self.custom_attributes: Dict[str, object] = {}

0 commit comments

Comments
 (0)