Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rucio upload script and rucio configuration file #27

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
platform-release: "jug_xl:nightly"
run: |
eic-info

# Test running hepmc3 file
DETECTOR_CONFIG="epic_craterlake" \
DETECTOR_VERSION="main" \
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test_rucio.yml
Original file line number Diff line number Diff line change
@@ -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

29 changes: 29 additions & 0 deletions scripts/register_to_rucio.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions scripts/rucio.cfg
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work when specified as an environment variable?

account = eicprod
Loading