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
b58b599f
Commit
b58b599f
authored
Sep 22, 2022
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
STY: autopep'd
parent
42ca0bec
No related branches found
No related tags found
2 merge requests
!53
Release 0.1
,
!35
FIX: Fix number of arguments in main crawler function
Pipeline
#28519
failed
Sep 22, 2022
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/crawl.py
+21
-13
21 additions, 13 deletions
src/caoscrawler/crawl.py
with
21 additions
and
13 deletions
src/caoscrawler/crawl.py
+
21
−
13
View file @
b58b599f
...
@@ -823,7 +823,8 @@ class Crawler(object):
...
@@ -823,7 +823,8 @@ class Crawler(object):
if
self
.
identifiableAdapter
is
None
:
if
self
.
identifiableAdapter
is
None
:
raise
RuntimeError
(
"
Should not happen.
"
)
raise
RuntimeError
(
"
Should not happen.
"
)
to_be_inserted
,
to_be_updated
=
self
.
split_into_inserts_and_updates
(
target_data
)
to_be_inserted
,
to_be_updated
=
self
.
split_into_inserts_and_updates
(
target_data
)
# TODO: refactoring of typo
# TODO: refactoring of typo
for
el
in
to_be_updated
:
for
el
in
to_be_updated
:
...
@@ -831,14 +832,17 @@ class Crawler(object):
...
@@ -831,14 +832,17 @@ class Crawler(object):
self
.
replace_entities_with_ids
(
el
)
self
.
replace_entities_with_ids
(
el
)
identified_records
=
[
identified_records
=
[
self
.
identifiableAdapter
.
retrieve_identified_record_for_record
(
record
)
self
.
identifiableAdapter
.
retrieve_identified_record_for_record
(
record
)
for
record
in
to_be_updated
]
for
record
in
to_be_updated
]
# remove unnecessary updates from list by comparing the target records to the existing ones
# remove unnecessary updates from list by comparing the target records to the existing ones
self
.
remove_unnecessary_updates
(
to_be_updated
,
identified_records
)
self
.
remove_unnecessary_updates
(
to_be_updated
,
identified_records
)
if
commit_changes
:
if
commit_changes
:
self
.
execute_inserts_in_list
(
to_be_inserted
,
self
.
securityMode
,
self
.
run_id
)
self
.
execute_inserts_in_list
(
self
.
execute_updates_in_list
(
to_be_updated
,
self
.
securityMode
,
self
.
run_id
)
to_be_inserted
,
self
.
securityMode
,
self
.
run_id
)
self
.
execute_updates_in_list
(
to_be_updated
,
self
.
securityMode
,
self
.
run_id
)
update_cache
=
UpdateCache
()
update_cache
=
UpdateCache
()
pending_inserts
=
update_cache
.
get_inserts
(
self
.
run_id
)
pending_inserts
=
update_cache
.
get_inserts
(
self
.
run_id
)
...
@@ -859,7 +863,8 @@ class Crawler(object):
...
@@ -859,7 +863,8 @@ class Crawler(object):
# only done in SSS mode
# only done in SSS mode
if
"
SHARED_DIR
"
in
os
.
environ
:
if
"
SHARED_DIR
"
in
os
.
environ
:
filename
=
OldCrawler
.
save_form
([
el
[
3
]
for
el
in
pending_changes
],
path
,
run_id
)
filename
=
OldCrawler
.
save_form
(
[
el
[
3
]
for
el
in
pending_changes
],
path
,
run_id
)
OldCrawler
.
send_mail
([
el
[
3
]
for
el
in
pending_changes
],
filename
)
OldCrawler
.
send_mail
([
el
[
3
]
for
el
in
pending_changes
],
filename
)
for
i
,
el
in
enumerate
(
pending_changes
):
for
i
,
el
in
enumerate
(
pending_changes
):
...
@@ -870,7 +875,8 @@ UNAUTHORIZED UPDATE ({} of {}):
...
@@ -870,7 +875,8 @@ UNAUTHORIZED UPDATE ({} of {}):
____________________
\n
"""
.
format
(
i
+
1
,
len
(
pending_changes
))
+
str
(
el
[
3
]))
____________________
\n
"""
.
format
(
i
+
1
,
len
(
pending_changes
))
+
str
(
el
[
3
]))
logger
.
info
(
"
There were unauthorized changes (see above). An
"
logger
.
info
(
"
There were unauthorized changes (see above). An
"
"
email was sent to the curator.
\n
"
"
email was sent to the curator.
\n
"
"
You can authorize the
"
+
(
"
inserts
"
if
inserts
else
"
updates
"
)
"
You can authorize the
"
+
(
"
inserts
"
if
inserts
else
"
updates
"
)
+
"
by invoking the crawler
"
+
"
by invoking the crawler
"
"
with the run id: {rid}
\n
"
.
format
(
rid
=
run_id
))
"
with the run id: {rid}
\n
"
.
format
(
rid
=
run_id
))
...
@@ -1121,6 +1127,7 @@ def parse_args():
...
@@ -1121,6 +1127,7 @@ def parse_args():
return
parser
.
parse_args
()
return
parser
.
parse_args
()
def
main
():
def
main
():
args
=
parse_args
()
args
=
parse_args
()
...
@@ -1147,5 +1154,6 @@ def main():
...
@@ -1147,5 +1154,6 @@ def main():
"
update
"
:
SecurityMode
.
UPDATE
}[
args
.
security_mode
]
"
update
"
:
SecurityMode
.
UPDATE
}[
args
.
security_mode
]
))
))
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
main
()
main
()
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