Skip to content

Commit b479a65

Browse files
authored
Merge fe7ca1b into 3e61538
2 parents 3e61538 + fe7ca1b commit b479a65

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

cumulus_lambda_functions/daac_archiver/daac_archiver_logic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def send_to_daac_internal(self, uds_cnm_json: dict):
105105
LOGGER.debug(f'uds_cnm_json is not configured for archival. uds_cnm_json: {uds_cnm_json}')
106106
return
107107
daac_config = daac_config[0] # TODO This is currently not supporting more than 1 daac.
108-
result = JsonValidator(UdsArchiveConfigIndex.basic_schema).validate(daac_config)
108+
result = JsonValidator(UdsArchiveConfigIndex.db_record_schema).validate(daac_config)
109109
if result is not None:
110110
raise ValueError(f'daac_config does not have valid schema. Pls re-add the daac config: {result} for {daac_config}')
111111
try:

cumulus_lambda_functions/granules_to_es/granules_indexer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ def start(self):
7878
return
7979
self.__cumulus_record = incoming_msg['record']
8080
if len(self.__cumulus_record['files']) < 1:
81+
LOGGER.debug(f'No files in cumulus record. Not inserting to ES')
8182
# TODO ingest updating stage?
8283
return
84+
if 'status' not in self.__cumulus_record or self.__cumulus_record['status'].upper() != 'COMPLETED':
85+
LOGGER.debug(f'missing status or it is NOT COMPLETED status. Not inserting to ES')
86+
return
8387
stac_input_meta = None
8488
potential_files = self.__get_potential_files()
8589
LOGGER.debug(f'potential_files: {potential_files}')

cumulus_lambda_functions/lib/uds_db/archive_index.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@ class UdsArchiveConfigIndex:
2929
}
3030
}
3131

32+
db_record_schema = {
33+
'type': 'object',
34+
'required': ['daac_collection_name', 'daac_sns_topic_arn', 'daac_data_version', 'daac_role_arn',
35+
'daac_role_session_name',
36+
'collection', 'ss_username', 'archiving_types'],
37+
'properties': {
38+
'daac_collection_name': {'type': 'string'},
39+
'daac_sns_topic_arn': {'type': 'string'},
40+
'daac_data_version': {'type': 'string'},
41+
'daac_role_arn': {'type': 'string'},
42+
'daac_role_session_name': {'type': 'string'},
43+
'collection': {'type': 'string'},
44+
'ss_username': {'type': 'string'},
45+
'archiving_types': {'type': 'array', 'items': {'type': 'object'}},
46+
}
47+
}
48+
3249
def __init__(self, es_url, es_port=443, es_type='AWS', use_ssl=True):
3350
self.__es: ESAbstract = ESFactory().get_instance(es_type,
3451
index='TODO',

0 commit comments

Comments
 (0)