This repository has been archived by the owner on Mar 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use d183_fix_mag to preallocate daily FASTA and BAM MAG to stop race …
…condition [#D183]
- Loading branch information
1 parent
d1d1503
commit 45ae743
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
# Garbage script for a garbage plan to touch the new-style dated ARTIFACTS_ROOT | ||
# directories to avoid a potential race condition for the creation of [D|M]AG | ||
# (DigitalArtifactGroup or MajoraArtifactGroups) in Majora. | ||
# See https://github.com/COG-UK/dipi-group/issues/183 | ||
|
||
# $1 DATESTAMP | ||
DATESTAMP=$1 | ||
|
||
while read var; do | ||
[ -z "${!var}" ] && { echo 'Global Elan variable '$var' is empty or not set. Environment likely uninitialised. Aborting.'; exit 64; } | ||
done << EOF | ||
DATESTAMP | ||
ARTIFACTS_ROOT | ||
CONDA_OCARINA | ||
ELAN_DAY_LOG_DIR | ||
EOF | ||
|
||
# Touch some pointless files | ||
# NOTE relies on Elan creating these dirs first | ||
touch $ARTIFACTS_ROOT/fasta/$DATESTAMP/.hoot | ||
touch $ARTIFACTS_ROOT/bam/$DATESTAMP/.hoot | ||
|
||
# Use Ocarina to tell Majora about them | ||
# This will ensure a single call is emitted to add $ARTIFACTS_ROOT/{fasta,bam}/$DATESTAMP to Majora | ||
# and avoid ocarina.nf falling over itself to add as many versions of the MAG as many times as it can | ||
# in the opening seconds of Saturday | ||
eval "$(conda shell.bash hook)" | ||
conda activate $CONDA_OCARINA | ||
ocarina --oauth --angry --env put file --path "$ARTIFACTS_ROOT/fasta/$DATESTAMP/.hoot" --type file --i-have-bad-files --full-path --node climb --pipeline-hook "cog-publish-$DATESTAMP"; | ||
ocarina --oauth --angry --env put file --path "$ARTIFACTS_ROOT/bam/$DATESTAMP/.hoot" --type file --i-have-bad-files --full-path --node climb --pipeline-hook "cog-publish-$DATESTAMP"; | ||
touch "$ELAN_DAY_LOG_DIR/publish.d183mag.ok" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters