Skip to content

Commit 1522663

Browse files
committed
filter data to duplicate
1 parent 7af14bd commit 1522663

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

taipy/core/data/data_node.py

+43-2
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,54 @@ def track_edit(
513513
self.edits = self._edits
514514

515515
def lock_edit(self, editor_id: Optional[str] = None):
516-
"""Lock the data node modification.
516+
"""Lock the data node modification to prevent concurrent modifications of the data node.
517+
518+
If locked by an editor, the data node cannot be modified by another editor until
519+
the lock is released or after 30 minutes (default timeout) from the last modification.
520+
If the data node is already locked by another editor, an exception is raised.
521+
522+
If no editor is provided, the data node is locked for everyone until it is unlocked
523+
with no expiration date. This is not recommended as it can lead to a deadlock.
524+
525+
It sets the editor identifier `editor_id`, the editor expiration date `editor_expiration_date`,
526+
and the edit in progress flag `edit_in_progress`.
527+
528+
??? example "Usage"
529+
530+
``` python
531+
# Locks the data node modification as a specific editor
532+
data_node.lock_edit("editor_id")
533+
```
534+
535+
To check if the data node is locked, use the property `(DataNode.)edit_in_progress^`.
536+
``` python
537+
# Returns True if the data node is locked for modification.
538+
data_node.edit_in_progress
539+
```
540+
541+
To get the editor identifier, use the property `(DataNode.)editor_id^`.
542+
``` python
543+
# Returns the editor identifier
544+
data_node.editor_id
545+
```
546+
547+
To get the editor expiration date, use the property `(DataNode.)editor_expiration_date^`.
548+
``` python
549+
# Returns the editor expiration date
550+
data_node.editor_expiration_date
551+
```
517552
518-
Note:
519553
The data node can be unlocked with the method `(DataNode.)unlock_edit()^`.
554+
``` python
555+
# Unlocks the data node modification as a specific editor
556+
data_node.unlock_edit("editor_id")
557+
```
520558
521559
Arguments:
522560
editor_id (Optional[str]): The editor's identifier.
561+
562+
Raises:
563+
DataNodeIsBeingEdited: If the data node is already locked by another editor.
523564
"""
524565
if editor_id:
525566
if (

0 commit comments

Comments
 (0)