Loading cccli/commands/cancel.py +8 −16 Original line number Original line Diff line number Diff line Loading @@ -8,30 +8,22 @@ CloudControl cancel command from cccli.exception import * from cccli.exception import * from sjrpc.core.exceptions import * from sjrpc.core.exceptions import * from cccli.printer import Printer, color from cccli.printer import Printer, color from cccli.command import RemoteCommand from cccli.command import TqlCommand class Command_cancel(RemoteCommand): class Command_cancel(TqlCommand): '''Cancel a job''' '''Cancel a job''' def __init__(self, cli, argv0): def __init__(self, cli, argv0): RemoteCommand.__init__(self, cli, argv0) TqlCommand.__init__(self, cli, argv0) self.set_usage("%prog [options] <job_id> ...") self.tql_filter += "&r=job&state=running" def __call__(self, argv): def __call__(self, argv): # Parse argline # arg parse self.parse_args(argv) self.parse_args(argv) # append current login if nothing asked if len(self.args) != 1: if len(self.args) == 0: raise cmdBadArgument() raise cmdBadArgument() # ask server # rpc call for jid in self.args: self.rpccall("cancel", self.args[0]) try: self.cli.rpc.call("cancel", int(jid)) self.printer.out("Job %s: cancelled."%jid) except ValueError: self.printer.error("Invalid job id: %s"%jid) except RpcError as e: self.printer.error("%s"%e) def remote_functions(self): def remote_functions(self): return set(("cancel",)) return set(("cancel",)) Loading
cccli/commands/cancel.py +8 −16 Original line number Original line Diff line number Diff line Loading @@ -8,30 +8,22 @@ CloudControl cancel command from cccli.exception import * from cccli.exception import * from sjrpc.core.exceptions import * from sjrpc.core.exceptions import * from cccli.printer import Printer, color from cccli.printer import Printer, color from cccli.command import RemoteCommand from cccli.command import TqlCommand class Command_cancel(RemoteCommand): class Command_cancel(TqlCommand): '''Cancel a job''' '''Cancel a job''' def __init__(self, cli, argv0): def __init__(self, cli, argv0): RemoteCommand.__init__(self, cli, argv0) TqlCommand.__init__(self, cli, argv0) self.set_usage("%prog [options] <job_id> ...") self.tql_filter += "&r=job&state=running" def __call__(self, argv): def __call__(self, argv): # Parse argline # arg parse self.parse_args(argv) self.parse_args(argv) # append current login if nothing asked if len(self.args) != 1: if len(self.args) == 0: raise cmdBadArgument() raise cmdBadArgument() # ask server # rpc call for jid in self.args: self.rpccall("cancel", self.args[0]) try: self.cli.rpc.call("cancel", int(jid)) self.printer.out("Job %s: cancelled."%jid) except ValueError: self.printer.error("Invalid job id: %s"%jid) except RpcError as e: self.printer.error("%s"%e) def remote_functions(self): def remote_functions(self): return set(("cancel",)) return set(("cancel",))