Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
atdb-ldv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
ASTRON SDC
atdb-ldv
Commits
08f73d1f
Commit
08f73d1f
authored
3 years ago
by
Roy de Goei
Browse files
Options
Downloads
Patches
Plain Diff
SDC-470: Do not filter on status and skip when no timestamp
parent
19aeaa8a
No related branches found
Branches containing commit
No related tags found
2 merge requests
!170
Master
,
!168
SDC-470: Do not filter on status and skip when no timestamp
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
atdb/taskdatabase/services/algorithms.py
+20
-17
20 additions, 17 deletions
atdb/taskdatabase/services/algorithms.py
with
20 additions
and
17 deletions
atdb/taskdatabase/services/algorithms.py
+
20
−
17
View file @
08f73d1f
...
@@ -44,30 +44,33 @@ def get_size(status_list, type):
...
@@ -44,30 +44,33 @@ def get_size(status_list, type):
@timeit
@timeit
def
get_min_start_and_max_end_time
(
sas_id
):
def
get_min_start_and_max_end_time
(
sas_id
):
"""
"""
Retrieve the minimum start time en maximum end time of a set of taskids (sas_id) which has the
Retrieve the minimum start time en maximum end time of a set of taskids (sas_id)
status
'
archived
'
or
'
finished
'
The start time is the moment when the task start
'
processing
'
The start time is the moment when the task start
'
processing
'
The end time is the moment when the task was
'
processed
'
The end time is the moment when the task was
'
processed
'
"""
"""
min_start_time
=
None
min_start_time
=
None
max_end_time
=
None
max_end_time
=
None
logger
.
info
(
"
get_min_start_and_max_end_time(
"
+
str
(
sas_id
)
+
"
)
"
)
logger
.
info
(
"
get_min_start_and_max_end_time(
"
+
str
(
sas_id
)
+
"
)
"
)
tasks
=
Task
.
objects
.
filter
(
sas_id
=
sas_id
)
.
filter
(
Q
(
status
=
'
archived
'
)
|
Q
(
status
=
'
finished
'
))
tasks
=
Task
.
objects
.
filter
(
sas_id
=
sas_id
)
for
task
in
tasks
:
for
task
in
tasks
:
# If more entrees are found for 'processing' task, get the latest
try
:
latest_start_time
=
LogEntry
.
objects
.
filter
(
task
=
task
.
pk
).
filter
(
step_name
=
'
running
'
).
filter
(
status
=
'
processing
'
).
latest
(
'
timestamp
'
)
# If more entrees are found for 'processing' task, get the latest
start_time
=
latest_start_time
.
timestamp
latest_start_time
=
LogEntry
.
objects
.
filter
(
task
=
task
.
pk
).
filter
(
step_name
=
'
running
'
).
filter
(
status
=
'
processing
'
).
latest
(
'
timestamp
'
)
# If more entrees are found for 'processed' task, get the latest
start_time
=
latest_start_time
.
timestamp
lastest_end_time
=
LogEntry
.
objects
.
filter
(
task
=
task
.
pk
).
filter
(
step_name
=
'
running
'
).
filter
(
status
=
'
processed
'
).
latest
(
'
timestamp
'
)
# If more entrees are found for 'processed' task, get the latest
end_time
=
lastest_end_time
.
timestamp
lastest_end_time
=
LogEntry
.
objects
.
filter
(
task
=
task
.
pk
).
filter
(
step_name
=
'
running
'
).
filter
(
status
=
'
processed
'
).
latest
(
'
timestamp
'
)
if
min_start_time
is
None
:
end_time
=
lastest_end_time
.
timestamp
min_start_time
=
start_time
if
min_start_time
is
None
:
elif
start_time
<
min_start_time
:
min_start_time
=
start_time
min_start_time
=
start_time
elif
start_time
<
min_start_time
:
if
max_end_time
is
None
:
min_start_time
=
start_time
max_end_time
=
end_time
if
max_end_time
is
None
:
elif
end_time
>
max_end_time
:
max_end_time
=
end_time
max_end_time
=
end_time
elif
end_time
>
max_end_time
:
max_end_time
=
end_time
except
:
pass
# having no timestamp, just skip
return
min_start_time
,
max_end_time
return
min_start_time
,
max_end_time
...
...
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