Skip to content

Commit ac4d15e

Browse files
committed
Set FAILED status steps that did not succeed
1 parent 745bf6b commit ac4d15e

16 files changed

Lines changed: 76 additions & 64 deletions

jwst/assign_mtwcs/tests/test_mtwcs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_output_is_not_input(monkeypatch, success):
107107
that performance is the most important thing and extra copies are
108108
not desired.
109109
"""
110-
# Mock a failure in the ModelLibrary init, to exercise the "skipped" condition
110+
# Mock a failure in the ModelLibrary init, to exercise the "failed" condition
111111
if not success:
112112

113113
def raise_error(*args, **kwargs):
@@ -127,7 +127,7 @@ def raise_error(*args, **kwargs):
127127
if success:
128128
assert im.meta.cal_step.assign_mtwcs == "COMPLETE"
129129
else:
130-
assert im.meta.cal_step.assign_mtwcs == "SKIPPED"
130+
assert im.meta.cal_step.assign_mtwcs == "FAILED"
131131
assert im is not input_im
132132
assert input_im.meta.cal_step.assign_mtwcs is None
133133

jwst/master_background/master_background_mos_step.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def process(self, data):
120120
output_model.meta.cal_step.master_background,
121121
]:
122122
log.info("Background subtraction has already occurred. Skipping.")
123-
record_step_status(output_model, "master_background", success=False)
123+
record_step_status(output_model, "master_background", status="SKIPPED")
124124
return output_model
125125

126126
bkg_x1d_spectra = None
@@ -143,11 +143,11 @@ def process(self, data):
143143
log.warning(
144144
"No background slits available for creating master background. Skipping"
145145
)
146-
record_step_status(output_model, "master_background", False)
146+
record_step_status(output_model, "master_background", status="SKIPPED")
147147
return output_model
148148
elif num_src == 0:
149149
log.warning("No source slits for applying master background. Skipping")
150-
record_step_status(output_model, "master_background", False)
150+
record_step_status(output_model, "master_background", status="SKIPPED")
151151
return output_model
152152

153153
log.info("Calculating master background")
@@ -158,7 +158,7 @@ def process(self, data):
158158
# Check that a master background was actually determined.
159159
if master_background is None:
160160
log.info("No master background could be calculated. Skipping.")
161-
record_step_status(output_model, "master_background", False)
161+
record_step_status(output_model, "master_background", status="FAILED")
162162
return output_model
163163

164164
# Now apply the de-calibrated background to the original science
@@ -167,7 +167,7 @@ def process(self, data):
167167
)
168168

169169
# Mark as completed and setup return data
170-
record_step_status(result, "master_background", True)
170+
record_step_status(result, "master_background", status="COMPLETE")
171171
self.correction_pars = {"masterbkg_1d": master_background, "masterbkg_2d": mb_multislit}
172172
if self.save_background:
173173
self.save_model(master_background, suffix="masterbg1d", force=True)

jwst/master_background/master_background_step.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def process(self, input_data):
5353

5454
# First check if we should even do the subtraction. If not, bail.
5555
if not self._do_sub(output_model):
56-
record_step_status(output_model, "master_background", success=False)
56+
record_step_status(output_model, "master_background", status="SKIPPED")
5757
return output_model
5858

5959
# Check that data is a supported datamodel. If not, bail.
@@ -70,7 +70,7 @@ def process(self, input_data):
7070
log.warning(
7171
f"Input {input_data} of type {type(output_model)} cannot be handled. Step skipped."
7272
)
73-
record_step_status(output_model, "master_background", success=False)
73+
record_step_status(output_model, "master_background", status="SKIPPED")
7474
return output_model
7575

7676
# If user-supplied master background, subtract it
@@ -114,7 +114,7 @@ def process(self, input_data):
114114
f"Input {input_data} of type {type(output_model)} cannot be "
115115
"handled without user-supplied background. Step skipped."
116116
)
117-
record_step_status(output_model, "master_background", success=False)
117+
record_step_status(output_model, "master_background", status="SKIPPED")
118118
return output_model
119119

120120
result, background_data = split_container(output_model)
@@ -124,7 +124,7 @@ def process(self, input_data):
124124
"and no user-supplied background provided. Skipping step."
125125
)
126126
log.warning(msg)
127-
record_step_status(output_model, "master_background", success=False)
127+
record_step_status(output_model, "master_background", status="SKIPPED")
128128
return output_model
129129
asn_id = result.asn_table["asn_id"]
130130

@@ -189,7 +189,7 @@ def process(self, input_data):
189189
background_2d_collection, suffix="masterbg2d", force=True, asn_id=asn_id
190190
)
191191

192-
record_step_status(result, "master_background", success=True)
192+
record_step_status(result, "master_background", status="COMPLETE")
193193

194194
# Clean up intermediate background models
195195
background_2d_collection.close()

jwst/master_background/tests/test_master_background_mos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ def test_skip_no_master_bg(monkeypatch, nirspec_msa_extracted2d):
265265
# mock a failure in master bg creation
266266
monkeypatch.setattr(step, "_extend_bg_slits", lambda *args, **kwargs: None)
267267

268-
# Step is skipped
268+
# Step is marked FAILED
269269
result = step.run(model)
270-
assert result.meta.cal_step.master_background == "SKIPPED"
270+
assert result.meta.cal_step.master_background == "FAILED"
271271

272272
# Input is not modified
273273
assert result is not model

jwst/outlier_detection/outlier_detection_step.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def process(self, input_data):
171171
log.error(f"Outlier detection failed for unknown/unsupported mode: {mode}")
172172
record_step_status(result_models, "outlier_detection", False)
173173

174-
if query_step_status(result_models, "outlier_detection") != "SKIPPED":
174+
if query_step_status(result_models, "outlier_detection") not in ("SKIPPED", "FAILED"):
175175
record_step_status(result_models, "outlier_detection", True)
176176
return result_models
177177

jwst/outlier_detection/tests/test_ifu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def test_ifu_one_exposure(miri_ifu_rate):
99
input_model = miri_ifu_rate
1010
result = OutlierDetectionStep.call([input_model])
1111

12-
# Step is skipped
13-
assert result[0].meta.cal_step.outlier_detection == "SKIPPED"
12+
# Step is failed
13+
assert result[0].meta.cal_step.outlier_detection == "FAILED"
1414

1515
# Input is not modified
1616
assert result[0] is not input_model

jwst/outlier_detection/tests/test_imaging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def test_skip_one_exposure_imaging():
274274
result = step.run(input_models)
275275

276276
# Step is skipped
277-
assert query_step_status(result, "outlier_detection") == "SKIPPED"
277+
assert query_step_status(result, "outlier_detection") == "FAILED"
278278

279279
# Input is not modified
280280
assert result is not model

jwst/outlier_detection/tests/test_outlier_detection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_guess_mode_assigned(caplog, mode):
117117
step.mode = mode
118118
result = step.run(input_model)
119119

120-
assert result.meta.cal_step.outlier_detection == "SKIPPED"
120+
assert result.meta.cal_step.outlier_detection == "FAILED"
121121
assert isinstance(result, datamodels.ImageModel)
122122

123123
# If mode was unrecognized, error message is issued
@@ -137,8 +137,8 @@ def test_skip_unknown_mode_file(tmp_path, caplog):
137137
input_model.save(input_file)
138138
result = OutlierDetectionStep.call(input_file)
139139

140-
# Step is skipped with an error message
141-
assert result.meta.cal_step.outlier_detection == "SKIPPED"
140+
# Step is failed with an error message
141+
assert result.meta.cal_step.outlier_detection == "FAILED"
142142
assert isinstance(result, datamodels.ImageModel)
143143
assert "ERROR" in caplog.text
144144

@@ -152,8 +152,8 @@ def test_skip_unknown_mode_image_model():
152152
input_model = datamodels.ImageModel()
153153
result = OutlierDetectionStep.call(input_model)
154154

155-
# Step is skipped
156-
assert result.meta.cal_step.outlier_detection == "SKIPPED"
155+
# Step is failed
156+
assert result.meta.cal_step.outlier_detection == "FAILED"
157157

158158
# Input is not modified
159159
assert result is not input_model
@@ -165,8 +165,8 @@ def test_skip_unknown_mode_container():
165165
container = ModelContainer([input_model])
166166
result = OutlierDetectionStep.call(container)
167167

168-
# Step is skipped
169-
assert result[0].meta.cal_step.outlier_detection == "SKIPPED"
168+
# Step is failed
169+
assert result[0].meta.cal_step.outlier_detection == "FAILED"
170170

171171
# Input is not modified
172172
assert result[0] is not input_model

jwst/outlier_detection/tests/test_spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def test_skip_one_exposure_spec():
122122
# it should skip and return a copy of the input with the status set
123123
result = step.run(input_models)
124124

125-
# Step is skipped
126-
assert result[0].meta.cal_step.outlier_detection == "SKIPPED"
125+
# Step is failed
126+
assert result[0].meta.cal_step.outlier_detection == "FAILED"
127127

128128
# Input is not modified
129129
assert result[0] is not model

jwst/pixel_replace/pixel_replace_step.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def process(self, input_data):
5757
log.error(f"Input is of type {str(output_model)} for which")
5858
log.error("pixel_replace does not have an algorithm.")
5959
log.error("Pixel replacement will be skipped.")
60-
output_model.meta.cal_step.pixel_replace = "SKIPPED"
60+
record_step_status(output_model, "pixel_replace", success=False)
6161
return output_model
6262

6363
pars = {

0 commit comments

Comments
 (0)