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
9beee95e
Commit
9beee95e
authored
10 months ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-email' into 'dev'
Refactor email See merge request
!177
parents
bc144202
89f48916
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!177
Refactor email
Pipeline
#54393
passed
9 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
3
Pipelines
45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
src/caoscrawler/crawl.py
+31
-4
31 additions, 4 deletions
src/caoscrawler/crawl.py
src/doc/getting_started/optionalfeatures.rst
+7
-0
7 additions, 0 deletions
src/doc/getting_started/optionalfeatures.rst
with
39 additions
and
4 deletions
CHANGELOG.md
+
1
−
0
View file @
9beee95e
...
...
@@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
*
Better internal handling of identifiable/reference resolving and merging of entities. This also
includes more understandable output for users.
*
Better handling of missing imports, with nice messages for users.
*
No longer use configuration of advancedtools to set to and from email addresses
### Deprecated ###
...
...
This diff is collapsed.
Click to expand it.
src/caoscrawler/crawl.py
+
31
−
4
View file @
9beee95e
...
...
@@ -749,9 +749,31 @@ one with the entities that need to be updated and the other with entities to be
def
inform_about_pending_changes
(
pending_changes
,
run_id
,
path
,
inserts
=
False
):
# Sending an Email with a link to a form to authorize updates is
if
get_config_setting
(
"
send_crawler_notifications
"
):
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
)
filename
=
OldCrawler
.
save_form
([
el
[
3
]
for
el
in
pending_changes
],
path
,
run_id
)
text
=
"""
Dear Curator,
there where changes that need your authorization. Please check the following
carefully and if the changes are ok, click on the following link:
{url}/Shared/{filename}
{changes}
"""
.
format
(
url
=
db
.
configuration
.
get_config
()[
"
Connection
"
][
"
url
"
],
filename
=
filename
,
changes
=
"
\n
"
.
join
([
el
[
3
]
for
el
in
pending_changes
]))
try
:
fro
=
get_config_setting
(
"
sendmail_from_address
"
)
to
=
get_config_setting
(
"
sendmail_to_address
"
)
except
KeyError
:
logger
.
error
(
"
Server Configuration is missing a setting for
"
"
sending mails. The administrator should check
"
"'
from_mail
'
and
'
to_mail
'
.
"
)
return
send_mail
(
from_addr
=
fro
,
to
=
to
,
subject
=
"
Crawler Update
"
,
body
=
text
)
for
i
,
el
in
enumerate
(
pending_changes
):
...
...
@@ -862,6 +884,7 @@ def _notify_about_inserts_and_updates(n_inserts, n_updates, logfile, run_id):
The email contains some basic information and a link to the log and the CrawlerRun Record.
"""
if
not
get_config_setting
(
"
send_crawler_notifications
"
):
logger
.
debug
(
"
Crawler email notifications are disabled.
"
)
return
if
n_inserts
==
0
and
n_updates
==
0
:
return
...
...
@@ -872,8 +895,8 @@ the CaosDB Crawler successfully crawled the data and
"""
domain
=
get_config_setting
(
"
public_host_url
"
)
if
get_config_setting
(
"
create_crawler_status_records
"
):
domain
=
get_config_setting
(
"
public_host_url
"
)
text
+=
(
"
You can checkout the CrawlerRun Record for more information:
\n
"
f
"
{
domain
}
/Entity/?P=0L10&query=find%20crawlerrun%20with%20run_id=%27
{
run_id
}
%27
\n\n
"
)
text
+=
(
f
"
You can download the logfile here:
\n
{
domain
}
/Shared/
"
+
logfile
)
...
...
@@ -1059,6 +1082,10 @@ def crawler_main(crawled_directory_path: str,
ident
=
CaosDBIdentifiableAdapter
()
ident
.
load_from_yaml_definition
(
identifiables_definition_file
)
crawler
.
identifiableAdapter
=
ident
else
:
# TODO
# raise ValueError("An identifiable file is needed.")
pass
remove_prefix
=
_treat_deprecated_prefix
(
prefix
,
remove_prefix
)
...
...
This diff is collapsed.
Click to expand it.
src/doc/getting_started/optionalfeatures.rst
+
7
−
0
View file @
9beee95e
...
...
@@ -30,6 +30,13 @@ to decide what tool is used for sending mails (use the upper one if you
want to actually send mails. See ``sendmail`` configuration in the
LinkAhead docs.
You can even supply the name of a custom CSS file that shall be used:
.. code:: ini
[advancedtools]
crawler.customcssfile = theme-research.css
Crawler Status Records
----------------------
...
...
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