From dd2ed96316eb036d242a990956078b6843180ceb Mon Sep 17 00:00:00 2001
From: Timo Millenaar <tmillenaar@gmail.com>
Date: Thu, 21 Nov 2024 09:56:52 +0100
Subject: [PATCH] Change numberOfCorrelatedDataProducts to represent the number
 of measurement sets in the task abd not be hardcoded to one

---
 compress_pipeline.cwl              | 16 ++++++++++++----
 download_and_compress_pipeline.cwl |  4 ++++
 steps/extract_sip_meta.cwl         |  5 ++++-
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/compress_pipeline.cwl b/compress_pipeline.cwl
index 41634ee..d55e014 100644
--- a/compress_pipeline.cwl
+++ b/compress_pipeline.cwl
@@ -16,6 +16,10 @@ inputs:
   type: boolean?
 - id: msin
   type: Directory
+- id: msin_files
+  type: string[]
+- id: ms_count
+  type: int
 
 outputs:
 - id: inspect
@@ -110,12 +114,16 @@ steps:
 - id: extract_sip_meta
   in:
   - id: msin
-    source: 
+    source:
     - dppp/msout
     - msin
     pickValue: first_non_null
   - id: compressed_file
     source: compress/compressed
+  - id: msin_files
+    source: msin_files
+  - id: ms_count
+    source: ms_count
   - id: skip
     source: identify_issues/skip_compress
   when: $(inputs.skip == false)
@@ -174,7 +182,7 @@ steps:
   label: compress
   in:
   - id: directory
-    source: 
+    source:
     - dppp/msout
     - msin
     pickValue: first_non_null
@@ -187,12 +195,12 @@ steps:
 - id: inspect_step
   in:
   - id: msin
-    source: 
+    source:
     - dppp/msout
     - msin
     pickValue: first_non_null
   - id: inspect_file_name
-    source: 
+    source:
     - dppp/msout
     - msin
     pickValue: first_non_null
diff --git a/download_and_compress_pipeline.cwl b/download_and_compress_pipeline.cwl
index 6ad92e4..6cfb692 100644
--- a/download_and_compress_pipeline.cwl
+++ b/download_and_compress_pipeline.cwl
@@ -67,6 +67,10 @@ steps:
     source: flag_autocorrelation
   - id: is_long_baseline
     source: is_long_baseline
+  - id: msin_files
+    source: surls
+  - id: ms_count
+    valueFrom: $(inputs.msin_files.length)
   scatter:
   - msin
   run: ./compress_pipeline.cwl
diff --git a/steps/extract_sip_meta.cwl b/steps/extract_sip_meta.cwl
index cf84cdb..6b387cf 100644
--- a/steps/extract_sip_meta.cwl
+++ b/steps/extract_sip_meta.cwl
@@ -13,6 +13,9 @@ inputs:
     type: File
     inputBinding:
       position: 1
+  - id: ms_count
+    type: int
+
 outputs:
   - id: ingest
     type: Any
@@ -47,7 +50,7 @@ requirements:
             "timeIntegrationStep": "1",
             "flagAutoCorrelations": "true",
             "frequencyIntegrationStep": "1",
-            "numberOfCorrelatedDataProducts": "1"
+            "numberOfCorrelatedDataProducts": $(inputs.ms_count),
           }
          }
      - entryname: dataproduct.json
-- 
GitLab