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
b3b34c92
Commit
b3b34c92
authored
7 months ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Add missing information in ImpossibleMergeError message
parent
7d05e02f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!184
Release 0.9.1
,
!183
F improve error messages
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/sync_node.py
+31
-17
31 additions, 17 deletions
src/caoscrawler/sync_node.py
with
31 additions
and
17 deletions
src/caoscrawler/sync_node.py
+
31
−
17
View file @
b3b34c92
...
...
@@ -87,13 +87,25 @@ class SyncNode(db.Entity):
self
.
registered_identifiable
=
registered_identifiable
def
update
(
self
,
other
:
SyncNode
)
->
None
:
"""
update this node with information of given ``other`` SyncNode.
"""
Update this node with information of given ``other`` SyncNode.
parents are added if they are not yet in the list properties
are added in any case. This may lead to duplication of
properties. We allow this duplication here and remove it when
we create a db.Entity (export_entity function) because if
property values are SyncNode objects, they might not be
comparable (no ID, no identifiable) yet.
Raises
------
ValueError:
The `other` SyncNode doesn
'
t share identifiables with
`this` SyncNode, so they can
'
t be merged.
ImpossibleMergeError:
The two SyncNodes are incompatible in their attributes
like
"
id
"
,
"
role
"
,
"
path
"
,
"
file
"
,
"
name
"
, or
"
description
"
.
parents are added if they are not yet in the list
properties are added in any case. This may lead to duplication of properties.
We allow this duplication here and remove it when we create a db.Entity (export_entity
function) because if property values are SyncNode objects, they might not be comparable (no
ID, no identifiable) yet.
"""
if
other
.
identifiable
is
not
None
and
self
.
identifiable
is
not
None
:
...
...
@@ -121,8 +133,9 @@ class SyncNode(db.Entity):
f
"
Trying to update
{
attr
}
but this would lead to an
"
f
"
override of the value
'
{
self
.
__getattribute__
(
attr
)
}
'
"
f
"
by the value
'
{
other
.
__getattribute__
(
attr
)
}
'"
,
pname
=
attr
,
values
=
(
self
.
__getattribute__
(
attr
),
other
.
__getattribute__
(
attr
))
pname
=
attr
,
value_a
=
self
.
__getattribute__
(
attr
),
value_b
=
other
.
__getattribute__
(
attr
)
)
for
p
in
other
.
parents
:
if
not
parent_in_list
(
p
,
self
.
parents
):
...
...
@@ -136,6 +149,13 @@ class SyncNode(db.Entity):
Properties are only added once (based on id or name). If values do not match, an Error is
raised. If values are SyncNode objects with IDs, they are considered equal if their IDs are
equal.
Raises
------
RuntimeError:
In case of a unsupported role, so no Entity can
'
t be created.
ImpossibleMergeError:
In case of conflicting property values in this SyncNode.
"""
ent
=
None
if
self
.
role
==
"
Record
"
:
...
...
@@ -175,16 +195,10 @@ class SyncNode(db.Entity):
unequal
=
True
if
unequal
:
logger
.
error
(
"
The Crawler is trying to create an entity,
"
"
but there are conflicting property values.
"
f
"
Problematic Property:
{
p
.
name
}
\n
"
f
"
First value:
\n
{
entval
}
\n
"
f
"
Second value:
\n
{
pval
}
\n
"
f
"
{
self
}
"
)
ime
=
ImpossibleMergeError
(
"
Cannot merge Entities
"
,
pname
=
p
.
name
,
values
=
(
entval
,
pval
)
f
"
The crawler is trying to create an entity
\n\n
{
self
}
\n\n
but there are
"
"
conflicting property values.
"
,
pname
=
p
.
name
,
value_a
=
entval
,
value_b
=
pval
)
raise
ime
return
ent
...
...
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