Skip to content

Commit

Permalink
#925: Fixed docker command parameters and empty ES index exception ha…
Browse files Browse the repository at this point in the history
…ndling
  • Loading branch information
philipjyoon committed Jul 23, 2024
1 parent 3de4de7 commit ebff25a
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 18 deletions.
28 changes: 18 additions & 10 deletions data_subscriber/cslc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import boto3
import logging
from functools import cache
import elasticsearch

from util import datasets_json_util
from util.conf_util import SettingsConf
Expand Down Expand Up @@ -338,18 +339,25 @@ def save_blocked_download_job(eu, release_version, product_type, params, job_que
)

def get_pending_download_jobs(es):
return es.query(
index=PENDING_CSLC_DOWNLOADS_ES_INDEX_NAME,
body={"query": {
"bool": {
"must": [
{"term": {"submitted": False}},
{"match": {"job_type": PENDING_TYPE_CSLC_DOWNLOAD}}
]
'''Retrieve all pending cslc download jobs from the ES index'''

try:
result = es.query(
index=PENDING_CSLC_DOWNLOADS_ES_INDEX_NAME,
body={"query": {
"bool": {
"must": [
{"term": {"submitted": False}},
{"match": {"job_type": PENDING_TYPE_CSLC_DOWNLOAD}}
]
}
}
}
}
)
)
except elasticsearch.exceptions.NotFoundError as e:
return []

return result

def mark_pending_download_job_submitted(es, doc_id, download_job_id):
return es.update_document(
Expand Down
3 changes: 0 additions & 3 deletions data_subscriber/submit_pending_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ def configure_logger():

def run(argv: list[str]):
logger.info(f"{argv=}")
#parser = create_parser()
#args = parser.parse_args(argv[1:])
#validate_args(args)

job_submission_tasks = []
disp_burst_map, burst_to_frames, datetime_to_frames = localize_disp_frame_burst_hist()
Expand Down
6 changes: 2 additions & 4 deletions docker/hysds-io.json.cslc_query
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@
"from": "submitter",
"placeholder": "e.g. --k=<k>",
"type": "text",
"default": "--k=2",
"optional": true
"default": "--k=15"
},
{
"name": "m",
"from": "submitter",
"placeholder": "e.g. --m=<m>",
"type": "text",
"default": "--m=2",
"optional": true
"default": "--m=5"
},
{
"name": "grace_mins",
Expand Down
23 changes: 22 additions & 1 deletion docker/hysds-io.json.cslc_query_frame_range
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,28 @@
{
"name": "frame_id",
"from": "submitter",
"placeholder": "e.g. --frame-id",
"placeholder": "e.g. --frame-id"
},
{
"name": "k",
"from": "submitter",
"placeholder": "e.g. --k=<k>",
"type": "text",
"default": "--k=15"
},
{
"name": "m",
"from": "submitter",
"placeholder": "e.g. --m=<m>",
"type": "text",
"default": "--m=5"
},
{
"name": "grace_mins",
"from": "submitter",
"placeholder": "e.g. --grace-mins=<grace_mins>",
"type": "text",
"default": "--grace-mins=120",
"optional": true
},
{
Expand Down
12 changes: 12 additions & 0 deletions docker/job-spec.json.cslc_query_frame_range
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@
"name": "frame_id",
"destination": "positional"
},
{
"name": "k",
"destination": "positional"
},
{
"name": "m",
"destination": "positional"
},
{
"name": "grace_mins",
"destination": "positional"
},
{
"name": "transfer_protocol",
"destination": "positional"
Expand Down

0 comments on commit ebff25a

Please sign in to comment.