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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
27b48678
Commit
27b48678
authored
May 21, 2024
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
DOC: more comments in sync_graph
parent
2e7cdaa5
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!167
Sync Graph
Pipeline
#51246
failed
May 21, 2024
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/sync_graph.py
+13
-5
13 additions, 5 deletions
src/caoscrawler/sync_graph.py
with
13 additions
and
5 deletions
src/caoscrawler/sync_graph.py
+
13
−
5
View file @
27b48678
...
...
@@ -217,6 +217,8 @@ class SyncGraph():
Since the result is returned in form of two lists, one with Entities that have a valid ID
one with those that haven
'
t, an error is raised if there are any SyncNodes without an
(possibly negative) ID.
Last review by Alexander Schlemmer on 2024-05-24.
"""
# TODO reactivate once the implementation is appropriate
# if len(self.unchecked) > 1:
...
...
@@ -472,7 +474,10 @@ class SyncGraph():
def
_remove_non_identifiables
(
self
):
"""
A path or an ID is sufficiently identifying. Thus, those entities can be marked as
checked
"""
checked
Last review by Alexander Schlemmer on 2024-05-24.
"""
for
node
in
list
(
self
.
nodes
[::
-
1
]):
if
"
nonidentifiable
"
in
[
p
.
name
for
p
in
node
.
registered_identifiable
.
properties
]:
self
.
unchecked
.
remove
(
node
)
...
...
@@ -569,7 +574,7 @@ class SyncGraph():
# - mark existing
# - mark missing
# - merge
# For each dependen
d
node, we check whether this allows to create an identifiable
# For each dependen
t
node, we check whether this allows to create an identifiable
for
other_node
in
self
.
_get_nodes_whose_identity_relies_on
(
target
):
if
self
.
_identifiable_is_needed
(
other_node
):
self
.
_set_identifiable_of_node
(
other_node
)
...
...
@@ -593,14 +598,16 @@ class SyncGraph():
entities
=
self
.
_create_flat_list
(
entities
)
se_lookup
:
dict
[
int
,
SyncNode
]
=
{}
# lookup: python id -> SyncNode
#
# Create new sync nodes from the list of entities, their registered identifiables
# are set from the identifiable adapter.
for
el
in
entities
:
self
.
nodes
.
append
(
SyncNode
(
el
,
self
.
identifiableAdapter
.
get_registered_identifiable
(
el
)))
se_lookup
[
id
(
el
)]
=
self
.
nodes
[
-
1
]
# replace db.Entity objects with SyncNodes in references:
for
node
in
self
.
nodes
:
# replace db.Entity objects with SyncNodes in references
_set_each_scalar_value
(
node
,
condition
=
lambda
val
:
id
(
val
)
in
se_lookup
,
value
=
lambda
val
:
se_lookup
[
id
(
val
)])
...
...
@@ -621,7 +628,8 @@ class SyncGraph():
for
other_node
in
self
.
_get_nodes_whose_identity_relies_on
(
node
):
if
self
.
_identifiable_is_needed
(
other_node
):
self
.
_set_identifiable_of_node
(
other_node
)
# For each dependend node, we set the ID to None (missing)
# For each dependent node, we set the ID to None (missing)
# (None is the default second argument of set_id_of_node.)
for
other_node
in
self
.
_get_nodes_whose_identity_relies_on
(
node
):
if
other_node
in
self
.
unchecked
:
print
(
f
"
set
\n
{
other_node
}
\n
to missing due to missing
\n
{
node
}
"
)
...
...
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