Skip to content
GitLab
Explore
Sign in
Register
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
17bfd4b8
Commit
17bfd4b8
authored
3 years ago
by
Mario Raciti
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-610
: Update data_ingested_per_site_and_type info
parent
cd6dd8a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!634
WIP: COBALT commissioning delta
,
!492
Resolve TMSS-610
,
!481
Draft: SW-971 SW-973 SW-975: Various fixes to build LOFAR correctly.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
+21
-9
21 additions, 9 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
with
21 additions
and
9 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
+
21
−
9
View file @
17bfd4b8
...
@@ -156,16 +156,26 @@ def _get_data_ingested_per_site_and_type(request: Request, cycle: models.Cycle)
...
@@ -156,16 +156,26 @@ def _get_data_ingested_per_site_and_type(request: Request, cycle: models.Cycle)
"""
"""
result
=
[]
result
=
[]
# Get DataProducts related to the cycle
# Get DataProducts related to the cycle with an ArchiveInfo
dataproducts
=
models
.
Dataproduct
.
objects
.
filter
(
producer__subtask__task_blueprints__draft__scheduling_unit_draft__scheduling_set__project__cycles
=
cycle
.
pk
)
archive_info
=
models
.
DataproductArchiveInfo
.
objects
.
filter
(
dataproduct__producer__subtask__task_blueprints__draft__scheduling_unit_draft__scheduling_set__project__cycles
=
cycle
.
pk
)
dataproducts
=
[
ai
.
dataproduct
for
ai
in
archive_info
]
# Filter DataProducts from Subtasks of type 'observation'
dp_from_observations
=
dataproducts
.
filter
(
producer__subtask__specifications_template__type
=
'
observation
'
)
# Filter DataProducts from Subtasks of type 'pipeline'
dp_from_pipelines
=
dataproducts
.
filter
(
producer__subtask__specifications_template__type
=
'
pipeline
'
)
# TODO: Filter categories basing on DataType, TaskType, DataFormat.
# Filter DataProducts of type 'visibilities' and 'time series' from observations and pipelines
dp_visibilities
=
dp_from_observations
.
filter
(
datatype
=
'
visibilities
'
)
|
dp_from_pipelines
.
filter
(
datatype
=
'
visibilities
'
)
dp_time_series
=
dp_from_observations
.
filter
(
datatype
=
'
time series
'
)
|
dp_from_pipelines
.
filter
(
datatype
=
'
time series
'
)
# TODO: Group dataproducts also per site.
# TODO: Group dataproducts also per site.
# Iterate over
typ
es
# Iterate over
categori
es
datatypes
=
[
c
for
c
in
models
.
Datatype
.
Choices
]
# categories = ('', '', '', '')
for
dt
in
datatypes
:
#
for dt in datatypes:
dataproducts_per_type
=
dataproducts
.
filter
(
datatype
=
dt
.
value
)
#
dataproducts_per_type = dataproducts.filter(datatype=dt.value)
dataproducts_per_type_data
=
[
serializers
.
DataproductSerializer
(
dp
,
context
=
{
'
request
'
:
request
}).
data
for
dp
in
dataproducts_per_type
]
#
dataproducts_per_type_data = [serializers.DataproductSerializer(dp, context={'request': request}).data for dp in dataproducts_per_type]
result
.
append
({
'
type
'
:
dt
.
value
,
'
dataproducts
'
:
dataproducts_per_type_data
})
#
result.append({'type': dt.value, 'dataproducts': dataproducts_per_type_data})
return
result
return
result
...
@@ -190,8 +200,10 @@ def _get_usage_mode(cycle: models.Cycle) -> []:
...
@@ -190,8 +200,10 @@ def _get_usage_mode(cycle: models.Cycle) -> []:
"""
"""
result
=
[]
result
=
[]
# Get all the reservations related to the cycle
# Get all the reservations related to the
projects in the
cycle
reservations
=
models
.
Reservation
.
objects
.
filter
(
project__cycles
=
cycle
.
pk
)
reservations
=
models
.
Reservation
.
objects
.
filter
(
project__cycles
=
cycle
.
pk
)
# # Get all the reservations in stand-alone mode
# reservations_sa_mode = models.Reservation.objects.filter(specifications_doc__activity__type='stand-alone mode')
# Get the first Monday before the cycle.start
# Get the first Monday before the cycle.start
start
,
stop
=
cycle
.
start
-
timedelta
(
days
=
cycle
.
start
.
weekday
()),
cycle
.
stop
start
,
stop
=
cycle
.
start
-
timedelta
(
days
=
cycle
.
start
.
weekday
()),
cycle
.
stop
...
...
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