Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
5b4c9288
Commit
5b4c9288
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-320
: store archive information for ingest-subtask-output-dataproducts only
parent
b50999a2
No related branches found
No related tags found
2 merge requests
!308
Resolve TMSS-495
,
!306
Resolve TMSS-320
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/TMSS/client/lib/tmss_http_rest_client.py
+1
-1
1 addition, 1 deletion
SAS/TMSS/client/lib/tmss_http_rest_client.py
SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py
+13
-4
13 additions, 4 deletions
SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py
with
14 additions
and
5 deletions
SAS/TMSS/client/lib/tmss_http_rest_client.py
+
1
−
1
View file @
5b4c9288
...
@@ -283,7 +283,7 @@ class TMSSsession(object):
...
@@ -283,7 +283,7 @@ class TMSSsession(object):
if
adler32_checksum
:
if
adler32_checksum
:
json_data
[
'
adler32_checksum
'
]
=
adler32_checksum
json_data
[
'
adler32_checksum
'
]
=
adler32_checksum
response
=
self
.
session
.
post
(
url
=
self
.
get_full_url_for_path
(
'
dataproduct/%s/p
rocess
_archive_information
'
%
(
dataproduct_id
,)),
json
=
json_data
)
response
=
self
.
session
.
post
(
url
=
self
.
get_full_url_for_path
(
'
dataproduct/%s/p
ost
_archive_information
'
%
(
dataproduct_id
,)),
json
=
json_data
)
logger
.
info
(
"
post_dataproduct_archive_information: json_doc: %s response: %s
"
,
json_data
,
response
.
text
)
logger
.
info
(
"
post_dataproduct_archive_information: json_doc: %s response: %s
"
,
json_data
,
response
.
text
)
if
response
.
status_code
==
201
:
if
response
.
status_code
==
201
:
logger
.
info
(
"
created new template: %s
"
,
json
.
loads
(
response
.
text
)[
'
url
'
])
logger
.
info
(
"
created new template: %s
"
,
json
.
loads
(
response
.
text
)[
'
url
'
])
...
...
This diff is collapsed.
Click to expand it.
SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py
+
13
−
4
View file @
5b4c9288
...
@@ -24,6 +24,7 @@ from lofar.common import isProductionEnvironment, isTestEnvironment
...
@@ -24,6 +24,7 @@ from lofar.common import isProductionEnvironment, isTestEnvironment
from
lofar.sas.tmss.tmss.tmssapp.viewsets.lofar_viewset
import
LOFARViewSet
from
lofar.sas.tmss.tmss.tmssapp.viewsets.lofar_viewset
import
LOFARViewSet
from
lofar.sas.tmss.tmss.tmssapp
import
models
from
lofar.sas.tmss.tmss.tmssapp
import
models
from
lofar.sas.tmss.tmss.tmssapp
import
serializers
from
lofar.sas.tmss.tmss.tmssapp
import
serializers
from
lofar.sas.tmss.tmss.exceptions
import
TMSSException
from
datetime
import
datetime
from
datetime
import
datetime
from
lofar.common.json_utils
import
get_default_json_object_for_schema
from
lofar.common.json_utils
import
get_default_json_object_for_schema
...
@@ -360,13 +361,17 @@ class DataproductViewSet(LOFARViewSet):
...
@@ -360,13 +361,17 @@ class DataproductViewSet(LOFARViewSet):
from
lofar.sas.tmss.tmss.tmssapp.adapters.sip
import
generate_sip_for_dataproduct
from
lofar.sas.tmss.tmss.tmssapp.adapters.sip
import
generate_sip_for_dataproduct
return
HttpResponse
(
visualizer
.
visualize_sip
(
generate_sip_for_dataproduct
(
dataproduct
)),
content_type
=
'
image/svg+xml
'
)
return
HttpResponse
(
visualizer
.
visualize_sip
(
generate_sip_for_dataproduct
(
dataproduct
)),
content_type
=
'
image/svg+xml
'
)
@swagger_auto_schema
(
responses
=
{
200
:
'
The
finished version of this subtask
.
'
,
@swagger_auto_schema
(
responses
=
{
200
:
'
The
updated dataproduct
.
'
,
403
:
'
forbidden
'
,
403
:
'
forbidden
'
,
500
:
'
The feedback of this subtask could not be processed
'
},
500
:
'
The feedback of this subtask could not be processed
'
},
operation_description
=
"
Generate feedback_doc of subtask output dataproducts from the subtask raw_feedback and set subtask state to finished
.
"
)
operation_description
=
"
Store the archive information for this dataproduct
.
"
)
@action
(
methods
=
[
'
post
'
],
detail
=
True
,
url_name
=
'
p
rocess
_archive_information
'
)
@action
(
methods
=
[
'
post
'
],
detail
=
True
,
url_name
=
'
p
ost
_archive_information
'
)
def
p
rocess
_archive_information
(
self
,
request
,
pk
=
None
):
def
p
ost
_archive_information
(
self
,
request
,
pk
=
None
):
dataproduct
=
get_object_or_404
(
models
.
Dataproduct
,
pk
=
pk
)
dataproduct
=
get_object_or_404
(
models
.
Dataproduct
,
pk
=
pk
)
if
dataproduct
.
producer
.
subtask
.
specifications_template
.
type
.
value
!=
models
.
SubtaskType
.
Choices
.
INGEST
.
value
:
raise
TMSSException
(
"
Cannot store archive information for dataproduct id=%s because its producing subtask id=%s is of non-ingest type=%s
"
%
(
pk
,
dataproduct
.
producer
.
subtask
.
id
,
dataproduct
.
producer
.
subtask
.
specifications_template
.
type
.
value
))
json_doc
=
json
.
loads
(
request
.
body
.
decode
(
'
utf-8
'
))
json_doc
=
json
.
loads
(
request
.
body
.
decode
(
'
utf-8
'
))
dataproduct
.
size
=
int
(
json_doc
[
'
file_size
'
])
dataproduct
.
size
=
int
(
json_doc
[
'
file_size
'
])
...
@@ -385,6 +390,10 @@ class DataproductViewSet(LOFARViewSet):
...
@@ -385,6 +390,10 @@ class DataproductViewSet(LOFARViewSet):
algorithm
=
models
.
Algorithm
.
objects
.
get
(
value
=
models
.
Algorithm
.
Choices
.
ADLER32
.
value
),
algorithm
=
models
.
Algorithm
.
objects
.
get
(
value
=
models
.
Algorithm
.
Choices
.
ADLER32
.
value
),
hash
=
json_doc
[
'
adler32_checksum
'
])
hash
=
json_doc
[
'
adler32_checksum
'
])
# create empty feedback. Apart from the archive info above, ingest does not create feedback like observations/pipelines do.
dataproduct
.
feedback_template
=
models
.
DataproductFeedbackTemplate
.
objects
.
get
(
name
=
"
empty
"
)
dataproduct
.
feedback_doc
=
get_default_json_object_for_schema
(
dataproduct
.
feedback_template
.
schema
)
dataproduct
.
save
()
dataproduct
.
save
()
serializer
=
self
.
get_serializer
(
dataproduct
)
serializer
=
self
.
get_serializer
(
dataproduct
)
return
RestResponse
(
serializer
.
data
)
return
RestResponse
(
serializer
.
data
)
...
...
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