From 6a86af5b43336f6524060cc49bcc2b86728ce797 Mon Sep 17 00:00:00 2001 From: Ladislav Smola Date: Wed, 18 Mar 2020 10:16:07 +0100 Subject: [PATCH] Use indexed timestamps Use created and finished, which are indexed, to try to fetch all states of jobs. If job is not finished, we might not get the right terminal status, but that should be ok for now. --- awx/main/analytics/collectors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/analytics/collectors.py b/awx/main/analytics/collectors.py index 601ad039b6..922c3b0648 100644 --- a/awx/main/analytics/collectors.py +++ b/awx/main/analytics/collectors.py @@ -277,8 +277,8 @@ def copy_tables(since, full_path): FROM main_unifiedjob JOIN django_content_type ON main_unifiedjob.polymorphic_ctype_id = django_content_type.id LEFT JOIN main_organization ON main_organization.id = main_unifiedjob.organization_id - WHERE main_unifiedjob.modified > {} - AND main_unifiedjob.launch_type != 'sync' + WHERE (main_unifiedjob.created > {0} OR main_unifiedjob.finished > {0}) + AND main_unifiedjob.launch_type != 'sync' ORDER BY main_unifiedjob.id ASC) TO STDOUT WITH CSV HEADER'''.format(since.strftime("'%Y-%m-%d %H:%M:%S'")) _copy_table(table='unified_jobs', query=unified_job_query, path=full_path)