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
ec37c985
Commit
ec37c985
authored
3 years ago
by
Mario Raciti
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-692
: Update durations representation accordingly to SI units
parent
9b0737ed
No related branches found
No related tags found
1 merge request
!410
Resolve TMSS-692
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
+5
-5
5 additions, 5 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
SAS/TMSS/backend/test/t_adapter.py
+4
-4
4 additions, 4 deletions
SAS/TMSS/backend/test/t_adapter.py
with
9 additions
and
9 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
+
5
−
5
View file @
ec37c985
...
...
@@ -23,16 +23,16 @@ def _get_subs_and_durations_from_project(project_pk: int) -> {}:
# TODO: Use QA workflow flag instead of the finished status? See TMSS-592.
if
sub
.
status
==
'
finished
'
:
# Succeeded observations
total_succeeded_duration
+=
sub
.
duration
subs_succeeded
.
append
({
'
id
'
:
sub
.
pk
,
'
name
'
:
sub
.
name
,
'
duration
'
:
sub
.
duration
})
subs_succeeded
.
append
({
'
id
'
:
sub
.
pk
,
'
name
'
:
sub
.
name
,
'
duration
'
:
sub
.
duration
.
total_seconds
()
})
elif
sub
.
status
==
'
cancelled
'
:
# Failed observations
total_failed_duration
+=
sub
.
duration
subs_failed
.
append
({
'
id
'
:
sub
.
pk
,
'
name
'
:
sub
.
name
,
'
duration
'
:
sub
.
duration
})
subs_failed
.
append
({
'
id
'
:
sub
.
pk
,
'
name
'
:
sub
.
name
,
'
duration
'
:
sub
.
duration
.
total_seconds
()
})
total_duration
+=
sub
.
duration
# Total duration without considering the status of the obs.
total_not_cancelled
=
total_duration
-
total_failed_duration
# Calculate not_cancelled duration
durations
=
{
'
total
'
:
str
(
total_duration
),
'
total_succeeded
'
:
str
(
total_succeeded_duration
),
'
total_
not_cancelled
'
:
str
(
total_not_cancelled
),
'
total_
fai
led
'
:
str
(
total_
failed_duration
),
'
scheduling_unit_blueprints_finished
'
:
subs_succeeded
,
'
scheduling_unit_blueprints_failed
'
:
subs_failed
}
durations
=
{
'
total
'
:
total_duration
.
total_seconds
(
),
'
total_succeeded
'
:
total_succeeded_duration
.
total_
seconds
(
),
'
total_
not_cancel
led
'
:
total_
not_cancelled
.
total_seconds
(),
'
total_failed
'
:
total_failed_duration
.
total_seconds
()
,
'
scheduling_unit_blueprints_finished
'
:
subs_succeeded
,
'
scheduling_unit_blueprints_failed
'
:
subs_failed
}
return
durations
...
...
This diff is collapsed.
Click to expand it.
SAS/TMSS/backend/test/t_adapter.py
+
4
−
4
View file @
ec37c985
...
...
@@ -554,13 +554,13 @@ class ProjectReportTest(unittest.TestCase):
self
.
assertEqual
(
result
[
'
quota
'
][
0
][
'
id
'
],
self
.
project_quota
.
pk
)
# Assert durations are well calculated
total
=
str
(
subtask
.
duration
)
total
=
subtask
.
duration
.
total_seconds
(
)
self
.
assertEqual
(
result
[
'
durations
'
][
'
total
'
],
total
)
total_succeeded
=
str
(
subtask
.
duration
)
total_succeeded
=
subtask
.
duration
.
total_seconds
(
)
self
.
assertEqual
(
result
[
'
durations
'
][
'
total_succeeded
'
],
total_succeeded
)
total_not_cancelled
=
str
(
subtask
.
duration
)
total_not_cancelled
=
subtask
.
duration
.
total_seconds
(
)
self
.
assertEqual
(
result
[
'
durations
'
][
'
total_not_cancelled
'
],
total_not_cancelled
)
total_failed
=
str
(
timedelta
(
seconds
=
0
))
total_failed
=
timedelta
(
seconds
=
0
)
.
total_seconds
(
)
self
.
assertEqual
(
result
[
'
durations
'
][
'
total_failed
'
],
total_failed
)
# There is only this finished SUB
...
...
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