Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AIG-public
Cobalt
Commits
909f37aa
Commit
909f37aa
authored
Aug 24, 2016
by
Paul Rich
Browse files
Double-added locaitons now avoids duplicating nids in node_id_list
Thanks Eric! Duplicated nids are now avoided.
parent
1dd9fe62
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/Components/system/CraySystem.py
View file @
909f37aa
...
...
@@ -682,7 +682,7 @@ class CraySystem(BaseSystem):
unavailable_nodes
=
[]
forbidden
=
set
([
str
(
loc
)
for
loc
in
self
.
chain_loc_list
(
job
.
get
(
'forbidden'
,
[]))])
required
=
set
([
str
(
loc
)
for
loc
in
self
.
chain_loc_list
(
job
.
get
(
'required'
,
[]))])
requested_locations
=
[
str
(
n
)
for
n
in
expand_num_list
(
job
[
'attrs'
].
get
(
'location'
,
''
))]
requested_locations
=
set
(
[
str
(
n
)
for
n
in
expand_num_list
(
job
[
'attrs'
].
get
(
'location'
,
''
))]
)
requested_loc_in_forbidden
=
False
for
loc
in
requested_locations
:
if
loc
in
forbidden
:
...
...
@@ -695,13 +695,13 @@ class CraySystem(BaseSystem):
node_id_list
=
list
(
required
-
forbidden
)
else
:
node_id_list
=
list
(
set
(
self
.
nodes_by_queue
[
job
[
'queue'
]])
-
forbidden
)
if
requested_locations
!=
[]:
# handle attrs location= requests
if
requested_locations
!=
set
(
[]
)
:
# handle attrs location= requests
job_set
=
set
([
str
(
nid
)
for
nid
in
requested_locations
])
if
not
job
[
'queue'
]
in
self
.
nodes_by_queue
.
keys
():
#we're in a reservation and need to further restrict nodes.
if
job_set
<=
set
(
node_id_list
):
# We are in a reservation there are no forbidden nodes.
node_id_list
=
requested_locations
node_id_list
=
list
(
requested_locations
)
else
:
# We can't run this job. Insufficent resources in this
# reservation to do so. Don't risk blocking anything.
...
...
@@ -711,7 +711,7 @@ class CraySystem(BaseSystem):
#normal queues. Restrict to the non-reserved nodes.
if
job_set
<=
set
([
str
(
node_id
)
for
node_id
in
self
.
nodes_by_queue
[
job
[
'queue'
]]]):
node_id_list
=
requested_locations
node_id_list
=
list
(
requested_locations
)
if
not
set
(
node_id_list
).
isdisjoint
(
forbidden
):
# this job has requested locations that are a part of an
# active reservation. Remove locaitons and drop available
...
...
testsuite/TestCobalt/TestComponents/test_cray.py
View file @
909f37aa
...
...
@@ -160,6 +160,14 @@ class TestCraySystem(object):
assert
nodecount
==
1
,
'Wrong nodecount'
assert
nodelist
==
[
'3'
],
'Wrong node in list %s'
%
nodelist
def
test_assemble_queue_data_attrs_location_repeats
(
self
):
'''CraySystem._assemble_queue_data: eliminate repeat location entries'''
self
.
base_job
[
'attrs'
]
=
{
'location'
:
'1,1,2,3'
}
nodecount
,
nodelist
=
self
.
system
.
_assemble_queue_data
(
self
.
base_job
,
self
.
system
.
_idle_nodes_by_queue
())
assert
nodecount
==
3
,
'Wrong nodecount got %s expected 3'
%
nodecount
assert
sorted
(
nodelist
)
==
[
'1'
,
'2'
,
'3'
],
'Wrong node in list %s'
%
nodelist
@
raises
(
ValueError
)
def
test_assemble_queue_data_attrs_bad_location
(
self
):
'''CraySystem._assemble_queue_data: raise error for location completely outside of
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment