dkist-processing-common 10.6.1rc5__py3-none-any.whl → 10.6.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -182,7 +182,7 @@ def writing_metadata_store_record_provenance(self, is_task_manual: bool, library
182
182
  workflowVersion=self.workflow_version,
183
183
  )
184
184
  self.write(
185
- data=asdict(params),
185
+ data=params.model_dump(),
186
186
  encoder=json_encoder,
187
187
  tags=["PROVENANCE_RECORD"],
188
188
  relative_path=f"{self.task_name}_provenance.json",
@@ -26,3 +26,4 @@ class WavelengthRange(BaseModel):
26
26
  """Validate that the max wavelength is greater than the min wavelength."""
27
27
  if self.min > self.max:
28
28
  raise ValueError("min is greater than max. Values may be reversed.")
29
+ return self
@@ -20,12 +20,17 @@ class TransferL0Data(WorkflowTaskBase, GlobusMixin, InputDatasetMixin):
20
20
 
21
21
  def download_input_dataset(self):
22
22
  """Get the input dataset document parts and save it to scratch with the appropriate tags."""
23
- if doc := self.metadata_store_input_dataset_observe_frames.inputDatasetPartDocument:
24
- self.write(doc, tags=Tag.input_dataset_observe_frames(), encoder=json_encoder)
25
- if doc := self.metadata_store_input_dataset_calibration_frames.inputDatasetPartDocument:
26
- self.write(doc, tags=Tag.input_dataset_calibration_frames(), encoder=json_encoder)
27
- if doc := self.metadata_store_input_dataset_parameters.inputDatasetPartDocument:
28
- self.write(doc, tags=Tag.input_dataset_parameters(), encoder=json_encoder)
23
+ if observe_frames := self.metadata_store_input_dataset_observe_frames:
24
+ observe_doc = observe_frames.inputDatasetPartDocument
25
+ self.write(observe_doc, tags=Tag.input_dataset_observe_frames(), encoder=json_encoder)
26
+ if calibration_frames := self.metadata_store_input_dataset_calibration_frames:
27
+ calibration_doc = calibration_frames.inputDatasetPartDocument
28
+ self.write(
29
+ calibration_doc, tags=Tag.input_dataset_calibration_frames(), encoder=json_encoder
30
+ )
31
+ if parameters := self.metadata_store_input_dataset_parameters:
32
+ parameters_doc = parameters.inputDatasetPartDocument
33
+ self.write(parameters_doc, tags=Tag.input_dataset_parameters(), encoder=json_encoder)
29
34
 
30
35
  def format_transfer_items(
31
36
  self, input_dataset_objects: list[InputDatasetObject]
@@ -0,0 +1,34 @@
1
+ import pytest
2
+
3
+ from dkist_processing_common.manual import ManualProcessing
4
+ from dkist_processing_common.tasks import WorkflowTaskBase
5
+
6
+
7
+ class ProvenanceTask(WorkflowTaskBase):
8
+ record_provenance = True
9
+
10
+ def run(self):
11
+ ...
12
+
13
+
14
+ @pytest.fixture(scope="function")
15
+ def manual_processing_run(tmp_path, recipe_run_id):
16
+ with ManualProcessing(
17
+ recipe_run_id=recipe_run_id,
18
+ workflow_path=tmp_path,
19
+ workflow_name="manual",
20
+ workflow_version="manual",
21
+ ) as manual_processing_run:
22
+ yield manual_processing_run
23
+
24
+
25
+ def test_manual_record_provenance(tmp_path, recipe_run_id, manual_processing_run):
26
+ """
27
+ Given: A WorkflowTaskBase subclass with provenance recording turned on
28
+ When: Running the task with the ManualProcessing wrapper
29
+ Then: The provenance record exists on disk
30
+ """
31
+ manual_processing_run.run_task(task=ProvenanceTask)
32
+ directory = tmp_path / str(recipe_run_id)
33
+ provenance_file = directory / "ProvenanceTask_provenance.json"
34
+ assert provenance_file.exists()
@@ -17,10 +17,20 @@ class TransferL0DataTask(TransferL0Data):
17
17
  ...
18
18
 
19
19
 
20
- @pytest.fixture
21
- def transfer_l0_data_task(recipe_run_id, tmp_path, mocker):
20
+ class FakeGQLClientMissingPart(FakeGQLClient):
21
+ """Same metadata mocker with calibration input dataset part missing."""
22
+
23
+ def execute_gql_query(self, **kwargs):
24
+ original_response = super().execute_gql_query(**kwargs)
25
+ # Remove calibration frames part
26
+ del original_response[0].recipeInstance.inputDataset.inputDatasetInputDatasetParts[2]
27
+ return original_response
28
+
29
+
30
+ def _transfer_l0_data_task_with_client(recipe_run_id, tmp_path, mocker, client_cls):
22
31
  mocker.patch(
23
- "dkist_processing_common.tasks.mixin.metadata_store.GraphQLClient", new=FakeGQLClient
32
+ "dkist_processing_common.tasks.mixin.metadata_store.GraphQLClient",
33
+ new=client_cls,
24
34
  )
25
35
  with TransferL0DataTask(
26
36
  recipe_run_id=recipe_run_id,
@@ -35,6 +45,18 @@ def transfer_l0_data_task(recipe_run_id, tmp_path, mocker):
35
45
  task._purge()
36
46
 
37
47
 
48
+ @pytest.fixture
49
+ def transfer_l0_data_task(recipe_run_id, tmp_path, mocker):
50
+ yield from _transfer_l0_data_task_with_client(recipe_run_id, tmp_path, mocker, FakeGQLClient)
51
+
52
+
53
+ @pytest.fixture
54
+ def transfer_l0_data_task_missing_part(recipe_run_id, tmp_path, mocker):
55
+ yield from _transfer_l0_data_task_with_client(
56
+ recipe_run_id, tmp_path, mocker, FakeGQLClientMissingPart
57
+ )
58
+
59
+
38
60
  def test_download_dataset(transfer_l0_data_task):
39
61
  """
40
62
  :Given: a TransferL0Data task with a valid input dataset
@@ -63,6 +85,29 @@ def test_download_dataset(transfer_l0_data_task):
63
85
  assert parameters_doc_from_file == expected_parameters_doc
64
86
 
65
87
 
88
+ def test_download_dataset_missing_part(transfer_l0_data_task_missing_part):
89
+ """
90
+ :Given: a TransferL0Data task with a valid input dataset without calibration frames
91
+ :When: downloading the dataset documents from the metadata store
92
+ :Then: the correct number of documents are written to disk
93
+ """
94
+ # Given
95
+ task = transfer_l0_data_task_missing_part
96
+ # When
97
+ task.download_input_dataset()
98
+ # Then
99
+ observe_doc_from_file = next(
100
+ task.read(tags=Tag.input_dataset_observe_frames(), decoder=json_decoder)
101
+ )
102
+ parameters_doc_from_file = next(
103
+ task.read(tags=Tag.input_dataset_parameters(), decoder=json_decoder)
104
+ )
105
+ with pytest.raises(StopIteration):
106
+ calibration_doc_from_file = next(
107
+ task.read(tags=Tag.input_dataset_calibration_frames(), decoder=json_decoder)
108
+ )
109
+
110
+
66
111
  def test_format_frame_transfer_items(transfer_l0_data_task):
67
112
  """
68
113
  :Given: a TransferL0Data task with a downloaded input dataset
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: dkist-processing-common
3
- Version: 10.6.1rc5
3
+ Version: 10.6.3
4
4
  Summary: Common task classes used by the DKIST science data processing pipelines
5
5
  Author-email: NSO / AURA <dkistdc@nso.edu>
6
6
  License: BSD-3-Clause
@@ -65,6 +65,8 @@ Requires-Dist: dkist-quality<2.0,>=1.2.1; extra == "quality"
65
65
  dkist-processing-common
66
66
  =======================
67
67
 
68
+ |codecov|
69
+
68
70
  This repository works in concert with `dkist-processing-core <https://pypi.org/project/dkist-processing-core/>`_ and `dkist-processing-*instrument*` to
69
71
  form the DKIST calibration processing stack.
70
72
 
@@ -173,3 +175,6 @@ then the Bitbucket pipeline will fail. To be able to use the same tag you must d
173
175
  # Re-tag with the same version
174
176
  git tag vWHATEVER.THE.VERSION
175
177
  git push --tags origin main
178
+
179
+ .. |codecov| image:: https://codecov.io/bb/dkistdc/dkist-processing-common/graph/badge.svg?token=3QSLGSEF3O
180
+ :target: https://codecov.io/bb/dkistdc/dkist-processing-common
@@ -1,9 +1,7 @@
1
1
  changelog/.gitempty,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- changelog/236.misc.1.rst,sha256=wN9uYenjgu25jpjAcLtCxLIAlLz658rqAV6sIvWBulI,158
3
- changelog/236.misc.rst,sha256=V_aMXk7hePoQxIaiXCh7IKrvqe3Z0R_JYotQRMBAg9o,315
4
2
  dkist_processing_common/__init__.py,sha256=490Fwm_GgqpwriQlsYfKcLUZNhZ6GkINtJqcYSIEKoU,319
5
3
  dkist_processing_common/config.py,sha256=IcpaD_NvHZU-aLlUNOTdRC4V7ADIvVQwrZ2dHhIr4NY,4247
6
- dkist_processing_common/manual.py,sha256=4sGj3cChdnEpwzq2GSNSbTpUf2oS3YUWiXna6ALfMF4,7037
4
+ dkist_processing_common/manual.py,sha256=IH72QxdGlr-BuWq2EDrfC9yStegO-elUWrobQqT4710,7042
7
5
  dkist_processing_common/_util/__init__.py,sha256=xf6JNpMKQgbhE2Jivymt-WO0WF6PpGt9rl604YpuTWk,92
8
6
  dkist_processing_common/_util/constants.py,sha256=b0zlRaT09aGj2RU72OQ5J-8u6Z_RevPXtcyx5tlnf-Y,3244
9
7
  dkist_processing_common/_util/graphql.py,sha256=qjsvLWDHqb1X7hDLA8uqbpOIDjZZ2mjsSIL0Wkt1TJc,3420
@@ -32,7 +30,7 @@ dkist_processing_common/models/parameters.py,sha256=Ymx-wvPVMkXg5emhOivv7NG0QsAt
32
30
  dkist_processing_common/models/quality.py,sha256=ONz1A6_qyEoZhQkVp9LChAgm93aGt1O5WSRneE3XCCA,2319
33
31
  dkist_processing_common/models/tags.py,sha256=ykOYqWMU7_ffvRCv84-avjXyty9pHBo7EXwsjIjStjs,12058
34
32
  dkist_processing_common/models/task_name.py,sha256=NL0n92A9vVYBV-yvh8d-qFOCxVy0X2GECDmLgIzrmOY,565
35
- dkist_processing_common/models/wavelength.py,sha256=mH4xkNdPU7kedJfQStI6A0WdkMLi61wfe47pJI9kHBI,946
33
+ dkist_processing_common/models/wavelength.py,sha256=Wtmu5QhjPpsqIGfUQ0Wh-3PQlGeRdGV9BfFAy23HLGg,966
36
34
  dkist_processing_common/parsers/__init__.py,sha256=XJQzHtPb78F6-qXXKXjyztc0x-aHVlgv1C_l4dR88tI,67
37
35
  dkist_processing_common/parsers/cs_step.py,sha256=en1ovwy8H2jeUxZd0XDSV8Qv3ZawRm03q6wpJj4a3C8,6461
38
36
  dkist_processing_common/parsers/dsps_repeat.py,sha256=NiUMnfMYSn0qserHM735V1Z6BCfw4CAanlqtjfyRkos,1571
@@ -57,7 +55,7 @@ dkist_processing_common/tasks/output_data_base.py,sha256=CC1TnCrChi8_iuMymr425CJ
57
55
  dkist_processing_common/tasks/parse_l0_input_data.py,sha256=iRMGdvhxBobNsTDQ0IEl0myDfB4P_xpxA00guuBWDj8,7986
58
56
  dkist_processing_common/tasks/quality_metrics.py,sha256=g6MUq8s8jELDinkn6o45rfONyODw92JyVMrzb7Dd7OI,12458
59
57
  dkist_processing_common/tasks/teardown.py,sha256=e4LKnphJDYDVDAez2tH7MxpZgCmxYsKrq9Zk0qAkzzM,2355
60
- dkist_processing_common/tasks/transfer_input_data.py,sha256=bv2t0DN7nQ9opfl3VPdXG9m69zdzNIjordlCyZVNyBQ,5324
58
+ dkist_processing_common/tasks/transfer_input_data.py,sha256=afEW0glpCFMZRj90nFtQo_4XOQ4CuoOh86jahP6a-a0,5548
61
59
  dkist_processing_common/tasks/trial_catalog.py,sha256=Y3DKstRfMS8nWWtJFMB0MUVPlZ1jWS_2jhJGMWwxy50,8748
62
60
  dkist_processing_common/tasks/trial_output_data.py,sha256=aI_aRuu0qVO8zFGrr_9baxx9i3jUEHZSmsmbO6ytlkE,6960
63
61
  dkist_processing_common/tasks/write_l1.py,sha256=C5IRUX1JO_Wa7suv_tgE4tH1E2eAUkro0rtj9EHduqw,22429
@@ -83,6 +81,7 @@ dkist_processing_common/tests/test_flower_pot.py,sha256=X9_UI3maa3ZQncV3jYHgovWn
83
81
  dkist_processing_common/tests/test_input_dataset.py,sha256=AI5uqaDea4kOwpwAU5qQdzUbxMpBwD20YCAvB7nzD5o,18766
84
82
  dkist_processing_common/tests/test_interservice_bus.py,sha256=M_iv2CLmx5TnCB1VUN4YjkQ2LEUjfCKk7-ZlkV62XEQ,3000
85
83
  dkist_processing_common/tests/test_interservice_bus_mixin.py,sha256=8TTl0aypkq5gBPeyqSaQHbz_jmt5RmSD2oI8kT4Q1ZA,4195
84
+ dkist_processing_common/tests/test_manual_processing.py,sha256=wAZJztsF33jzJE3m3vJ6cJT0ujgIkMg01jGq-Ys_a4c,1045
86
85
  dkist_processing_common/tests/test_output_data_base.py,sha256=Y9MFz5xw11tAnKjpHH7qrzsRYP1rZM_Trt4AylY0S6k,3120
87
86
  dkist_processing_common/tests/test_parameters.py,sha256=Tr0Wu8-_rj9Lp7CkUVmJjSouW7CAL_ZwhShK_U1GzVs,12384
88
87
  dkist_processing_common/tests/test_parse_l0_input_data.py,sha256=SMNV1qyQTvnMx94MCNsiA-RyS9uxaxIABEDDxsuVzqY,10629
@@ -96,7 +95,7 @@ dkist_processing_common/tests/test_tags.py,sha256=UwlOJ45rkvbfbd5L5m5YltvOxQc8kG
96
95
  dkist_processing_common/tests/test_task_name.py,sha256=kqFr59XX2K87xzfTlClzDV4-Je1dx72LvdaJ22UE8UU,1233
97
96
  dkist_processing_common/tests/test_task_parsing.py,sha256=QXt1X6DTO3_liBD2c-t84DToLeEn7B3J-eteIyN4HEM,4027
98
97
  dkist_processing_common/tests/test_teardown.py,sha256=w2sATQHkg2lMLvm6VFZF1mNGFYHwWj_SxvF9RQu-tuY,5362
99
- dkist_processing_common/tests/test_transfer_input_data.py,sha256=MYPsZldzQ_j0AoGFqP6_ahn8Nr5mX8WAyG0wpcQReeI,4735
98
+ dkist_processing_common/tests/test_transfer_input_data.py,sha256=pys5JI-alVEsN4nFE6KDLrAfvLOAH5lSHHpkruLR6lE,6390
100
99
  dkist_processing_common/tests/test_transfer_l1_output_data.py,sha256=27PifkyH3RZg0nsM-AjmrFJ-hbYuCk5Tt_0Zx8PJBfM,2109
101
100
  dkist_processing_common/tests/test_trial_catalog.py,sha256=SZ-nyn0MXU9Lkg_94FbKER_cwiGoi06GYlzF_3AmvKg,6802
102
101
  dkist_processing_common/tests/test_trial_output_data.py,sha256=cBCj0kXyF5NEMzKh6zPVksdoXyE8ju1opJgWgjdcJWA,12790
@@ -110,7 +109,7 @@ docs/landing_page.rst,sha256=aPAuXFhBx73lEZ59B6E6JXxkK0LlxzD0n-HXqHrfumQ,746
110
109
  docs/make.bat,sha256=mBAhtURwhQ7yc95pqwJzlhqBSvRknr1aqZ5s8NKvdKs,4513
111
110
  docs/requirements.txt,sha256=Kbl_X4c7RQZw035YTeNB63We6I7pvXFU4T0Uflp2yDY,29
112
111
  licenses/LICENSE.rst,sha256=piZaQplkzOMmH1NXg6QIdo9wwo9pPCoHkvm2-DmH76E,1462
113
- dkist_processing_common-10.6.1rc5.dist-info/METADATA,sha256=zeyUZWd51nX30x1doSzvFHRNQraAhTthpfdoQCWgARM,6973
114
- dkist_processing_common-10.6.1rc5.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
115
- dkist_processing_common-10.6.1rc5.dist-info/top_level.txt,sha256=LJhd1W-Vn90K8HnQDIE4r52YDpUjjMWDnllAWHBByW0,48
116
- dkist_processing_common-10.6.1rc5.dist-info/RECORD,,
112
+ dkist_processing_common-10.6.3.dist-info/METADATA,sha256=e_NApWqP_nEbasza1gENhO_v3h2w8yBNjcjbuk4HBWY,7154
113
+ dkist_processing_common-10.6.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
114
+ dkist_processing_common-10.6.3.dist-info/top_level.txt,sha256=LJhd1W-Vn90K8HnQDIE4r52YDpUjjMWDnllAWHBByW0,48
115
+ dkist_processing_common-10.6.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
changelog/236.misc.1.rst DELETED
@@ -1,2 +0,0 @@
1
- Change returns from the metadata store queries into Pydantic BaseModel instances. Remove unnecessary parsing
2
- and error checking in the metadata store mixin.
changelog/236.misc.rst DELETED
@@ -1,3 +0,0 @@
1
- Convert dataclasses in the graphql model to Pydantic BaseModels for additional validation. In the
2
- RecipeRunResponse class, configuration is converted from a JSON dictionary to its own Pydantic BaseModel.
3
- In the InputDatasetPartResponse class, the inputDatasetPartDocument is now returned as a list of dictionaries.