Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-cli
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-cli
Commits
367c4e22
Commit
367c4e22
authored
14 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
add command cancel
parent
0993258c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cccli/command/__init__.py
+1
-0
1 addition, 0 deletions
cccli/command/__init__.py
cccli/command/cancel.py
+34
-0
34 additions, 0 deletions
cccli/command/cancel.py
with
35 additions
and
0 deletions
cccli/command/__init__.py
+
1
−
0
View file @
367c4e22
...
...
@@ -14,6 +14,7 @@ from cccli.command.tag import *
from
cccli.command.vm
import
*
# by command module
from
cccli.command.cancel
import
Command_cancel
from
cccli.command.execute
import
Command_execute
from
cccli.command.expert
import
Command_expert
from
cccli.command.jobs
import
Command_jobs
...
...
This diff is collapsed.
Click to expand it.
cccli/command/cancel.py
0 → 100644
+
34
−
0
View file @
367c4e22
#!/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
OptionCommand
class
Command_cancel
(
OptionCommand
):
'''
Cancel a job
'''
def
__init__
(
self
,
cli
,
argv0
):
OptionCommand
.
__init__
(
self
,
cli
,
argv0
)
self
.
set_usage
(
"
%prog [options] <job_id> ...
"
)
def
__call__
(
self
,
argv
):
# Parse argline
self
.
parse_args
(
argv
)
# append current login if nothing asked
if
len
(
self
.
args
)
==
0
:
raise
cmdBadArgument
()
# ask server
for
jid
in
self
.
args
:
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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment