From 6cd9d77a8a40bbe33a55ef0e55bcb55a9b4544cf Mon Sep 17 00:00:00 2001
From: Matthijs van der Wild <matthijs.van-der-wild@durham.ac.uk>
Date: Wed, 26 Jan 2022 12:35:12 +0000
Subject: [PATCH] Debugging first step.

---
 Docker/Dockerfile-vlbi            | 11 +++++++++--
 scripts/compareStationListVLBI.py |  3 ++-
 steps/check_station_mismatch.cwl  |  8 +++++---
 test.json                         | 16 ++++------------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/Docker/Dockerfile-vlbi b/Docker/Dockerfile-vlbi
index 7ba7f1bb..e3e948aa 100644
--- a/Docker/Dockerfile-vlbi
+++ b/Docker/Dockerfile-vlbi
@@ -3,5 +3,12 @@ FROM lofareosc/prefactor3-cwl
 RUN python3 -m pip install -Iv pyvo==0.9.3
 RUN apt-get update && \
     apt-get install -y git
-RUN git clone https://github.com/lonbar/VLBI-cwl.git /root/VLBI-cwl
-ENV PYTHONPATH=/root/VLBI-cwl/scripts/:$PYTHONPATH
+
+RUN groupadd -r lofaruser && \
+    useradd -r -l -m -g lofaruser lofaruser
+
+WORKDIR /home/lofaruser
+
+USER lofaruser
+RUN git clone https://github.com/lonbar/VLBI-cwl.git /home/lofaruser/VLBI-cwl
+ENV PYTHONPATH=/home/lofaruser/VLBI-cwl/scripts/:$PYTHONPATH
diff --git a/scripts/compareStationListVLBI.py b/scripts/compareStationListVLBI.py
index b29ee0df..d0fc8739 100644
--- a/scripts/compareStationListVLBI.py
+++ b/scripts/compareStationListVLBI.py
@@ -28,7 +28,8 @@ def plugin_main(args, **kwargs):
     filter         = kwargs['filter']
     #data           = DataMap.load(mapfile_in)
     #mslist         = [data[i].file for i in xrange(len(data))]
-    mslist         = args['mss']
+    mslist         = args #['mss']
+    print(mslist)
 
     if len(mslist) == 0:
         raise ValueError("Did not find any existing directory in input MS list!")
diff --git a/steps/check_station_mismatch.cwl b/steps/check_station_mismatch.cwl
index 474c8555..fc90ed77 100644
--- a/steps/check_station_mismatch.cwl
+++ b/steps/check_station_mismatch.cwl
@@ -33,7 +33,9 @@ requirements:
           entry: |
             import sys
             import json
-            from compareStationListVLBI import main as compareStationList
+            import os
+            print(os.environ)
+            from compareStationListVLBI import plugin_main as compareStationList
 
             mss = sys.argv[1:]
             inputs = json.loads(r"""$(inputs)""")
@@ -42,7 +44,7 @@ requirements:
             filter = inputs['filter_baselines']
             print(mss)
 
-            output = compareStationList(mss = mss, 
+            output = compareStationList(mss, 
                                         h5parmdb = h5parmdb, 
                                         solset_name = solset_name, 
                                         filter = filter)
@@ -69,7 +71,7 @@ outputs:
 
 hints:
   DockerRequirement:
-    dockerPull: vlbi-cwl
+    dockerPull: vlbi-cwl:latest
 
 stdout: compareStationMismatch.log
 stderr: compareStationMismatch_err.log
diff --git a/test.json b/test.json
index f9d2002d..6aa2493d 100644
--- a/test.json
+++ b/test.json
@@ -1,14 +1,6 @@
 {
-  "msin": {
-    "class": "Directory",
-    "path": [
-      "/home/tjlv53/test_data/L693719_SB000_uv.MS"
-    ]
-  },
-  "solset": [
-    {
-      "class": "File",
-      "path": "/home/tjlv54/test_data/P205+55/Pre-Facet-Calibrator/results/cal_values/cal_solutions.h5"
-    }
-  ]
+    "msin": [
+                {"class": "Directory", "path": "/home/tjlv53/software/VLBI-cwl/test_data/L693719_SB000_uv.MS"}
+            ],
+    "solset": {"class": "File", "path": "/home/tjlv53/software/VLBI-cwl/test_data/P205+55:Pre-Facet-Calibrator/results/cal_values/cal_solutions.h5"}
 }
-- 
GitLab