Skip to content
Snippets Groups Projects
Commit d92199a3 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

Merge branch 'SDC-470-2' into 'master'

SDC-470: Do not filter on status and skip when no timestamp

See merge request !168
parents 19aeaa8a 08f73d1f
Branches
No related tags found
2 merge requests!170Master,!168SDC-470: Do not filter on status and skip when no timestamp
Pipeline #24204 passed
......@@ -44,16 +44,16 @@ def get_size(status_list, type):
@timeit
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
status 'archived' or 'finished'
Retrieve the minimum start time en maximum end time of a set of taskids (sas_id)
The start time is the moment when the task start 'processing'
The end time is the moment when the task was 'processed'
"""
min_start_time = None
max_end_time = None
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:
try:
# If more entrees are found for 'processing' task, get the latest
latest_start_time = LogEntry.objects.filter(task=task.pk).filter(step_name='running').filter(status='processing').latest('timestamp')
start_time = latest_start_time.timestamp
......@@ -68,6 +68,9 @@ def get_min_start_and_max_end_time(sas_id):
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment