Commit 3fccd335 authored by Paul Rich's avatar Paul Rich
Browse files

Merge branch '94-fix-attrs-str' into 'develop'

Resolve "Attrs being set to string on qmove"

Closes #94

See merge request !51
parents 25d148c2 cf951441
......@@ -14,7 +14,6 @@ import logging
import sys
from Cobalt import client_utils
from Cobalt.client_utils import cb_debug
from Cobalt.arg_parser import ArgParse
__revision__ = '$Revision: 559 $' # TBC may go away.
......@@ -34,9 +33,9 @@ def validate_args(parser,user):
jobids = client_utils.get_jobids(parser.args[1:])
jobs = [{'tag':'job', 'user':user, 'jobid':jobid, 'project':'*', 'notify':'*',
'walltime':'*', 'queue':'*', 'procs':'*', 'nodes':'*'} for jobid in jobids]
queue = parser.args[0]
return queue,jobs
'walltime':'*', 'queue':'*', 'procs':'*', 'nodes':'*', 'attrs':'*'} for jobid in jobids]
queue = parser.args[0]
return queue, jobs
def main():
"""
......@@ -70,9 +69,13 @@ def main():
# move jobs to queue
for job in jobdata:
orig_job = job.copy()
# keep orig job's attrs. If this gets reset (which the filter can do) this will cause the find for the set operation to
# fail. '*' will grab any here.
orig_job['attrs'] = '*'
job.update({'queue':queue})
client_utils.process_filters(filters,job)
[j] = client_utils.component_call(QUEMGR, False, 'set_jobs', ([orig_job],job,user))
client_utils.process_filters(filters, job)
# FIXME: Need a better aggregate operation, this really should be one remote call.
[j] = client_utils.component_call(QUEMGR, False, 'set_jobs', ([orig_job], job, user))
response.append("moved job %d to queue '%s'" % (j.get('jobid'), j.get('queue')))
if not response:
......
"""
This module defines the test argument information list for qmove.py and will
This module defines the test argument information list for qmove.py and will
dynamically be imported by testutils.py to generate the tests for qmove.py.
Refer to the TESTUTILS_README.txt for more information about the usage of this module and testutils.py
......@@ -9,9 +9,9 @@ test_argslist - is a list of dictionaries, each dictionary has all the necessary
"""
test_argslist = [
{ "tc_name" : "invalid_option", "args" : """-k""", 'new_only' : True, },
{ "tc_name" : "queue_1", "args" : """myq 1 2 3""", },
{ "tc_name" : "queue_2", "args" : """-d myq 1 2 3""", "new_only" : True, },
{ "tc_name" : "queue_3", "args" : """1 2 3 4""", "skip_list" : ['not_bsim'], },
{ "tc_name" : "queu_4", "args" : """q1 q2 1 2 3""", },
{"tc_name" : "invalid_option", "args" : """-k""", 'new_only' : True, },
{"tc_name" : "queue_1", "args" : """myq 1 2 3""", 'new_only' : True, },
{"tc_name" : "queue_2", "args" : """-d myq 1 2 3""", "new_only" : True, },
{"tc_name" : "queue_3", "args" : """1 2 3 4""", "skip_list" : ['not_bsim'], 'new_only': True, },
{"tc_name" : "queue_4", "args" : """q1 q2 1 2 3""", },
]
......@@ -60,6 +60,8 @@ moved job 3 to queue 'kebra'
"""
GET_JOBS
attrs:*
attrs type: <type 'str'>
jobid:1
jobid type: <type 'int'>
nodes:*
......@@ -78,6 +80,8 @@ user:gooduser
user type: <type 'str'>
walltime:*
walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:2
jobid type: <type 'int'>
nodes:*
......@@ -96,6 +100,8 @@ user:gooduser
user type: <type 'str'>
walltime:*
walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:3
jobid type: <type 'int'>
nodes:*
......@@ -123,6 +129,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -229,6 +237,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -335,6 +345,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -475,30 +487,30 @@ qmove.py -d myq 1 2 3
component: "queue-manager.get_jobs", defer: False
get_jobs(
[{'project': '*', 'queue': '*', 'tag': 'job', 'notify': '*', 'user': 'gooduser', 'nodes': '*', 'walltime': '*', 'procs': '*', 'jobid': 1}, {'project': '*', 'queue': '*', 'tag': 'job', 'notify': '*', 'user': 'gooduser', 'nodes': '*', 'walltime': '*', 'procs': '*', 'jobid': 2}, {'project': '*', 'queue': '*', 'tag': 'job', 'notify': '*', 'user': 'gooduser', 'nodes': '*', 'walltime': '*', 'procs': '*', 'jobid': 3}],
[{'project': '*', 'queue': '*', 'tag': 'job', 'notify': '*', 'user': 'gooduser', 'nodes': '*', 'walltime': '*', 'attrs': '*', 'procs': '*', 'jobid': 1}, {'project': '*', 'queue': '*', 'tag': 'job', 'notify': '*', 'user': 'gooduser', 'nodes': '*', 'walltime': '*', 'attrs': '*', 'procs': '*', 'jobid': 2}, {'project': '*', 'queue': '*', 'tag': 'job', 'notify': '*', 'user': 'gooduser', 'nodes': '*', 'walltime': '*', 'attrs': '*', 'procs': '*', 'jobid': 3}],
)
component: "queue-manager.set_jobs", defer: False
set_jobs(
[{'errorpath': '/tmp', 'args': '', 'is_active': False, 'geometry': None, 'mode': 'smp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'procs': '512', 'walltime': '5', 'queue': 'jello', 'envs': {}, 'user_hold': False, 'jobid': 1, 'project': 'my_project', 'submittime': '60', 'state': 'user_hold', 'score': 50, 'location': '/tmp', 'nodes': '512', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy'], 'user': 'land'}],
{'errorpath': '/tmp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'project': 'my_project', 'envs': {}, 'submittime': '60', 'state': 'user_hold', 'score': 50, 'location': '/tmp', 'nodes': '512', 'args': '', 'is_active': False, 'user': 'land', 'procs': '512', 'walltime': '5', 'geometry': None, 'user_hold': False, 'jobid': 1, 'queue': 'myq', 'mode': 'smp', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy']},
[{'errorpath': '/tmp', 'args': '', 'is_active': False, 'geometry': None, 'mode': 'smp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'procs': '512', 'walltime': '5', 'queue': 'jello', 'resid': None, 'envs': {}, 'user_hold': False, 'jobid': 1, 'project': 'my_project', 'submittime': '60', 'state': 'user_hold', 'score': 50, 'location': '/tmp', 'nodes': '512', 'attrs': '*', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy'], 'user': 'land'}],
{'errorpath': '/tmp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'project': 'my_project', 'envs': {}, 'submittime': '60', 'state': 'user_hold', 'score': 50, 'location': '/tmp', 'nodes': '512', 'args': '', 'is_active': False, 'user': 'land', 'procs': '512', 'walltime': '5', 'resid': None, 'geometry': None, 'user_hold': False, 'jobid': 1, 'queue': 'myq', 'mode': 'smp', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy']},
gooduser,
)
component: "queue-manager.set_jobs", defer: False
set_jobs(
[{'errorpath': '/tmp', 'args': '', 'is_active': False, 'geometry': None, 'mode': 'smp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'procs': '1024', 'walltime': '10', 'queue': 'bello', 'envs': {}, 'user_hold': False, 'jobid': 2, 'project': 'my_project', 'submittime': '60', 'state': 'user_hold', 'score': 55, 'location': '/tmp', 'nodes': '1024', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy'], 'user': 'house'}],
{'errorpath': '/tmp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'project': 'my_project', 'envs': {}, 'submittime': '60', 'state': 'user_hold', 'score': 55, 'location': '/tmp', 'nodes': '1024', 'args': '', 'is_active': False, 'user': 'house', 'procs': '1024', 'walltime': '10', 'geometry': None, 'user_hold': False, 'jobid': 2, 'queue': 'myq', 'mode': 'smp', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy']},
[{'errorpath': '/tmp', 'args': '', 'is_active': False, 'geometry': None, 'mode': 'smp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'procs': '1024', 'walltime': '10', 'queue': 'bello', 'resid': None, 'envs': {}, 'user_hold': False, 'jobid': 2, 'project': 'my_project', 'submittime': '60', 'state': 'user_hold', 'score': 55, 'location': '/tmp', 'nodes': '1024', 'attrs': '*', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy'], 'user': 'house'}],
{'errorpath': '/tmp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'project': 'my_project', 'envs': {}, 'submittime': '60', 'state': 'user_hold', 'score': 55, 'location': '/tmp', 'nodes': '1024', 'args': '', 'is_active': False, 'user': 'house', 'procs': '1024', 'walltime': '10', 'resid': None, 'geometry': None, 'user_hold': False, 'jobid': 2, 'queue': 'myq', 'mode': 'smp', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy']},
gooduser,
)
component: "queue-manager.set_jobs", defer: False
set_jobs(
[{'errorpath': '/tmp', 'args': '', 'is_active': False, 'geometry': None, 'mode': 'smp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'procs': '1536', 'walltime': '15', 'queue': 'aaa', 'envs': {}, 'user_hold': False, 'jobid': 3, 'project': 'my_project', 'submittime': '60', 'state': 'user_hold', 'score': 40, 'location': '/tmp', 'nodes': '1536', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy'], 'user': 'dog'}],
{'errorpath': '/tmp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'project': 'my_project', 'envs': {}, 'submittime': '60', 'state': 'user_hold', 'score': 40, 'location': '/tmp', 'nodes': '1536', 'args': '', 'is_active': False, 'user': 'dog', 'procs': '1536', 'walltime': '15', 'geometry': None, 'user_hold': False, 'jobid': 3, 'queue': 'myq', 'mode': 'smp', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy']},
[{'errorpath': '/tmp', 'args': '', 'is_active': False, 'geometry': None, 'mode': 'smp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'procs': '1536', 'walltime': '15', 'queue': 'aaa', 'resid': None, 'envs': {}, 'user_hold': False, 'jobid': 3, 'project': 'my_project', 'submittime': '60', 'state': 'user_hold', 'score': 40, 'location': '/tmp', 'nodes': '1536', 'attrs': '*', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy'], 'user': 'dog'}],
{'errorpath': '/tmp', 'outputpath': '/tmp', 'tag': 'job', 'notify': 'myemail@gmail.com', 'has_completed': False, 'project': 'my_project', 'envs': {}, 'submittime': '60', 'state': 'user_hold', 'score': 40, 'location': '/tmp', 'nodes': '1536', 'args': '', 'is_active': False, 'user': 'dog', 'procs': '1536', 'walltime': '15', 'resid': None, 'geometry': None, 'user_hold': False, 'jobid': 3, 'queue': 'myq', 'mode': 'smp', 'user_list': ['james', 'land', 'house', 'dog', 'cat', 'henry', 'king', 'queen', 'girl', 'boy']},
gooduser,
)
......@@ -509,6 +521,8 @@ component: "queue-manager.set_jobs", defer: False
"""
GET_JOBS
attrs:*
attrs type: <type 'str'>
jobid:1
jobid type: <type 'int'>
nodes:*
......@@ -527,6 +541,8 @@ user:gooduser
user type: <type 'str'>
walltime:*
walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:2
jobid type: <type 'int'>
nodes:*
......@@ -545,6 +561,8 @@ user:gooduser
user type: <type 'str'>
walltime:*
walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:3
jobid type: <type 'int'>
nodes:*
......@@ -572,6 +590,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -678,6 +698,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -784,6 +806,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -924,6 +948,8 @@ moved job 4 to queue 'kebra'
"""
GET_JOBS
attrs:*
attrs type: <type 'str'>
jobid:2
jobid type: <type 'int'>
nodes:*
......@@ -942,6 +968,8 @@ user:gooduser
user type: <type 'str'>
walltime:*
walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:3
jobid type: <type 'int'>
nodes:*
......@@ -960,6 +988,8 @@ user:gooduser
user type: <type 'str'>
walltime:*
walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:4
jobid type: <type 'int'>
nodes:*
......@@ -987,6 +1017,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -1093,6 +1125,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -1199,6 +1233,8 @@ Original Jobs:
user: gooduser
args:
args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{}
envs type: <type 'dict'>
errorpath:/tmp
......@@ -1319,9 +1355,9 @@ walltime type: <type 'str'>
# ---------------------------------------------------------------------------------
def test_qmove_queu_4():
def test_qmove_queue_4():
"""
qmove test run: queu_4
qmove test run: queue_4
"""
......
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