Skip to content

fix: use correct schema #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def send_to_daac_internal(self, uds_cnm_json: dict):
LOGGER.debug(f'uds_cnm_json is not configured for archival. uds_cnm_json: {uds_cnm_json}')
return
daac_config = daac_config[0] # TODO This is currently not supporting more than 1 daac.
result = JsonValidator(UdsArchiveConfigIndex.basic_schema).validate(daac_config)
result = JsonValidator(UdsArchiveConfigIndex.db_record_schema).validate(daac_config)
if result is not None:
raise ValueError(f'daac_config does not have valid schema. Pls re-add the daac config: {result} for {daac_config}')
try:
Expand Down
4 changes: 4 additions & 0 deletions cumulus_lambda_functions/granules_to_es/granules_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ def start(self):
return
self.__cumulus_record = incoming_msg['record']
if len(self.__cumulus_record['files']) < 1:
LOGGER.debug(f'No files in cumulus record. Not inserting to ES')
# TODO ingest updating stage?
return
if 'status' not in self.__cumulus_record or self.__cumulus_record['status'].upper() != 'COMPLETED':
LOGGER.debug(f'missing status or it is NOT COMPLETED status. Not inserting to ES')
return
stac_input_meta = None
potential_files = self.__get_potential_files()
LOGGER.debug(f'potential_files: {potential_files}')
Expand Down
17 changes: 17 additions & 0 deletions cumulus_lambda_functions/lib/uds_db/archive_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ class UdsArchiveConfigIndex:
}
}

db_record_schema = {
'type': 'object',
'required': ['daac_collection_name', 'daac_sns_topic_arn', 'daac_data_version', 'daac_role_arn',
'daac_role_session_name',
'collection', 'ss_username', 'archiving_types'],
'properties': {
'daac_collection_name': {'type': 'string'},
'daac_sns_topic_arn': {'type': 'string'},
'daac_data_version': {'type': 'string'},
'daac_role_arn': {'type': 'string'},
'daac_role_session_name': {'type': 'string'},
'collection': {'type': 'string'},
'ss_username': {'type': 'string'},
'archiving_types': {'type': 'array', 'items': {'type': 'object'}},
}
}

def __init__(self, es_url, es_port=443, es_type='AWS', use_ssl=True):
self.__es: ESAbstract = ESFactory().get_instance(es_type,
index='TODO',
Expand Down
Loading