Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
File Transfer Service
fts-rest
Commits
02d0b191
Commit
02d0b191
authored
Nov 29, 2018
by
Diego Ciangottini
Browse files
allow bulk status requests from python client
parent
a000125e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/fts3/rest/client/inquirer.py
View file @
02d0b191
...
...
@@ -30,11 +30,35 @@ class Inquirer(object):
self
.
context
=
context
def
get_job_status
(
self
,
job_id
,
list_files
=
False
):
if
not
isinstance
(
job_id
,
str
):
raise
Exception
(
'The job_id provided is not a string!'
)
try
:
job_info
=
json
.
loads
(
self
.
context
.
get
(
"/jobs/%s"
%
job_id
))
if
list_files
:
job_info
[
'files'
]
=
json
.
loads
(
self
.
context
.
get
(
"/jobs/%s/files"
%
job_id
))
job_info
[
'dm'
]
=
json
.
loads
(
self
.
context
.
get
(
"/jobs/%s/dm"
%
job_id
))
return
job_info
except
NotFound
:
raise
NotFound
(
job_id
)
def
get_jobs_statuses
(
self
,
job_ids
,
list_files
=
False
):
if
isinstance
(
job_ids
,
list
):
xfer_ids
=
','
.
join
(
job_ids
)
else
:
raise
Exception
(
'The input provided is not a list of ids!'
)
try
:
if
not
list_files
:
job_info
=
json
.
loads
(
self
.
context
.
get
(
"/jobs/%s"
%
xfer_ids
))
else
:
job_info
=
json
.
loads
(
self
.
context
.
get
(
"/jobs/%s?files=file_state,dest_surl,finish_time,start_time,reason,source_surl,file_metadata"
%
xfer_ids
))
return
job_info
except
NotFound
:
raise
NotFound
(
job_id
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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