Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mutalyzer
mutalyzer2
Commits
caec8e66
Commit
caec8e66
authored
Nov 09, 2015
by
Vermaat
Browse files
Merge pull request #119 from mutalyzer/optional_email
Made e-mail address optional in batch checker website interface.
parents
03cb9bb3
11aaf9fc
Changes
7
Hide whitespace changes
Inline
Side-by-side
doc/config.rst
View file @
caec8e66
...
...
@@ -58,12 +58,17 @@ not set by default.
.. _config-email:
EMAIL
The email address used in contact information on the website, as sender in
batch job notifications, and in communication with the NCBI webservices
using Entrez.
The email address used in contact information on the website and sent with
NCBI Entrez calls.
`Default value:` ``mutalyzer@humgen.nl``
BATCH_NOTIFICATION_EMAIL
The email address used as sender in batch job notifications. If set to
`None`, the value of :ref:`EMAIL <config-email>` will be used.
`Default value:` `None`
.. _config-debug:
DEBUG
...
...
mutalyzer/Scheduler.py
View file @
caec8e66
...
...
@@ -98,14 +98,15 @@ class Scheduler() :
if
settings
.
TESTING
:
return
# Mail is set to '<IP ADDRESS>@
webservice
' if the batch job
was
# submitted
using the webservice
without specifying an email address.
if
mailTo
.
endswith
(
'
@webservice
'
):
# Mail is set to '<IP ADDRESS>@
<INTERFACE>.mutalyzer
' if the batch job
#
was
submitted without specifying an email address.
if
mailTo
.
endswith
(
'
.mutalyzer
'
):
return
#TODO: Handle Connection errors in a try, except clause
#Expected errors: socket.error
from_address
=
settings
.
BATCH_NOTIFICATION_EMAIL
or
settings
.
EMAIL
download_url
=
website
.
url_for
(
'batch_job_result'
,
result_id
=
result_id
)
...
...
@@ -123,7 +124,7 @@ With kind regards,
Mutalyzer batch scheduler"""
%
download_url
)
message
[
"Subject"
]
=
"Result of your Mutalyzer batch job"
message
[
"From"
]
=
settings
.
EMAIL
message
[
"From"
]
=
from_address
message
[
"To"
]
=
mailTo
try
:
...
...
@@ -138,7 +139,7 @@ Mutalyzer batch scheduler""" % download_url)
return
try
:
smtpInstance
.
sendmail
(
settings
.
EMAIL
,
mailTo
,
message
.
as_string
())
smtpInstance
.
sendmail
(
from_address
,
mailTo
,
message
.
as_string
())
except
smtplib
.
SMTPRecipientsRefused
as
e
:
for
address
,
(
code
,
error
)
in
e
.
recipients
.
items
():
print
'Could not send email to %s: (%s) %s'
%
(
address
,
...
...
mutalyzer/config/default_settings.py
View file @
caec8e66
...
...
@@ -13,11 +13,14 @@ DEBUG = False
# We are running unit tests.
TESTING
=
False
# This address is used in contact information on the website, as sender in
# batch job notifications, and with retrieval of records at the NCBI using
# Entrez.
# This email address is used in contact information on the website and sent
# with NCBI Entrez calls.
EMAIL
=
'mutalyzer@humgen.nl'
# This email address is used as sender in batch job notifications. If `None`,
# the value of `EMAIL` will be used.
BATCH_NOTIFICATION_EMAIL
=
None
# The cache directory. Used to store uploaded and downloaded files (e.g.,
# reference files from NCBI or user) and batch job results.
CACHE_DIR
=
'/tmp'
...
...
mutalyzer/services/rpc.py
View file @
caec8e66
...
...
@@ -155,7 +155,7 @@ class MutalyzerService(ServiceBase):
address
=
unicode
(
ctx
.
transport
.
req_env
[
'REMOTE_ADDR'
])
except
(
AttributeError
,
KeyError
):
address
=
'localhost'
email
=
'%s@webservice'
%
address
email
=
'%s@webservice
.mutalyzer
'
%
address
result_id
=
scheduler
.
addJob
(
email
,
job
,
columns
,
batch_types
[
process
],
argument
)
...
...
mutalyzer/website/templates/batch-job-progress.html
View file @
caec8e66
...
...
@@ -8,11 +8,14 @@
{% if result_id %}
<div
id=
"if_items_left"
{%
if
not
items_left
%}
style=
"display:none"
{%
endif
%}
>
<p>
Your job is in progress with
<span
id=
"items_left"
>
{{ items_left }}
</span>
items remaining.
</p>
<p>
You will receive an email when the job is finished.
</p>
<p>
Your job is in progress with
<strong><span
id=
"items_left"
>
{{ items_left }}
</span>
items remaining
</strong>
.
</p>
<p>
Please note that your jobs are processed in order of submission,
meaning you will not see any progress on this job until all your earlier
jobs have finished.
</p>
<p>
If you specified your email address, you will receive an email when the
job is finished. You can also bookmark
<a
href=
"{{
url_for('.batch_job_progress', result_id=result_id) }}"
>
this page
</a>
to
download your results later.
</p>
</div>
<div
id=
"ifnot_items_left"
{%
if
items_left
%}
style=
"display:none"
{%
endif
%}
>
<p>
Your job is finished, please download the results:
...
...
mutalyzer/website/templates/batch-jobs.html
View file @
caec8e66
...
...
@@ -37,10 +37,11 @@
</div>
<div
class=
"form-group"
>
<label
for=
"email"
>
Email address
</label>
<input
name=
"email"
id=
"email"
type=
"email"
class=
"form-control with-mailcheck"
<label
for=
"email"
>
Email address (optional)
</label>
<input
name=
"email"
id=
"email"
type=
"email"
class=
"form-control with-mailcheck"
placeholder=
"Email address (notification will be sent here)"
required
value=
"{{ email }}"
>
value=
"{{ email }}"
>
</div>
<div
class=
"form-group"
>
...
...
mutalyzer/website/views.py
View file @
caec8e66
...
...
@@ -907,7 +907,7 @@ def batch_jobs_submit():
errors
=
[]
if
not
email
:
e
rrors
.
append
(
'Please provide an email address.'
)
e
mail
=
'{}@website.mutalyzer'
.
format
(
request
.
remote_addr
)
if
job_type
not
in
BATCH_JOB_TYPES
:
errors
.
append
(
'Invalid batch job type.'
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment