Merge lp:~pwlars/lava-scheduler-tool/resubmit-command into lp:lava-scheduler-tool

Proposed by Paul Larson
Status: Merged
Merged at revision: 18
Proposed branch: lp:~pwlars/lava-scheduler-tool/resubmit-command
Merge into: lp:lava-scheduler-tool
Diff against target: 45 lines (+21/-0)
2 files modified
lava_scheduler_tool/commands.py (+19/-0)
setup.py (+2/-0)
To merge this branch: bzr merge lp:~pwlars/lava-scheduler-tool/resubmit-command
Reviewer Review Type Date Requested Status
Paul Larson (community) Needs Resubmitting
Review via email: mp+100727@code.launchpad.net

Description of the change

*sigh* it helps if you remember to commit the branch before running lp-propose... anyway, here it is for real this time

Here's the lava-scheduler-tool command to go with the resubmit api. I haven't actually tried this yet, but seems straightforward enough.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

20 + job_id = server.scheduler.submit_job(self.args.JOB_ID)

I guess you wanted resubmit_job() here.

PS: since this depends on server api bump we should also wrap this with some checks for missing method error.

17. By Paul Larson

s/submit/resubmit

Revision history for this message
Paul Larson (pwlars) wrote :

> 20 + job_id = server.scheduler.submit_job(self.args.JOB_ID)
>
> I guess you wanted resubmit_job() here.
oops, typo :)

>
> PS: since this depends on server api bump we should also wrap this with some
> checks for missing method error.
This should already be caught in the try/except block and result in:
ERROR: <Fault -32601: "No such method: u'scheduler.resubmit_job'">

Tested this locally, seems to work.

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_scheduler_tool/commands.py'
2--- lava_scheduler_tool/commands.py 2012-04-04 03:58:51 +0000
3+++ lava_scheduler_tool/commands.py 2012-05-09 05:40:24 +0000
4@@ -57,6 +57,25 @@
5 print "submitted as job id:", job_id
6
7
8+class resubmit_job(ExperimentalCommandMixIn, Command):
9+
10+ @classmethod
11+ def register_arguments(self, parser):
12+ parser.add_argument("SERVER")
13+ parser.add_argument("JOB_ID", type=int)
14+
15+ def invoke(self):
16+ self.print_experimental_notice()
17+ server = AuthenticatingServerProxy(
18+ self.args.SERVER, auth_backend=KeyringAuthBackend())
19+ try:
20+ job_id = server.scheduler.resubmit_job(self.args.JOB_ID)
21+ except xmlrpclib.Fault, e:
22+ raise CommandError(str(e))
23+ else:
24+ print "resubmitted as job id:", job_id
25+
26+
27 class cancel_job(ExperimentalCommandMixIn, Command):
28
29 @classmethod
30
31=== modified file 'setup.py'
32--- setup.py 2012-03-22 18:16:16 +0000
33+++ setup.py 2012-05-09 05:40:24 +0000
34@@ -36,9 +36,11 @@
35 scheduler = lava_scheduler_tool.commands:scheduler
36 [lava.scheduler.commands]
37 submit-job = lava_scheduler_tool.commands:submit_job
38+ resubmit-job = lava_scheduler_tool.commands:resubmit_job
39 cancel-job = lava_scheduler_tool.commands:cancel_job
40 [lava_tool.commands]
41 submit-job = lava_scheduler_tool.commands:submit_job
42+ resubmit-job = lava_scheduler_tool.commands:resubmit_job
43 cancel-job = lava_scheduler_tool.commands:cancel_job
44 """,
45 classifiers=[

Subscribers

People subscribed via source and target branches