diff --git a/.github/workflows/run_prod.yml b/.github/workflows/run_prod.yml index 5086696..1338d20 100644 --- a/.github/workflows/run_prod.yml +++ b/.github/workflows/run_prod.yml @@ -25,7 +25,7 @@ jobs: platform-release: "jug_xl:nightly" run: | eic-info - + # Test running hepmc3 file DETECTOR_CONFIG="epic_craterlake" \ DETECTOR_VERSION="main" \ diff --git a/.github/workflows/test_rucio.yml b/.github/workflows/test_rucio.yml new file mode 100644 index 0000000..5db1bab --- /dev/null +++ b/.github/workflows/test_rucio.yml @@ -0,0 +1,33 @@ +name: Test upload to rucio + +on: + schedule: + - cron: '0 0 1,15 * *' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + rucio-upload: + # Note: this workflow must run on linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cvmfs-contrib/github-action-cvmfs@v3 + - uses: eic/run-cvmfs-osg-eic-shell@main + env: + X509_PROXY: ${{ secrets.X509_PROXY }} + with: + platform-release: "jug_xl:nightly" + run: | + # Generate a timestamp + timestamp=$(date '+%Y-%m-%d_%H-%M-%S') + eic-info > eic-info_${timestamp}.txt + echo "${X509_PROXY}" > x509_user_proxy + + # Test rucio upload script + export X509_USER_PROXY=x509_user_proxy + RUCIO_CONFIG=scripts/rucio.cfg python scripts/register_to_rucio.py -f "eic-info_${timestamp}.txt" -d "/main/CI/Rucio/eic-info_${timestamp}.txt" -s epic + diff --git a/scripts/register_to_rucio.py b/scripts/register_to_rucio.py new file mode 100644 index 0000000..e64b92e --- /dev/null +++ b/scripts/register_to_rucio.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import argparse +import os +from rucio.client.uploadclient import UploadClient + +parser = argparse.ArgumentParser(prog='Register to RUCIO', description='Registers files to RUCIO') +parser.add_argument("-f", dest="file_path", action="store", required=True, help="Enter the local file path") +parser.add_argument("-d", dest="did_name", action="store", required=True, help="Enter the data identifier for rucio catalogue") +parser.add_argument("-s", dest="scope", action="store", required=True, help="Enter the scope") +args=parser.parse_args() + +file_path = args.file_path +did_name = args.did_name +parent_directory = os.path.dirname(did_name) +scope= args.scope +rse="EIC-XRD" + +uploads_items = [{ + 'path': file_path, + 'rse': rse, + 'did_scope': scope, + 'did_name': did_name, + 'dataset_scope': scope, + 'dataset_name': parent_directory +}] + +upload_client = UploadClient() +upload_client.upload(uploads_items) diff --git a/scripts/rucio.cfg b/scripts/rucio.cfg new file mode 100644 index 0000000..33d0dcb --- /dev/null +++ b/scripts/rucio.cfg @@ -0,0 +1,6 @@ +[client] +rucio_host = https://rucio-server.jlab.org:443 +auth_host = https://rucio-server.jlab.org:443 +auth_type = x509_proxy +client_x509_proxy = $X509_USER_PROXY +account = eicprod