From 217abd4a378a5f77d4472e90c6fd8fb8f5fb0aac Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Mon, 2 Nov 2015 11:50:43 +0100
Subject: [PATCH] Optional email for batch jobs from webservices

---
 mutalyzer/services/rpc.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/mutalyzer/services/rpc.py b/mutalyzer/services/rpc.py
index a256831f..8281da38 100644
--- a/mutalyzer/services/rpc.py
+++ b/mutalyzer/services/rpc.py
@@ -71,14 +71,20 @@ class MutalyzerService(ServiceBase):
         super(MutalyzerService, self).__init__(environ)
     #__init__
 
-    @srpc(Mandatory.ByteArray, Unicode, Unicode, _returns=Unicode)
-    def submitBatchJob(data, process='NameChecker', argument=''):
+    @srpc(Mandatory.ByteArray, Unicode, Unicode, Unicode, _returns=Unicode)
+    def submitBatchJob(data, process='NameChecker', argument='', email=None):
         """
         Submit a batch job.
 
         Input and output file formats for batch jobs are explained on the
         website <https://mutalyzer.nl/batch>.
 
+        Batch jobs are processed using round-robin scheduling grouped by email
+        address. Per email address, jobs are processed sequentially in order
+        of submission. Jobs with no email address specified end up in a shared
+        group. This means your job is likely to be processed sooner if you
+        provide an email address.
+
         On error an exception is raised:
           - detail: Human readable description of the error.
           - faultstring: A code to indicate the type of error.
@@ -90,6 +96,8 @@ class MutalyzerService(ServiceBase):
             (default), SyntaxChecker, PositionConverter, SnpConverter.
         @arg argument: Additional argument. Currently only used if batch_type
             is PositionConverter, denoting the human genome build.
+        @arg email: Optional email address. Notification of job completion
+            will be sent to this address.
 
         @return: Batch job identifier.
         """
@@ -139,7 +147,7 @@ class MutalyzerService(ServiceBase):
         if job is None:
             raise Fault('EPARSE', 'Could not parse input file, please check your file format.')
 
-        result_id = scheduler.addJob('job@webservice', job, columns,
+        result_id = scheduler.addJob(email or 'job@webservice', job, columns,
                                      batch_types[process], argument)
         return result_id
 
-- 
GitLab