Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
e50e66cb
Commit
e50e66cb
authored
1 year ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
DOC: more docstrings for the sync_graph
parent
ba7dc1e1
No related branches found
No related tags found
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!167
Sync Graph
Pipeline
#51238
failed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/sync_graph.py
+14
-2
14 additions, 2 deletions
src/caoscrawler/sync_graph.py
with
14 additions
and
2 deletions
src/caoscrawler/sync_graph.py
+
14
−
2
View file @
e50e66cb
...
...
@@ -140,8 +140,14 @@ class SyncGraph():
def
__init__
(
self
,
entities
:
list
[
db
.
Entity
],
identifiableAdapter
:
IdentifiableAdapter
):
self
.
identifiableAdapter
=
identifiableAdapter
# A dictionary allowing for quick lookup of sync nodes using their (possibly negative) IDs.
# This dictionary is initially set using _mark_entities_with_path_or_id and later updated
# using set_id_of_node.
self
.
_id_look_up
:
dict
[
Union
[
int
,
TempID
,
str
],
SyncNode
]
=
{}
# Similar as above for looking up nodes using paths:
self
.
_path_look_up
:
dict
[
str
,
SyncNode
]
=
{}
# Similar as above for looking up nodes using identifiables. This dictionary uses
# the get_representation method of Identifiable as keys.
self
.
_identifiable_look_up
:
dict
[
str
,
SyncNode
]
=
{}
self
.
_missing
:
dict
[
int
,
SyncNode
]
=
{}
self
.
_existing
:
dict
[
int
,
SyncNode
]
=
{}
...
...
@@ -179,8 +185,14 @@ class SyncGraph():
self
.
identifiableAdapter
.
check_identifying_props
(
node
)
def
set_id_of_node
(
self
,
node
:
SyncNode
,
node_id
:
Optional
[
str
]
=
None
):
"""
sets the ID attribute of the given SyncNode. If node_id is None, a negative Id will be
given indicating that the node does not exist on the remote server
"""
"""
sets the ID attribute of the given SyncNode to node_id.
If node_id is None, a negative ID will be
given indicating that the node does not exist on the remote server.
Furthermore it will be marked as missing using _mark_missing.
Last review by Alexander Schlemmer on 2024-05-24.
"""
if
node
.
id
is
not
None
:
raise
RuntimeError
(
'
Cannot update ID.
\n
'
f
'
It already is
{
node
.
id
}
and shall be set to
{
node_id
}
.
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment