From f3198f7a63f6ec594c9200f772431ec6f89136f7 Mon Sep 17 00:00:00 2001
From: alex <alex@tls-tautenburg.de>
Date: Tue, 21 Mar 2023 13:40:28 +0000
Subject: [PATCH] Resolve "Option for custom temporary directory for WSClean
 instead of /tmp"

---
 docs/source/target.rst             | 1 +
 workflows/HBA_target.cwl           | 4 ++++
 workflows/LBA_target.cwl           | 4 ++++
 workflows/linc_target.cwl          | 4 ++++
 workflows/linc_target/finalize.cwl | 5 ++++-
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/docs/source/target.rst b/docs/source/target.rst
index f0bc4416..8057fe69 100644
--- a/docs/source/target.rst
+++ b/docs/source/target.rst
@@ -307,6 +307,7 @@ A comprehensive explanation of the baseline selection syntax can be found `here`
 - ``aoflag_reorder``: make aoflagger reorder the measurement set before running the detection. This prevents that aoflagger will use its memory reading mode, which is faster but uses more memory (default: false, see the `AOFlagger manual`_`)
 - ``aoflag_chunksize``: this will split the set into intervals with the given maximum size, and flag each interval independently. This lowers the amount of memory required (default: 2000)
 - ``aoflag_freqconcat``: concatenate all subbands on-the-fly before performing flagging. Disable if you use time-chunked input data (see ``chunkduration``) (default: true)
+- ``wsclean_tmpdir``: Set the temporary directory of ``wsclean`` used when reordering files (default: ``/tmp``). CAUTION: This directory needs to be visible for LINC, in particular if you use Docker or Singularity.
 
 *Skymodel directory*
 
diff --git a/workflows/HBA_target.cwl b/workflows/HBA_target.cwl
index b53f3dec..dcd921fb 100644
--- a/workflows/HBA_target.cwl
+++ b/workflows/HBA_target.cwl
@@ -163,6 +163,8 @@ inputs:
   - id: chunkduration
     type: float?
     default: 0.0
+  - id: wsclean_tmpdir
+    type: string?
 outputs:
   - id: calibrated_data
     outputSource:
@@ -293,6 +295,8 @@ steps:
         source: selfcal
       - id: chunkduration
         source: chunkduration
+      - id: wsclean_tmpdir
+        source: wsclean_tmpdir
     out:
       - id: logfiles
       - id: msout
diff --git a/workflows/LBA_target.cwl b/workflows/LBA_target.cwl
index 0bbb4336..1c6f3dcb 100644
--- a/workflows/LBA_target.cwl
+++ b/workflows/LBA_target.cwl
@@ -164,6 +164,8 @@ inputs:
   - id: chunkduration
     type: float?
     default: 3600.0
+  - id: wsclean_tmpdir
+    type: string?
 outputs:
   - id: calibrated_data
     outputSource:
@@ -294,6 +296,8 @@ steps:
         source: selfcal
       - id: chunkduration
         source: chunkduration
+      - id: wsclean_tmpdir
+        source: wsclean_tmpdir
     out:
       - id: logfiles
       - id: msout
diff --git a/workflows/linc_target.cwl b/workflows/linc_target.cwl
index 1e60bbd1..cbfa5073 100644
--- a/workflows/linc_target.cwl
+++ b/workflows/linc_target.cwl
@@ -163,6 +163,8 @@ inputs:
   - id: chunkduration
     type: float?
     default: 0.0
+  - id: wsclean_tmpdir
+    type: string?
 outputs:
   - id: inspection
     outputSource:
@@ -396,6 +398,8 @@ steps:
         source: gsmcal/out_refant
       - id: targetname
         source: get_targetname/targetname
+      - id: wsclean_tmpdir
+        source: wsclean_tmpdir
     out:
       - id: msout
       - id: solutions
diff --git a/workflows/linc_target/finalize.cwl b/workflows/linc_target/finalize.cwl
index 80841ecf..cf6cb38c 100644
--- a/workflows/linc_target/finalize.cwl
+++ b/workflows/linc_target/finalize.cwl
@@ -60,6 +60,9 @@ inputs:
   - id: targetname
     type: string?
     default: 'pointing'
+  - id: wsclean_tmpdir
+    type: string?
+    default: '/tmp'
 outputs:
   - id: msout
     outputSource:
@@ -303,7 +306,7 @@ steps:
       - id: maxuvw-m
         default: 20000
       - id: tempdir
-        default: '/tmp/'
+        source: wsclean_tmpdir
       - id: image_name
         source: targetname
     out:
-- 
GitLab