Skip to content

Commit

Permalink
feat: don't pull invalid json owner data (#1535)
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Roberts <derek.roberts@gmail.com>
  • Loading branch information
ronrobb and DerekRoberts authored Aug 20, 2024
1 parent 17987b5 commit 8d6703f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ SELECT drft.seedlot_number
WHERE drft.seedlot_number = %(p_seedlot_number)s
AND s.seedlot_status_code = 'PND'
AND NOT(drft.all_step_data @? '$.ownershipStep[*].*.isInvalid ? (@ == true)')
AND TRIM(ownerdata->'ownerAgency'->>'value') != ''
AND TRIM(ownerdata->'ownerCode'->>'value') != ''
AND TRIM(ownerdata->'ownerPortion'->>'value') != ''
AND TRIM(ownerdata->'reservedPerc'->>'value') != ''
AND TRIM(ownerdata->'surplusPerc'->>'value') != ''
ORDER BY 1
, 2
, 3
1 change: 1 addition & 0 deletions sync/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def main() -> int:
return job_return_code

except Exception as err:
print(f"A fatal error has occurred ({type(err)}): {err}")
return 1 #failure

# MAIN Execution
Expand Down
2 changes: 1 addition & 1 deletion sync/src/module/data_sync_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_scheduler(track_db_conn:object, database_schema:str) -> list:
select_sync_id_stm = f"""
select
COALESCE(MAX(to_timestamp) + INTERVAL '1 microsecond'
, CURRENT_TIMESTAMP - INTERVAL '2 days') as current_start_time,
, CURRENT_TIMESTAMP - INTERVAL '3 days') as current_start_time,
CURRENT_TIMESTAMP as current_end_time,
(select run_status
from spar.etl_execution_log
Expand Down
1 change: 1 addition & 0 deletions sync/src/module/data_synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def execute_instance(oracle_config, postgres_config, track_config):

#if job is already running, stop
if schedule_times['last_run_status'] == "RUNNING":
logger.info("Critical error: previous job still RUNNING or did not report SUCCESS or FAILURE")
raise Exception("Critical error: previous job still RUNNING or did not report SUCCESS or FAILURE")

logger.info('Insert execution log - signal RUNNING')
Expand Down

0 comments on commit 8d6703f

Please sign in to comment.