Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fractalis
fractalis
Commits
0c69e7ed
Commit
0c69e7ed
authored
Jul 23, 2018
by
Sascha Herzinger
Browse files
#9
parent
81793868
Pipeline
#5890
passed with stages
in 37 minutes and 37 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fractalis/data/controller.py
View file @
0c69e7ed
...
...
@@ -3,6 +3,7 @@
import
json
import
logging
from
typing
import
Tuple
,
Union
from
uuid
import
UUID
from
flask
import
Blueprint
,
session
,
request
,
jsonify
,
Response
...
...
@@ -93,8 +94,8 @@ def get_all_data() -> Tuple[Response, int]:
return
jsonify
({
'data_states'
:
data_states
}),
200
@
data_blueprint
.
route
(
'/<
string
:task_id>'
,
methods
=
[
'DELETE'
])
def
delete_data
(
task_id
:
str
)
->
Tuple
[
Response
,
int
]:
@
data_blueprint
.
route
(
'/<
uuid
:task_id>'
,
methods
=
[
'DELETE'
])
def
delete_data
(
task_id
:
UUID
)
->
Tuple
[
Response
,
int
]:
"""Remove all traces of the data associated with the given task id.
:param task_id: The id associated with the data
See doc/api/ for more information.
...
...
@@ -102,6 +103,7 @@ def delete_data(task_id: str) -> Tuple[Response, int]:
"""
logger
.
debug
(
"Received DELETE request on /data/task_id."
)
wait
=
request
.
args
.
get
(
'wait'
)
==
'1'
task_id
=
str
(
task_id
)
if
task_id
not
in
session
[
'data_tasks'
]:
error
=
"Task ID '{}' not found in session. "
\
"Refusing access."
.
format
(
task_id
)
...
...
@@ -133,13 +135,14 @@ def delete_all_data() -> Tuple[Response, int]:
return
jsonify
(
''
),
200
@
data_blueprint
.
route
(
'/meta/<
string
:task_id>'
,
methods
=
[
'GET'
])
def
get_meta_information
(
task_id
:
str
)
->
Tuple
[
Response
,
int
]:
@
data_blueprint
.
route
(
'/meta/<
uuid
:task_id>'
,
methods
=
[
'GET'
])
def
get_meta_information
(
task_id
:
UUID
)
->
Tuple
[
Response
,
int
]:
"""Get meta information for given task id.
:return: meta information object stored in redis.
"""
logger
.
debug
(
"Received GET request on /data/meta/task_id."
)
wait
=
request
.
args
.
get
(
'wait'
)
==
'1'
task_id
=
str
(
task_id
)
if
task_id
not
in
session
[
'data_tasks'
]:
error
=
"Task ID '{}' not found in session. "
\
"Refusing access."
.
format
(
task_id
)
...
...
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