From 8982daa4e480f961587341de65a0346fac7037e6 Mon Sep 17 00:00:00 2001
From: Sylvester Joosten <sjoosten@anl.gov>
Date: Tue, 10 Nov 2020 18:46:55 +0000
Subject: [PATCH] Added script to download event generator samples. TODO: still
 need to generalize/polish the script

---
 .gitlab-ci.yml          |  1 -
 dis/config.yml          |  3 ---
 dummy/config.yml        |  3 ---
 util/download_events.sh | 45 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 45 insertions(+), 7 deletions(-)
 create mode 100755 util/download_events.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ce9e8a98..af0fc143 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,7 +7,6 @@ default:
     expire_in: 3 days
 
 stages:
-  - init
   - generate
   - process
   - analyze
diff --git a/dis/config.yml b/dis/config.yml
index 0e7aa279..ac6797a1 100644
--- a/dis/config.yml
+++ b/dis/config.yml
@@ -1,20 +1,17 @@
 dis:dummy_test:
   stage: analyze
-  needs: ["detector"]
   timeout: 1 hours
   script:
     - dis/dummy_test.sh
 
 dis:dummy_test2:
   stage: analyze
-  needs: ["detector"]
   timeout: 1 hours
   script:
     - dis/dummy_test2.sh
 
 dis:dummy_fail_test:
   stage: analyze
-  needs: ["detector"]
   timeout: 1 hours
   allow_failure: true
   script:
diff --git a/dummy/config.yml b/dummy/config.yml
index 682fd84e..80e0b60a 100644
--- a/dummy/config.yml
+++ b/dummy/config.yml
@@ -1,20 +1,17 @@
 dummy:dummy_test:
   stage: analyze
-  needs: ["detector"]
   timeout: 1 hours
   script:
     - dummy/dummy_test.sh
 
 dummy:dummy_test2:
   stage: analyze
-  needs: ["detector"]
   timeout: 1 hours
   script:
     - dummy/dummy_test2.sh
 
 dummy:dummy_fail_test:
   stage: analyze
-  needs: ["detector"]
   timeout: 1 hours
   allow_failure: true
   script:
diff --git a/util/download_events.sh b/util/download_events.sh
new file mode 100755
index 00000000..9abecf64
--- /dev/null
+++ b/util/download_events.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+## Init the environment
+source config/env.sh
+
+## Generates different configurations from the master configuration
+## for both electron and muon decay channels
+
+echo "Download generator artifacts for one or more of the physics processes"
+
+PROCS=()
+BRANCH="dvmp"
+
+while [ $# -gt 0 ]
+do
+  key="$1"
+  case $key in
+    -p|--process)
+      PROCS+=("$2")
+      shift # past argument
+      shift # past value
+      ;;
+    --branch)
+      BRANCH="$2"
+      shift # past argument
+      shift # past value
+      ;;
+    *)    # unknown option
+      echo "unknown option"
+      exit 1
+      ;;
+  esac
+done
+
+if [ ${#PROCS[@]} -eq 0 ]; then
+  echo "ERROR: need one or more processes: -p <process name> "
+  exit 1
+fi
+
+for proc in ${PROCS[@]}; do
+  echo "Dowloading artifacts for $proc (branch: $BRANCH)"
+  wget https://eicweb.phy.anl.gov/EIC/benchmarks/physics_benchmarks/-/jobs/artifacts/$BRANCH/download?job=${proc}:jpsi_central:generate -O results.zip
+  unzip -u results.zip
+  rm results.zip
+done
-- 
GitLab