Add Python example for thread-safe Define using rdfslot_#21798
Add Python example for thread-safe Define using rdfslot_#21798gayatripadalia wants to merge 2 commits intoroot-project:masterfrom
Conversation
Adds a tutorial demonstrating a thread-safe pattern in Python using rdfslot_, as a workaround for DefineSlot which is not available in Python. Closes root-project#20839
vepadulano
left a comment
There was a problem hiding this comment.
Dear @gayatripadalia ,
Thanks for attempting to increase the coverage of our suite of tutorials! The need to have more thread-safe examples is understood. Nonetheless, this PR does not contribute enough in that direction. Your example does not use the rdfslot_ implicit column in any meaningful manner, and it does not include examples of DefineSlot with comments motivating why that operation would be needed.
Improve rdfslot_ tutorial with thread-safe use cases.
|
Dear @vepadulano, |
Summary
This PR adds a Python tutorial demonstrating thread-safe patterns in ROOT RDataFrame using
rdfslot_.In C++, ROOT provides
DefineSlotandRedefineSlotfor thread-safe operations by exposing the slot index to user-defined callables. These APIs are currently not available in PyROOT.This tutorial shows how to reproduce the same behavior in Python by explicitly forwarding
rdfslot_, enabling safe and lock-free access to per-slot resources in multi-threaded workflows.Motivation
Issue #20839 highlights the lack of Python examples for thread-safe operations similar to
DefineSlot.This contribution provides a practical Python example of slot-based computation and demonstrates safe usage of mutable state in multi-threaded RDataFrame workflows, reflecting the design and intent of
DefineSlotusing existing PyROOT features.Related Issue
Closes #20839