Skip to content
Snippets Groups Projects
download_events.sh 1.58 KiB
Newer Older
  • Learn to ignore specific revisions
  • #!/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"
    
    
    Sylvester Joosten's avatar
    Sylvester Joosten committed
    function print_the_help {
      echo "USAGE:    $0 [-c config [[-c config ...]] script1 [script2...]"
      echo "OPTIONS:"
      echo "          -p,--process  Physics process name (can be defined multiple
      times)."
      echo "          -b,--branch   Git branch to download artifacts from (D:
      $BRANCH)"
      echo "          -h,--help     Print this message"
      echo ""
      echo "  This script will download the relevant generator artifacts needed"
      echo "  for local testing of the benchmarks."
      exit
    }
    
    
    
    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
          ;;
    
    Sylvester Joosten's avatar
    Sylvester Joosten committed
        -h|--help)
          print_the_help
          shift
          ;;
    
        *)    # 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
    
    Sylvester Joosten's avatar
    Sylvester Joosten committed
      echo "Unpacking artifacts..."
    
    Sylvester Joosten's avatar
    Sylvester Joosten committed
      echo "Cleaning up..."
    
    Sylvester Joosten's avatar
    Sylvester Joosten committed
    echo "All done"