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
e2c34f31
Commit
e2c34f31
authored
4 years ago
by
Henrik tom Wörden
Committed by
Florian Spreckelsen
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Catch FileNotFoundErrors that occur during crawling
parent
90a2b9ac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
Release 0.3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
integrationtests/test.sh
+5
-1
5 additions, 1 deletion
integrationtests/test.sh
src/caosadvancedtools/crawler.py
+13
-0
13 additions, 0 deletions
src/caosadvancedtools/crawler.py
with
19 additions
and
1 deletion
CHANGELOG.md
+
1
−
0
View file @
e2c34f31
...
...
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ###
-
Error handling for missing files when using the crawler
-
included the scifolder module
-
included the caosmodels module
*
`send_mail`
function in
`caosadvancedtools.serverside.helper`
module
...
...
This diff is collapsed.
Click to expand it.
integrationtests/test.sh
+
5
−
1
View file @
e2c34f31
...
...
@@ -19,9 +19,13 @@ python3 -m pytest test_crawler_with_cfoods.py
echo
"make a change"
pushd
extroot
egrep
-liRZ
'A description of another example'
.
| xargs
-0
-l
sed
-i
-e
's/A description of another example/A description of this example/g'
# remove a file to check that this does not lead to a crawler crash
mv
DataAnalysis/2010_TestProject/2019-02-03_something/README.xlsx DataAnalysis/2010_TestProject/2019-02-03_something/README.xlsx_back
popd
echo
"run crawler"
./crawl.py / &>
$OUT
./crawl.py / |
tee
$OUT
# rename the moved file
mv
extroot/DataAnalysis/2010_TestProject/2019-02-03_something/README.xlsx_back extroot/DataAnalysis/2010_TestProject/2019-02-03_something/README.xlsx
# check whether there was something UNAUTHORIZED
set
-e
grep
"There where unauthorized changes"
$OUT
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/crawler.py
+
13
−
0
View file @
e2c34f31
...
...
@@ -196,6 +196,9 @@ class Crawler(object):
logger
.
debug
(
"
{} matched
\n
{}.
"
.
format
(
Cfood
.
__name__
,
item
))
except
FileNotFoundError
as
e
:
logger
.
info
(
"
Cannot access {}. However, it might be needed for
"
"
the correct execution
"
.
format
(
e
.
filename
))
except
DataInconsistencyError
as
e
:
logger
.
debug
(
traceback
.
format_exc
())
logger
.
debug
(
e
)
...
...
@@ -227,6 +230,10 @@ class Crawler(object):
logger
.
debug
(
traceback
.
format_exc
())
logger
.
debug
(
e
)
remove_cfoods
.
append
(
cfood
)
except
FileNotFoundError
as
e
:
logger
.
info
(
"
Cannot access {}. However, it might be needed for
"
"
the correct execution
"
.
format
(
e
.
filename
))
remove_cfoods
.
append
(
cfood
)
except
Exception
as
e
:
try
:
DataModelProblems
.
evaluate_exception
(
e
)
...
...
@@ -313,6 +320,9 @@ class Crawler(object):
cfood
.
update_identifiables
()
self
.
push_identifiables_to_CaosDB
(
cfood
)
except
FileNotFoundError
as
e
:
logger
.
info
(
"
Cannot access {}. However, it might be needed for
"
"
the correct execution
"
.
format
(
e
.
filename
))
except
DataInconsistencyError
as
e
:
logger
.
debug
(
traceback
.
format_exc
())
logger
.
debug
(
e
)
...
...
@@ -534,6 +544,9 @@ carefully and if the changes are ok, click on the following link:
logger
.
debug
(
cfood
.
to_be_updated
)
try
:
guard
.
safe_update
(
cfood
.
to_be_updated
,
unique
=
False
)
except
FileNotFoundError
as
e
:
logger
.
info
(
"
Cannot access {}. However, it might be needed for
"
"
the correct execution
"
.
format
(
e
.
filename
))
except
ProhibitedException
:
try
:
self
.
update_cache
.
insert
(
cfood
.
to_be_updated
,
self
.
run_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