Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hattivatti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GDP-Public
hattivatti
Commits
c1b6d984
Commit
c1b6d984
authored
1 year ago
by
Benjamin Wingfield
Browse files
Options
Downloads
Patches
Plain Diff
remove curl transfer
parent
10a98a5f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
data/templates/env_vars.txt
+0
-4
0 additions, 4 deletions
data/templates/env_vars.txt
data/transfer/transfer.sh
+0
-64
0 additions, 64 deletions
data/transfer/transfer.sh
with
0 additions
and
68 deletions
data/templates/env_vars.txt
+
0
−
4
View file @
c1b6d984
...
...
@@ -8,9 +8,5 @@ export NXF_EXECUTOR=local
export NXF_WORK=$TMPDIR/work
export NXF_HOME=$TMPDIR/home
export CAPSULE_LOG=none
# transfer.sh configuration
export GLOBUS_BASE_URL={globus_base_url}
export GLOBUS_GUEST_COLLECTION_ID={guest_collection_id}
export JOB_MESSAGE='{message}'
# ------------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
data/transfer/transfer.sh
deleted
100644 → 0
+
0
−
64
View file @
10a98a5f
#!/usr/bin/env bash
set
-euxo
pipefail
# A simple way to download a set of files from an INTERVENE globus collection
# using curl and HTTPS. Doesn't retry, resume, or do anything fancy.
# All configuration is done with environment variables.
# This script is kept here as a reference when deploying hattivatti to Puhti.
check_environment_variables
()
{
# GLOBUS_BASE_URL https://docs.globus.org/globus-connect-server/v5/https-access-collections/#determining_the_collection_https_base_url
# GLOBUS_SECRET_TOKEN: globus sdk client token
# GLOBUS_GUEST_COLLECTION_ID: uuid, from message
# JOB_MESSAGE: a validated JSON message sent by the backend
env_vars
=(
"GLOBUS_BASE_URL"
"GLOBUS_SECRET_TOKEN"
"GLOBUS_GUEST_COLLECTION_ID"
"JOB_MESSAGE"
)
for
var
in
"
${
env_vars
[@]
}
"
;
do
echo
"Checking environment variable
$var
"
# print indirect reference, only errors correctly with set -u
echo
"
${
!var
}
OK"
done
}
grab_access_token
()
{
GLOBUS_ACCESS_TOKEN
=
$(
curl
-s
-X
POST
-H
"Authorization: Basic
$GLOBUS_SECRET_TOKEN
"
\
-d
"scope=https://auth.globus.org/scopes/
$GLOBUS_GUEST_COLLECTION_ID
/https&grant_type=client_credentials"
\
https://auth.globus.org/v2/oauth2/token
\
| jq
-r
'.access_token'
)
}
download_files
()
{
GLOBUS_HEADER
=
"
\"
Authorization: Bearer
$GLOBUS_ACCESS_TOKEN
\"
"
# step 1: extract a list of file names and extensions from the job message
# e.g. test.pgen
FILE_PATHS
=
$(
mktemp
)
jq
-r
'.pipeline_param.target_genomes[] | (.pgen, .pvar, .psam)'
<
(
echo
"
$JOB_MESSAGE
"
)
>
$FILE_PATHS
DIRECTORY
=
$(
echo
$JOB_MESSAGE
| jq
-r
'.globus_details.dir_path_on_guest_collection + "/"'
)
CURL_CMD
=
"curl -s -f -O -L -X GET
\
-H "
$GLOBUS_HEADER
"
\
--url "
${
GLOBUS_BASE_URL
}
/
${
DIRECTORY
}
/
{
PATH
}
"
\
-w "
%
{
json
}
" >> transfer_log.json"
DOWNLOAD_PATH
=
$(
mktemp
)
# step 2: print a list of curl commands to a temporary file
xargs
-I
{
PATH
}
echo
$CURL_CMD
<
$FILE_PATHS
>
$DOWNLOAD_PATH
# step 3: run the curl commands to stage the files locally over HTTPS
source
$DOWNLOAD_PATH
}
main
()
{
# clean up old transfer logs before starting downloads
rm
-f
transfer_log.json
check_environment_variables
grab_access_token
download_files
# clean up temporary files when exiting the script
# mktemp is quite secure so not really needed, just being tidy
trap
'rm -f $FILE_PATHS $DOWNLOAD_PATH'
EXIT
}
main
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment