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 ...@@ -14,7 +14,6 @@ import logging
import sys import sys
from Cobalt import client_utils from Cobalt import client_utils
from Cobalt.client_utils import cb_debug from Cobalt.client_utils import cb_debug
from Cobalt.arg_parser import ArgParse from Cobalt.arg_parser import ArgParse
__revision__ = '$Revision: 559 $' # TBC may go away. __revision__ = '$Revision: 559 $' # TBC may go away.
...@@ -34,9 +33,9 @@ def validate_args(parser,user): ...@@ -34,9 +33,9 @@ def validate_args(parser,user):
jobids = client_utils.get_jobids(parser.args[1:]) jobids = client_utils.get_jobids(parser.args[1:])
jobs = [{'tag':'job', 'user':user, 'jobid':jobid, 'project':'*', 'notify':'*', jobs = [{'tag':'job', 'user':user, 'jobid':jobid, 'project':'*', 'notify':'*',
'walltime':'*', 'queue':'*', 'procs':'*', 'nodes':'*'} for jobid in jobids] 'walltime':'*', 'queue':'*', 'procs':'*', 'nodes':'*', 'attrs':'*'} for jobid in jobids]
queue = parser.args[0] queue = parser.args[0]
return queue,jobs return queue, jobs
def main(): def main():
""" """
...@@ -70,9 +69,13 @@ def main(): ...@@ -70,9 +69,13 @@ def main():
# move jobs to queue # move jobs to queue
for job in jobdata: for job in jobdata:
orig_job = job.copy() 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}) job.update({'queue':queue})
client_utils.process_filters(filters,job) client_utils.process_filters(filters, job)
[j] = client_utils.component_call(QUEMGR, False, 'set_jobs', ([orig_job],job,user)) # 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'))) response.append("moved job %d to queue '%s'" % (j.get('jobid'), j.get('queue')))
if not response: 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. 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 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 ...@@ -9,9 +9,9 @@ test_argslist - is a list of dictionaries, each dictionary has all the necessary
""" """
test_argslist = [ test_argslist = [
{ "tc_name" : "invalid_option", "args" : """-k""", 'new_only' : True, }, {"tc_name" : "invalid_option", "args" : """-k""", 'new_only' : True, },
{ "tc_name" : "queue_1", "args" : """myq 1 2 3""", }, {"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_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" : "queue_3", "args" : """1 2 3 4""", "skip_list" : ['not_bsim'], 'new_only': True, },
{ "tc_name" : "queu_4", "args" : """q1 q2 1 2 3""", }, {"tc_name" : "queue_4", "args" : """q1 q2 1 2 3""", },
] ]
...@@ -60,6 +60,8 @@ moved job 3 to queue 'kebra' ...@@ -60,6 +60,8 @@ moved job 3 to queue 'kebra'
""" """
GET_JOBS GET_JOBS
attrs:*
attrs type: <type 'str'>
jobid:1 jobid:1
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -78,6 +80,8 @@ user:gooduser ...@@ -78,6 +80,8 @@ user:gooduser
user type: <type 'str'> user type: <type 'str'>
walltime:* walltime:*
walltime type: <type 'str'> walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:2 jobid:2
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -96,6 +100,8 @@ user:gooduser ...@@ -96,6 +100,8 @@ user:gooduser
user type: <type 'str'> user type: <type 'str'>
walltime:* walltime:*
walltime type: <type 'str'> walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:3 jobid:3
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -123,6 +129,8 @@ Original Jobs: ...@@ -123,6 +129,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -229,6 +237,8 @@ Original Jobs: ...@@ -229,6 +237,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -335,6 +345,8 @@ Original Jobs: ...@@ -335,6 +345,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -475,30 +487,30 @@ qmove.py -d myq 1 2 3 ...@@ -475,30 +487,30 @@ qmove.py -d myq 1 2 3
component: "queue-manager.get_jobs", defer: False component: "queue-manager.get_jobs", defer: False
get_jobs( 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 component: "queue-manager.set_jobs", defer: False
set_jobs( 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', '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', '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', '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, gooduser,
) )
component: "queue-manager.set_jobs", defer: False component: "queue-manager.set_jobs", defer: False
set_jobs( 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', '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', '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', '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, gooduser,
) )
component: "queue-manager.set_jobs", defer: False component: "queue-manager.set_jobs", defer: False
set_jobs( 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', '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', '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', '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, gooduser,
) )
...@@ -509,6 +521,8 @@ component: "queue-manager.set_jobs", defer: False ...@@ -509,6 +521,8 @@ component: "queue-manager.set_jobs", defer: False
""" """
GET_JOBS GET_JOBS
attrs:*
attrs type: <type 'str'>
jobid:1 jobid:1
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -527,6 +541,8 @@ user:gooduser ...@@ -527,6 +541,8 @@ user:gooduser
user type: <type 'str'> user type: <type 'str'>
walltime:* walltime:*
walltime type: <type 'str'> walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:2 jobid:2
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -545,6 +561,8 @@ user:gooduser ...@@ -545,6 +561,8 @@ user:gooduser
user type: <type 'str'> user type: <type 'str'>
walltime:* walltime:*
walltime type: <type 'str'> walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:3 jobid:3
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -572,6 +590,8 @@ Original Jobs: ...@@ -572,6 +590,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -678,6 +698,8 @@ Original Jobs: ...@@ -678,6 +698,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -784,6 +806,8 @@ Original Jobs: ...@@ -784,6 +806,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -924,6 +948,8 @@ moved job 4 to queue 'kebra' ...@@ -924,6 +948,8 @@ moved job 4 to queue 'kebra'
""" """
GET_JOBS GET_JOBS
attrs:*
attrs type: <type 'str'>
jobid:2 jobid:2
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -942,6 +968,8 @@ user:gooduser ...@@ -942,6 +968,8 @@ user:gooduser
user type: <type 'str'> user type: <type 'str'>
walltime:* walltime:*
walltime type: <type 'str'> walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:3 jobid:3
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -960,6 +988,8 @@ user:gooduser ...@@ -960,6 +988,8 @@ user:gooduser
user type: <type 'str'> user type: <type 'str'>
walltime:* walltime:*
walltime type: <type 'str'> walltime type: <type 'str'>
attrs:*
attrs type: <type 'str'>
jobid:4 jobid:4
jobid type: <type 'int'> jobid type: <type 'int'>
nodes:* nodes:*
...@@ -987,6 +1017,8 @@ Original Jobs: ...@@ -987,6 +1017,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -1093,6 +1125,8 @@ Original Jobs: ...@@ -1093,6 +1125,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -1199,6 +1233,8 @@ Original Jobs: ...@@ -1199,6 +1233,8 @@ Original Jobs:
user: gooduser user: gooduser
args: args:
args type: <type 'str'> args type: <type 'str'>
attrs:*
attrs type: <type 'str'>
envs:{} envs:{}
envs type: <type 'dict'> envs type: <type 'dict'>
errorpath:/tmp errorpath:/tmp
...@@ -1319,9 +1355,9 @@ walltime type: <type 'str'> ...@@ -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