Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
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-advanced-user-tools
Commits
68167ebd
Commit
68167ebd
authored
5 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: do first all the matches and then identifiables
parent
4220fc87
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosadvancedtools/crawler.py
+24
-16
24 additions, 16 deletions
src/caosadvancedtools/crawler.py
with
24 additions
and
16 deletions
src/caosadvancedtools/crawler.py
+
24
−
16
View file @
68167ebd
...
...
@@ -69,6 +69,8 @@ class Crawler(object):
self
.
cache
=
Cache
()
def
crawl
(
self
,
files
):
cfoods
=
[]
for
crawled_file
in
sorted
(
files
,
key
=
lambda
x
:
x
.
path
):
# if crawled_file.size == 0:
# crawled_file.add_message(
...
...
@@ -92,22 +94,8 @@ class Crawler(object):
if
self
.
verbose
:
print
(
"
{} matched.
"
.
format
(
Cfood
.
__name__
))
try
:
cfood
=
Cfood
(
crawled_file
,
access
=
self
.
access
,
verbose
=
self
.
verbose
)
cfood
.
create_identifiables
()
if
self
.
use_cache
:
hashes
=
self
.
cache
.
update_ids_from_cache
(
cfood
.
identifiables
)
self
.
find_or_insert_identifiables
(
cfood
.
identifiables
,
self
.
verbose
)
if
self
.
use_cache
:
self
.
cache
.
insert_list
(
hashes
,
cfood
.
identifiables
)
cfood
.
update_identifiables
()
cfood
.
push_identifiables_to_CaosDB
()
cfoods
.
append
(
Cfood
(
crawled_file
,
access
=
self
.
access
,
verbose
=
self
.
verbose
))
except
Exception
as
e
:
traceback
.
print_exc
()
print
(
e
)
...
...
@@ -118,6 +106,26 @@ class Crawler(object):
if
self
.
verbose
and
matches
>
1
:
print
(
"
Attention: More than one matching cfood!
"
)
for
cfood
in
cfoods
:
try
:
cfood
.
create_identifiables
()
if
self
.
use_cache
:
hashes
=
self
.
cache
.
update_ids_from_cache
(
cfood
.
identifiables
)
self
.
find_or_insert_identifiables
(
cfood
.
identifiables
,
self
.
verbose
)
if
self
.
use_cache
:
self
.
cache
.
insert_list
(
hashes
,
cfood
.
identifiables
)
cfood
.
update_identifiables
()
cfood
.
push_identifiables_to_CaosDB
()
except
Exception
as
e
:
traceback
.
print_exc
()
print
(
e
)
@staticmethod
def
find_or_insert_identifiables
(
identifiables
,
verbose
=
True
):
"""
Sets the ids of identifiables (that do not have already an id from the
...
...
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