From 8f7b72d49ae77e46b2787572017d668a87a3d360 Mon Sep 17 00:00:00 2001 From: Michael Cayanan <42812746+mcayanan@users.noreply.github.com> Date: Mon, 18 Dec 2023 09:10:57 -0800 Subject: [PATCH] HC-503: Fixed an issue where job_iterator could return duplicate results (#59) * HC-503: Set sort in job_iterator so that the result query won't return duplicate results * fix sort statement * bump version * debugging stuff * testing * print statement * add sort back in * remove kludge --------- Co-authored-by: Mike Cayanan --- hysds_commons/__init__.py | 2 +- hysds_commons/job_iterator.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hysds_commons/__init__.py b/hysds_commons/__init__.py index 595709c..f63aec2 100644 --- a/hysds_commons/__init__.py +++ b/hysds_commons/__init__.py @@ -3,6 +3,6 @@ from __future__ import division from __future__ import absolute_import -__version__ = "1.1.0" +__version__ = "1.1.1" __description__ = "Common HySDS Functions, Utilities, Etc." __url__ = "https://github.jpl.nasa.gov/hysds-org/hysds_commons" diff --git a/hysds_commons/job_iterator.py b/hysds_commons/job_iterator.py index 20981f0..2eb22c2 100644 --- a/hysds_commons/job_iterator.py +++ b/hysds_commons/job_iterator.py @@ -81,11 +81,12 @@ def iterate(component, rule): # Run the query to get the products; for efficiency, run query only if we need the results results = [{"_id": "Transient Faux-Results"}] + sort = ["@timestamp:desc", "id.keyword:asc"] if run_query: if component == "mozart" or component == "figaro": - results = mozart_es.query(index=es_index, body=queryobj) + results = mozart_es.query(index=es_index, body=queryobj, sort=sort) else: - results = grq_es.query(index=es_index, body=queryobj) + results = grq_es.query(index=es_index, body=queryobj, sort=sort) # What to iterate for submission submission_iterable = [{"_id": "Global Single Submission"}] if single else results