Add Python example for thread-safe Define using rdfslot_#21798
Open
gayatripadalia wants to merge 1 commit intoroot-project:masterfrom
Open
Add Python example for thread-safe Define using rdfslot_#21798gayatripadalia wants to merge 1 commit intoroot-project:masterfrom
gayatripadalia wants to merge 1 commit 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a Python tutorial demonstrating a thread-safe pattern
using
rdfslot_in ROOT RDataFrame.In C++, ROOT provides
DefineSlotandRedefineSlotfor thread-safeoperations. However, these APIs are currently not available in Python.
This example shows how
rdfslot_can be used as a practical and safeworkaround to achieve thread-local computation in a multi-threaded
environment.
This contribution serves as a practical Python-side alternative until native support becomes available.
Motivation
Issue #20839 highlights the lack of Python examples for thread-safe operations similar to
DefineSlot.This contribution aims to:
Changes Made
tutorials/analysis/dataframe/df_python_threadsafe_example.pyrdfslot_to identify thread/slotTesting
rdfslot_across threadsNotes for Reviewers
DefineSlot, but provides a practical alternativeRelated Issue
Closes #20839