Skip to content
Snippets Groups Projects
Commit 0993258c authored by Seblu's avatar Seblu
Browse files

Add command jobs

parent c9e1d1b8
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ from cccli.command.vm import *
# by command module
from cccli.command.execute import Command_execute
from cccli.command.expert import Command_expert
from cccli.command.jobs import Command_jobs
from cccli.command.kill import Command_kill
from cccli.command.list import Command_list
from cccli.command.server import Command_server
......
#!/usr/bin/env python
#coding=utf8
'''
CloudControl jobs command
'''
from cccli.exception import *
from sjrpc.core.exceptions import *
from cccli.printer import Printer, color
from cccli.command.command import TqlCommand
class Command_jobs(TqlCommand):
'''List jobs'''
def __init__(self, cli, argv0):
TqlCommand.__init__(self, cli, argv0)
self.set_usage("%prog [options] [tql]")
self.remove_option("--quiet")
self.remove_option("--direct")
self.add_option("-d", "--done", action="store_true", dest="done", default=False,
help="Show done jobs")
self.add_option("-R", "--no-running", action="store_false", dest="running", default=True,
help="Don't show running jobs")
def __call__(self, argv):
# Parse argline
self.parse_args(argv)
# append current login if nothing asked
if len(self.args) == 0:
tql = ""
else:
tql = "".join(self.args)
# ask server
objs = self.rpccall("jobs", tql,
_direct=True,
_status=False,
show_done=self.options.done,
show_running=self.options.running)
self.print_objects(objs, index=self.options.index)
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