Skip to content
Snippets Groups Projects
Commit 6947c791 authored by Duncan Mortimer's avatar Duncan Mortimer
Browse files

Prevent duplicate warnings

Output CommentedMap starting at queues:
parent 57dd598a
No related branches found
No related tags found
No related merge requests found
......@@ -1105,6 +1105,11 @@ def _minutes_to_seconds(minutes):
return minutes * 60
def _add_warning(warnings, warning):
if warning not in warnings:
warnings.append(warning)
def build_queue_defs():
'''Return YAML suitable for configuring queues'''
logger = _get_logger()
......@@ -1116,7 +1121,9 @@ def build_queue_defs():
except BadSubmission as e:
logger.error('Unable to query Grid Engine: ' + str(e))
return ('', [])
queues = CommentedMap()
q_base = CommentedMap()
q_base['queues'] = CommentedMap()
queues = q_base['queues']
for q in queue_list:
qinfo = _get_queue_info(q)
if 'BATCH' not in qinfo['qtype']:
......@@ -1128,7 +1135,8 @@ def build_queue_defs():
warnings = []
for coproc_m in ('gpu', 'cuda', 'phi', ):
if coproc_m in q:
warnings.append(
_add_warning(
warnings,
"Quene name looks like it might be a queue supporting co-processors."
" Cannot auto-configure."
)
......@@ -1155,7 +1163,8 @@ def build_queue_defs():
qd['max_size'] = int(queue_ram_map[q][0])
add_comment("Maximum RAM size of a job", 'max_size', column=0)
if queue_ram_map[q][1]:
warnings.append(
_add_warning(
warnings,
"Queue has hosts of different total memory size, consider creating multiple queues"
" for the different host hardware in Grid Engine and then set the same 'group' integer"
" to allow fsl_sub to maximise hardware your job can run on. Alternatively consider turning"
......@@ -1176,7 +1185,8 @@ def build_queue_defs():
unique_vmem = list(set(q_vmem))
if len(unique_vmem) > 0:
warnings.append(
_add_warning(
warnings,
"Queue has hosts of different per-slot memory size, consider creating multiple"
" queues for the different host hardware in Grid Engine and then add these queues "
" to the configuration setting the same 'group' integer in the configuration to "
......@@ -1189,7 +1199,8 @@ def build_queue_defs():
unique_rss = list(set(q_rss))
if len(unique_rss) > 0:
if not warnings:
warnings.append(
_add_warning(
warnings,
"Queue has hosts of different per-slot memory size, consider creating multiple"
" queues for the different host hardware in Grid Engine and then add these queues "
" to the configuration setting the same 'group' integer in the configuration to "
......@@ -1200,11 +1211,13 @@ def build_queue_defs():
qd['slot_size'] = human_to_ram(unique_rss[0], output=ram_units)
else:
qd['slot_size'] = int(qd['max_size']) // queue_ram_map[q][2]
warnings.append(
_add_warning(
warnings,
"Queue has no h_vmem or h_rss specified, "
"slot_size calculated with max_size divided by slots.")
if queue_ram_map[q][3]:
warnings.append(
_add_warning(
warnings,
"Queue has multiple slot sizes "
"- this calculation will not be correct for all hosts."
)
......@@ -1218,4 +1231,4 @@ def build_queue_defs():
for w in warnings:
queues.yaml_set_comment_before_after_key(qinfo['qname'], after=w)
return queues
return q_base
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment