Skip to content

Commit

Permalink
Merge pull request #86 from ncbi/Update-runners-for-v0.5.4
Browse files Browse the repository at this point in the history
Update runners for FCS Release v0.5.4
  • Loading branch information
etvedte authored Jun 11, 2024
2 parents 55dcb16 + c913688 commit a435c40
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
35 changes: 33 additions & 2 deletions dist/fcs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
# pylint: disable=C0301,C0114,C0103,C0116,R0913,R0914,W0511,R1732,R0916
"""
PUBLIC DOMAIN NOTICE
National Center for Biotechnology Information
Expand Down Expand Up @@ -35,7 +37,7 @@

CONTAINER = "run_gx"
DEFAULT_CONTAINER_DB = "/app/db/gxdb/"
DEFAULT_VERSION = "0.5.0"
DEFAULT_VERSION = "0.5.4"
DEFAULT_DOCKER_IMAGE = f"ncbi/fcs-gx:{DEFAULT_VERSION}"
GX_BIN_DIR = Path("/app/bin")

Expand Down Expand Up @@ -425,7 +427,36 @@ def main() -> int:
parser.print_usage()
sys.exit()

GlobalStat.opt_in = (not args.no_report_analytics) and ("--help" not in extra_args) and (not args.dry_run)
GlobalStat.opt_in = (
not args.no_report_analytics
and "--help" not in extra_args
and not args.dry_run
and os.getenv("DO_NOT_TRACK", "0") == "0" # GP-37725
and os.getenv("NCBI_FCS_REPORT_ANALYTICS", "1") == "1" # GP-37725
)

if ( # If none of the banner-switches are set, display the banner. GP-37725
not args.no_report_analytics
and os.getenv("DO_NOT_TRACK") is None
and os.getenv("NCBI_FCS_REPORT_ANALYTICS") is None
):
print("""
--------------------------------------------------------------------------------------------
NCBI collects limited usage data for each run of FCS by default. To disable usage reporting:
python3 fcs.py --no-report-analytics ...
or export NCBI_FCS_REPORT_ANALYTICS=1 to enable,
or export NCBI_FCS_REPORT_ANALYTICS=0 to disable the reporting.
Usage data collected by NCBI is documented in the FCS privacy notice
at https://github.com/ncbi/fcs/blob/main/PRIVACY.md
--------------------------------------------------------------------------------------------""",
file=sys.stderr)


if hasattr(args, "cmd"):
GlobalStat.ncbi_op = args.cmd
retcode = 0
Expand Down
15 changes: 11 additions & 4 deletions dist/run_fcsadaptor.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_NAME=$0
DEFAULT_VERSION="0.5.0"
DEFAULT_VERSION="0.5.4"
DOCKER_IMAGE=ncbi/fcs-adaptor:${DEFAULT_VERSION}
SINGULARITY_IMAGE=""
CONTAINER_ENGINE="docker"
Expand All @@ -19,6 +19,7 @@ Options:
--output-dir <directory> output path (required)
--image <file> dockerhub address or sif file (required for singularity only)
--container-engine <string> default docker
--debug debug
Taxonomy (exactly one required):
--prok prokaryotes
Expand All @@ -29,6 +30,7 @@ EOF
}

DOCKER=docker
DEBUG=""

while [[ $# -gt 0 ]]
do
Expand Down Expand Up @@ -60,6 +62,11 @@ do
CONTAINER_ENGINE=$2
shift
;;
--debug)
DEBUG="--debug"
shift
;;

-*)
echo "invalid option : '$1'"
usage 10
Expand Down Expand Up @@ -108,17 +115,17 @@ then
}
trap finish EXIT

$DOCKER run --init --name $CONTAINER --user "$(id -u):$(id -g)" -v $FASTA_DIRNAME:/sample-volume/ \
$DOCKER run --rm --init --name $CONTAINER --user "$(id -u):$(id -g)" -v $FASTA_DIRNAME:/sample-volume/ \
-v $EXPANDED_OUTPUT:/output-volume/ $DOCKER_IMAGE \
/app/fcs/bin/av_screen_x -o /output-volume/ $TAX /sample-volume/$FASTA_FILENAME
/app/fcs/bin/av_screen_x -o /output-volume/ $TAX /sample-volume/$FASTA_FILENAME $DEBUG

elif [[ ${CONTAINER_ENGINE} == "singularity" ]]
then
if [[ -n "$SINGULARITY_IMAGE" ]]
then
singularity run $CONTAINER --bind $FASTA_DIRNAME:/sample-volume/ \
--bind $EXPANDED_OUTPUT:/output-volume/ $SINGULARITY_IMAGE \
/app/fcs/bin/av_screen_x -o /output-volume/ $TAX /sample-volume/$FASTA_FILENAME
/app/fcs/bin/av_screen_x -o /output-volume/ $TAX /sample-volume/$FASTA_FILENAME $DEBUG
else
echo "--image is required when specifying --container-engine singularity"
fi
Expand Down

0 comments on commit a435c40

Please sign in to comment.