MetPX / sarracenia

https://MetPX.github.io/sarracenia
GNU General Public License v2.0
46 stars 22 forks source link

Have the message `rename` field be filterable #1120

Open andreleblanc11 opened 5 months ago

andreleblanc11 commented 5 months ago

Use case

winnow_dms-normal_01.log:2024-06-24 14:28:38,003 [INFO] sarracenia.flowcb.log after_accept accepted: (lag: 0.15 ) http://server:8180 /data/dms/notification/environment/hazard/wildfire-1.0-ascii/product-notification_ascii-1.0/20240624142800000/canada/all
winnow_dms-normal_01.log:2024-06-24 14:28:38,005 [INFO] sarracenia.flowcb.log after_post posted to exchange: xs_MSC-DMS-DEV topic: v02.post.data.dms.notification.environment.hazard.wildfire-1.0-ascii.product-notification_ascii-1.0.20240624142800000.canada a file with baseUrl: http://server:8180 relPath: data/dms/notification/environment/hazard/wildfire-1.0-ascii/product-notification_ascii-1.0/20240624142800000/canada/all rename: WILDFIRE_NOTIF_20240624142800000_CANADA_ALL

https://github.com/MetPX/sarracenia/blob/73fdf9f8bac1844534312c5c625312178e1ea273/sarracenia/flow/__init__.py#L1032-L1035

petersilva commented 5 months ago

thinking:

Given that you are getting the messages from the DMS winnows., you could implement an after_accept on the winnows themselves that swap the rename header for relPath and retrievePath instead... they might have to publish as v3 though... not sure if retrievePath is a thing in v2... would have to try out. anyways... if that were done, the current default processing would work on the downstream consumers with no issue. so there would be no core code change then, just a new plugin. not saying we should do that... just trying to tease out what options there are.

petersilva commented 5 months ago

another interpretation... (maybe this is what you meant? )

https://github.com/MetPX/sarracenia/blob/73fdf9f8bac1844534312c5c625312178e1ea273/sarracenia/flow/__init__.py#L1032-L1035

https://github.com/MetPX/sarracenia/blob/73fdf9f8bac1844534312c5c625312178e1ea273/sarracenia/flow/__init__.py#L1024-L1030

I think it would be good to try adding an after_accept plugin to the winnows to map the relPath to retrievePath, and have the relPath refer to renamed version (as described in previous post).... and see how it goes... It's a good approach because it will only affect the use case being raised, does not change things for anyone who depends on the current behaviour.

petersilva commented 4 months ago

As explained above, I don't think making rename filtering is a good approach. I added a wontfix tag express that. still there is and approach outlined above that will solve the problem without doing what the issue title asks.