Skip to content

Commit

Permalink
Merge pull request #7 from mraspaud/fix-uid
Browse files Browse the repository at this point in the history
Fix missing uid in messages
  • Loading branch information
TAlonglong authored Apr 19, 2024
2 parents 6dac5d5 + 6d5034f commit b38faca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pytroll_watchers/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def file_publisher_from_generator(generator, publisher_config, message_config):
for file_item, file_metadata in generator:
amended_message_config = deepcopy(message_config)
amended_message_config["data"]["uri"] = file_item.as_uri()
amended_message_config["data"]["uid"] = file_item.name
with suppress(AttributeError):
amended_message_config["data"]["fs"] = json.loads(file_item.fs.to_json())
aliases = amended_message_config.pop("aliases", {})
Expand Down
1 change: 1 addition & 0 deletions tests/test_bucket_notification_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def test_publish_paths(patched_bucket_listener, caplog): # noqa
assert len(messages) == len(records)
message = Message(rawstr=messages[0])
assert message.data["uri"] == "s3://viirs-data/sdr/SVM13_npp_d20240408_t1006227_e1007469_b64498_c20240408102334392250_cspp_dev.h5"
assert message.data["uid"] == "SVM13_npp_d20240408_t1006227_e1007469_b64498_c20240408102334392250_cspp_dev.h5"
assert message.data["sensor"] == "viirs"
assert message.data["fs"] == {"cls": "s3fs.core.S3FileSystem", "protocol": "s3", "args": [],
"profile": "someprofile"}
Expand Down
1 change: 1 addition & 0 deletions tests/test_copernicus_dataspace_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def test_publish_paths(caplog):
assert len(messages) == 3
message = Message(rawstr=messages[0])
assert message.data["uri"] == "s3:///eodata/Sentinel-3/OLCI/OL_1_EFR___/2024/04/15/S3B_OL_1_EFR____20240415T074029_20240415T074329_20240415T094236_0179_092_035_1620_PS2_O_NR_003.SEN3"
assert message.data["uid"] == "S3B_OL_1_EFR____20240415T074029_20240415T074329_20240415T094236_0179_092_035_1620_PS2_O_NR_003.SEN3" # noqa
assert message.data["sensor"] == "olci"
assert message.data["fs"] == {"cls": "s3fs.core.S3FileSystem", "protocol": "s3", "args": [],
"profile": "someprofile"}
Expand Down

0 comments on commit b38faca

Please sign in to comment.