Commit 7a2679a9 authored by Paul Rich's avatar Paul Rich
Browse files

Merge branch '71-update-filter-exclude-queues' into 'develop'

Resolve "Update filter to exclude"

Closes #71

See merge request !35
parents 66811a32 ee700d0a
......@@ -60,6 +60,7 @@ import os
import sys
import signal
import socket
import ast
from Cobalt import client_utils
from Cobalt.client_utils import \
cb_debug, cb_env, cb_nodes, cb_time, cb_umask, cb_path, cb_dep, \
......@@ -591,8 +592,10 @@ def main():
filters = client_utils.get_filters()
client_utils.process_filters(filters, spec)
# Attrs needs special handling filter won't set otherwise
if spec.get('attrs', None) is not None:
opts['attrs'].update(ast.literal_eval(str(spec['attrs'])))
update_spec(parser, opts, spec, opt2spec)
run_job(parser, user, spec, opts)
if __name__ == '__main__':
......
......@@ -2,11 +2,20 @@
import sys
import ast
AVAILABLE_MCDRAM = ['cache', 'hybrid', 'half', 'flat']
AVAILABLE_MCDRAM = ['cache', 'equal', 'split', 'flat']
AVAILABLE_NUMA = ['a2a', 'snc2', 'snc4', 'hemi', 'quad']
PRESET_QUEUES = {'debug-flat-quad': ('flat', 'quad'),
'debug-cache-quad': ('cache', 'quad'),
}
def main():
attrs = {}
mcdram = None
numa = None
queue = None
for arg in sys.argv:
try:
splitarg = arg.split('=')
......@@ -28,9 +37,21 @@ def main():
return 1
else:
pass
attrs = attr_dict
elif key == 'queue':
if val in PRESET_QUEUES.keys():
mcdram = PRESET_QUEUES[val][0]
numa = PRESET_QUEUES[val][1]
queue = val
else:
pass
if mcdram is not None and numa is not None:
attrs['mcdram'] = mcdram
attrs['numa'] = numa
print >> sys.stderr, "Memory mode set to %s %s for queue %s" % (mcdram, numa, queue)
print "attrs=%s" % attrs
return 0
if __name__ == '__main__':
......
......@@ -16,6 +16,7 @@ import json
import logging
import logging.handlers
import os.path
from Cobalt.Util import expand_num_list, compact_num_list
SUCCESS = 0
RESET_FAILURE = 3
......@@ -49,7 +50,7 @@ logger.addHandler(syslog)
ACCOUNTING_LOG_PATH = '/var/log/pbs/boot'
ACCOUNTING_MSG_FMT = "%s;%s;%s;%s" # Date, Type, Jobid, keyvals
ACCOUNTING_DATE_FMT = "%d/%m/%Y %H:%M:%s"
ACCOUNTING_DATE_FMT = "%d/%m/%Y %H:%M:%S"
def dict_to_keyval_str(dct):
'''put a record keyval dict into a string format for pbs logging'''
......@@ -60,56 +61,6 @@ def dict_to_keyval_str(dct):
def expand_num_list(num_list):
'''Take a compact, comma-seperated string of integer values and ranges and
expand to a list of integers that is represented by that string. Ranges of
the form "a-b" will be expanded to the full sequience of integers from a to
b, inclusive.
'''
retlist = []
elems = num_list.split(',')
for elem in elems:
if elem == '':
continue
elif len(elem.split('-')) == 1:
retlist.append(int(elem))
else:
nums = elem.split('-')
low = min(int(nums[0]), int(nums[1]))
high = max(int(nums[0]), int(nums[1])) + 1
retlist.extend(xrange(low, high))
return retlist
def compact_num_list(num_list):
'''Given a list of integers return a compact string representation.
The entries are comma-separated. If a contiguous sequence of integers
exist, they are compacted into the form "a-b" where the range is a to b,
inclusive.
'''
begin = None
end = begin
retcompact = []
working_list = [int(num) for num in num_list]
def append_run(begin, end):
'''convenience function for appending a value to the return list'''
if begin == end:
retcompact.append(str(begin))
else:
retcompact.append("%s-%s" % (begin, end))
for num in sorted(working_list):
if begin is None:
begin = num
end = num
elif end + 1 == num:
end = num
else: #run just ended. Set up for a new run and store current one.
append_run(begin, end)
begin = num
end = num
append_run(begin, end)
return ','.join(retcompact)
def get_current_modes(node_list):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment