Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce Editor Lock for Write, Append, and Upload Operations in DataNode #2122

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

PrakharJain1509
Copy link

@PrakharJain1509 PrakharJain1509 commented Oct 21, 2024

PR Description

Title: Enforce Editor Lock for Write, Append, and Upload Operations in DataNode

Summary

This PR addresses the issue #2017 where a DataNode could be modified by other editors despite being locked by one. It ensures that once a DataNode is locked with an editor_id, no other editor can perform write, append, or upload operations until the lock is released.

Changes Implemented

  • Modified the write(), append(), and _upload() methods:
    • Enforced locking mechanism to prevent unauthorized modifications by other editors.
    • Raised DataNodeIsBeingEdited exception when a different editor attempts to modify the locked DataNode.
    • Allowed orchestrator writes without editor_id even during an active lock.
  • Updated unit tests in:
    • test_data_node.py to validate the new behavior.
  • Ensured 90% code coverage on all modified methods.

Acceptance Criteria Met

  • Locking mechanism for write, append, and upload is now enforced as expected.
  • Orchestrator writes remain allowed without editor_id.
  • All relevant tests pass with the required code coverage.

This PR ensures consistent locking behavior across all relevant operations in line with the documentation and expected usage.

@PrakharJain1509
Copy link
Author

PrakharJain1509 commented Oct 21, 2024

Hey, @FlorianJacta and @bobbyshermi
I have created this PR addressing all the changes asked, Please review it and let me know if any changes are required.

if self.id not in in_memory_storage:
in_memory_storage[self.id] = []

in_memory_storage[self.id].append(data) # Append new data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the previous data of the data node has no append method.
In other words, what if in_memory_storage[self.id] has no append method?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I added a if instance condition to resolve that. Please review it and let me know if any changes required.

@jrobinAV jrobinAV added Core Related to Taipy Core 🟧 Priority: High Must be addressed as soon Core: Data node labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core: Data node Core Related to Taipy Core 🟧 Priority: High Must be addressed as soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants