Skip to content

Commit ed378da

Browse files
authored
SWE: l1a dependency updates to reduce reprocessing of science for HK bug (#1231)
1 parent e67873c commit ed378da

3 files changed

Lines changed: 21 additions & 19 deletions

File tree

sds_data_manager/lambda_code/SDSCode/pipeline_lambdas/dependency_config.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,9 +1130,9 @@ swapi, ancillary, energy-gf-sw-lut, swapi, l3b, combined, HARD, DOWNSTREAM
11301130

11311131
# <---- SWE Dependencies ---->
11321132

1133-
swe, l0, raw, swe, l1a, sci, HARD, DOWNSTREAM
1134-
leapseconds, spice, historical, swe, l1a, sci, HARD_NO_TRIGGER, DOWNSTREAM
1135-
spacecraft_clock, spice, historical, swe, l1a, sci, HARD_NO_TRIGGER, DOWNSTREAM
1133+
swe, l0, raw, swe, l1a, all, HARD, DOWNSTREAM
1134+
leapseconds, spice, historical, swe, l1a, all, HARD_NO_TRIGGER, DOWNSTREAM
1135+
spacecraft_clock, spice, historical, swe, l1a, all, HARD_NO_TRIGGER, DOWNSTREAM
11361136

11371137
swe, l1a, sci, swe, l1b, sci, HARD, DOWNSTREAM
11381138
swe, ancillary, l1b-in-flight-cal, swe, l1b, sci, HARD, DOWNSTREAM

tests/lambda_endpoints/test_batch_starter.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_lambda_handler(session, s3_client, mock_upload_request_success):
147147
lambda_handler(events, context)
148148
mock_batch_client.submit_job.assert_called_once()
149149
mock_batch_client.submit_job.assert_called_with(
150-
jobName="swe-l1a-sci-job-1",
150+
jobName="swe-l1a-all-job-1",
151151
jobQueue="ProcessingJobQueue",
152152
jobDefinition="ProcessingJob-swe",
153153
containerOverrides={
@@ -157,13 +157,13 @@ def test_lambda_handler(session, s3_client, mock_upload_request_success):
157157
"--data-level",
158158
"l1a",
159159
"--descriptor",
160-
"sci",
160+
"all",
161161
"--start-date",
162162
"20240101",
163163
"--version",
164164
"v001",
165165
"--dependency",
166-
"imap_swe_l1a_sci-c685cc19_20240101_v001.json",
166+
"imap_swe_l1a_all-c685cc19_20240101_v001.json",
167167
"--upload-to-sdc",
168168
]
169169
},
@@ -184,7 +184,7 @@ def test_lambda_handler(session, s3_client, mock_upload_request_success):
184184
lambda_handler(events, context)
185185
mock_submit.assert_called_with(
186186
session,
187-
{"data_source": "swe", "data_type": "l1a", "descriptor": "sci"},
187+
{"data_source": "swe", "data_type": "l1a", "descriptor": "all"},
188188
"20240101",
189189
"v001",
190190
processing_input.serialize(),
@@ -807,7 +807,7 @@ def test_bulk_reprocessing_data_level(session, caplog, auth_event):
807807
"start_date": "20220101",
808808
"end_date": "20220301",
809809
"data_level": "l1a",
810-
"descriptor": "sci",
810+
"descriptor": "all",
811811
}
812812
# Create an authenticated event
813813
events = auth_event({"queryStringParameters": query_params})
@@ -1829,7 +1829,7 @@ def test_duplicate_job(session, first_status, second_status):
18291829
def test_dependency_success():
18301830
"""Test the handler returns the expected dependency result."""
18311831
dependencies = dependency.get_dependencies(
1832-
("swe", "l1a", "sci"),
1832+
("swe", "l1a", "all"),
18331833
dependency_type="UPSTREAM",
18341834
relationship="HARD",
18351835
)
@@ -1887,7 +1887,7 @@ def test_dependency_success_empty(session):
18871887
dependencies = dependency.get_jobs(
18881888
data_source="swe",
18891889
data_type="l1a",
1890-
descriptor="sci",
1890+
descriptor="all",
18911891
dependency_type="UPSTREAM",
18921892
relationship="HARD",
18931893
start_date="20000101",

tests/lambda_endpoints/test_dependency_api.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,14 +1648,13 @@ def test_calculate_crid(session):
16481648
# The CRID associated with a file is made up of the filepath and the
16491649
# Upstream file versions numbers packed into 2 bytes and sorted by the filename
16501650
# imap_swe_l1b_sci_20240101_v001.cdf has a total of 4 upstream dependency files:
1651-
# - imap_swe_l1a_sci_20240101_v001.cdf.cdf
1652-
# - imap_swe_l0_raw_20240101_v001.pkts
1653-
# - imap_swe_l1a_sci_20240101_v010.cdf
1654-
# - imap_swe_esa-lut_20221231_v001.cdf
1655-
# - imap_swe_eu-conversion_20221231_v001.cdf
1651+
# - imap_swe_esa-lut_20221231_v001.cdf (v001)
1652+
# - imap_swe_eu-conversion_20221231_v001.cdf (v001)
1653+
# - imap_swe_l1a_sci_20240101_v010.cdf (v010)
1654+
# - imap_swe_l1b-in-flight-cal_20230102_v001.cdf (v001)
16561655

16571656
# the upstream versions should be in order of the filenames alphabetically
1658-
upstream_versions = b"".join([v.to_bytes(2, "big") for v in [1, 1, 1, 10, 1]])
1657+
upstream_versions = b"".join([v.to_bytes(2, "big") for v in [1, 1, 10, 1]])
16591658
expected_crid = base64.a85encode(record.file_path.encode() + upstream_versions)
16601659
assert expected_crid.decode("ascii") == crid
16611660

@@ -1781,9 +1780,12 @@ def test_matching_crid(session):
17811780
]
17821781
assert not matching_crids_exist(session, records)
17831782
# Update the CRID of the science file to match the calculated CRID
1784-
records[
1785-
0
1786-
].crid = "05t?ABJ4IG05593E*m[1ARB7.@UF1dBjWVL1,L[>0J[!Y0JG46@q90O!<<-#!<<H,!<"
1783+
# The CRID is calculated from the file path and upstream versions [1, 1, 10, 1]
1784+
upstream_versions = b"".join([v.to_bytes(2, "big") for v in [1, 1, 10, 1]])
1785+
expected_crid = base64.a85encode(
1786+
b"/path/to/imap_swe_l1b_sci_20240102_v001.cdf" + upstream_versions
1787+
).decode("ascii")
1788+
records[0].crid = expected_crid
17871789
assert matching_crids_exist(session, records)
17881790

17891791

0 commit comments

Comments
 (0)