From f42c16ddfcf735f8a0af2d817b2568c49324aaba Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Thu, 14 Apr 2016 19:45:11 +0000
Subject: [PATCH] Task #8437: Allow multithreading in imager_awimager

---
 CEP/Pipeline/recipes/sip/master/imager_awimager.py | 10 +++++++++-
 CEP/Pipeline/recipes/sip/tasks.cfg.in              |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/CEP/Pipeline/recipes/sip/master/imager_awimager.py b/CEP/Pipeline/recipes/sip/master/imager_awimager.py
index 90bda7e4d31..ef8c926e061 100644
--- a/CEP/Pipeline/recipes/sip/master/imager_awimager.py
+++ b/CEP/Pipeline/recipes/sip/master/imager_awimager.py
@@ -38,6 +38,11 @@ class imager_awimager(BaseRecipe, RemoteCommandRecipeMixIn):
             '-p', '--parset',
             help = "The full path to a awimager configuration parset."
         ),
+        'nthreads': ingredient.IntField(
+            '--nthreads',
+            default=8,
+            help="Number of threads per process"
+        ),
         'working_directory': ingredient.StringField(
             '-w', '--working-directory',
             help = "Working directory used on output nodes. Results location"
@@ -144,7 +149,10 @@ class imager_awimager(BaseRecipe, RemoteCommandRecipeMixIn):
                          self.inputs['fov'],
                          ]
 
-            jobs.append(ComputeJob(host, node_command, arguments))
+            jobs.append(ComputeJob(host, node_command, arguments,
+                    resources={
+                        "cores": self.inputs['nthreads']
+                    }))
         self._schedule_jobs(jobs)
 
         # *********************************************************************
diff --git a/CEP/Pipeline/recipes/sip/tasks.cfg.in b/CEP/Pipeline/recipes/sip/tasks.cfg.in
index 5d6d46b8fb8..0cb43042787 100644
--- a/CEP/Pipeline/recipes/sip/tasks.cfg.in
+++ b/CEP/Pipeline/recipes/sip/tasks.cfg.in
@@ -77,6 +77,7 @@ nthreads = 8
 [imager_awimager]
 recipe = imager_awimager
 executable = %(lofarroot)s/bin/awimager
+nthreads = 8
 
 [imager_create_dbs]
 recipe = imager_create_dbs
-- 
GitLab