Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
0297ee78
Commit
0297ee78
authored
Aug 23, 2019
by
Markus Scheidgen
Browse files
Added options to admin uploads ls command.
parent
401f05c1
Pipeline
#54231
passed with stages
in 30 minutes and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/cli/admin/uploads.py
View file @
0297ee78
...
...
@@ -77,16 +77,47 @@ def query_uploads(ctx, uploads):
@
uploads
.
command
(
help
=
'List selected uploads'
)
@
click
.
argument
(
'UPLOADS'
,
nargs
=-
1
)
@
click
.
option
(
'-c'
,
'--calculations'
,
is_flag
=
True
,
help
=
'Show details about calculations.'
)
@
click
.
option
(
'--ids'
,
is_flag
=
True
,
help
=
'Only show a list of ids.'
)
@
click
.
option
(
'--json'
,
is_flag
=
True
,
help
=
'Output a JSON array of ids.'
)
@
click
.
pass_context
def
ls
(
ctx
,
uploads
):
def
ls
(
ctx
,
uploads
,
calculations
,
ids
,
json
):
_
,
uploads
=
query_uploads
(
ctx
,
uploads
)
def
row
(
upload
):
row
=
[
upload
.
upload_id
,
upload
.
name
,
upload
.
user_id
,
upload
.
process_status
,
upload
.
tasks_status
,
upload
.
published
]
if
calculations
:
row
+=
[
upload
.
total_calcs
,
upload
.
failed_calcs
,
upload
.
total_calcs
-
upload
.
processed_calcs
]
return
row
headers
=
[
'id'
,
'name'
,
'user'
,
'process'
,
'tasks'
,
'published'
]
if
calculations
:
headers
+=
[
'calcs'
,
'failed'
,
'processing'
]
if
ids
:
for
upload
in
uploads
:
print
(
upload
.
upload_id
)
return
if
json
:
print
(
'[%s]'
%
','
.
join
([
'"%s"'
%
upload
.
upload_id
for
upload
in
uploads
]))
return
print
(
'%d uploads selected, showing no more than first 10'
%
uploads
.
count
())
print
(
tabulate
(
[
[
upload
.
upload_id
,
upload
.
name
,
upload
.
user_id
,
upload
.
process_status
,
upload
.
published
]
for
upload
in
uploads
[:
10
]],
headers
=
[
'id'
,
'name'
,
'user'
,
'status'
,
'published'
]))
[
row
(
upload
)
for
upload
in
uploads
[:
10
]],
headers
=
headers
))
@
uploads
.
command
(
help
=
'Change the owner of the upload and all its calcs.'
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment