diff --git a/CHANGELOG b/CHANGELOG.md similarity index 81% rename from CHANGELOG rename to CHANGELOG.md index 5835659..5e271d2 100644 --- a/CHANGELOG +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## NEW FEATURES +* `concat_text`: Concatenate a number of text files + * `csv2fasta`: Convert two columns from a CSV file to FASTA entries (PR #1). * `untar`: Unpack a .tar file. When the contents of the .tar file is just a single directory, @@ -9,4 +11,4 @@ ## MINOR CHANGES -* Bump viash to 0.9.0-RC7 (PR #6). \ No newline at end of file +* Bump viash to 0.9.0 diff --git a/target/executable/concat_text/.config.vsh.yaml b/target/executable/concat_text/.config.vsh.yaml index 52970ba..fee9588 100644 --- a/target/executable/concat_text/.config.vsh.yaml +++ b/target/executable/concat_text/.config.vsh.yaml @@ -170,15 +170,15 @@ build_info: engine: "docker|native" output: "target/executable/concat_text" executable: "target/executable/concat_text/concat_text" - viash_version: "0.9.0-RC6" - git_commit: "373be82129c13f50558c0dae25c07afe0866a8ba" + viash_version: "0.9.0-RC7" + git_commit: "5705b88fa20f267475b5d0ae1ca25dbf55ff1295" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" version: "main" description: "A collection of custom-tailored scripts and applied tools.\n" info: null - viash_version: "0.9.0-RC6" + viash_version: "0.9.0-RC7" source: "src" target: "target" config_mods: diff --git a/target/executable/concat_text/concat_text b/target/executable/concat_text/concat_text index 4730fc6..c47df6d 100755 --- a/target/executable/concat_text/concat_text +++ b/target/executable/concat_text/concat_text @@ -2,7 +2,7 @@ # concat_text main # -# This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a +# This wrapper script is auto-generated by viash 0.9.0-RC7 and is thus a # derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from # Data Intuitive. # @@ -58,24 +58,24 @@ function ViashRemoveFlags { # $1 : Should always be set to ${BASH_SOURCE[0]} # returns : The absolute path of the bash file function ViashSourceDir { - SOURCE="$1" - while [ -h "$SOURCE" ]; do - DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + local source="$1" + while [ -h "$source" ]; do + local dir="$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )" + source="$(readlink "$source")" + [[ $source != /* ]] && source="$dir/$source" done - cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd + cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd } # ViashFindTargetDir: return the path of the '.build.yaml' file, following symlinks # usage : ViashFindTargetDir 'ScriptPath' # $1 : The location from where to start the upward search # returns : The absolute path of the '.build.yaml' file function ViashFindTargetDir { - SOURCE="$1" - while [[ "$SOURCE" != "" && ! -e "$SOURCE/.build.yaml" ]]; do - SOURCE=${SOURCE%/*} + local source="$1" + while [[ "$source" != "" && ! -e "$source/.build.yaml" ]]; do + source=${source%/*} done - echo $SOURCE + echo $source } # see https://en.wikipedia.org/wiki/Syslog#Severity_level VIASH_LOGCODE_EMERGENCY=0 @@ -219,9 +219,9 @@ function ViashDockerInstallationCheck { fi ViashDebug "Checking whether the Docker daemon is running" - save=$-; set +e - docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) - out=$? + local save=$-; set +e + local docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashCritical "Docker daemon does not seem to be running. Try one of the following:" @@ -273,9 +273,9 @@ function ViashDockerPull { if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker pull $1 && return 0 || return 1 else - save=$-; set +e + local save=$-; set +e docker pull $1 2> /dev/null > /dev/null - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashWarning "Could not pull from '$1'. Docker image doesn't exist or is not accessible." @@ -295,7 +295,8 @@ function ViashDockerPull { # echo $? # returns '1' function ViashDockerPush { ViashNotice "Pushing image to '$1'" - save=$-; set +e + local save=$-; set +e + local out if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker push $1 out=$? @@ -319,9 +320,9 @@ function ViashDockerPush { # examples: # ViashDockerPullElseBuild mynewcomponent function ViashDockerPullElseBuild { - save=$-; set +e + local save=$-; set +e ViashDockerPull $1 - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashDockerBuild $@ @@ -478,9 +479,9 @@ RUN apk add --no-cache bash procps file LABEL org.opencontainers.image.authors="Toni Verbeiren, Dries Schaumont" LABEL org.opencontainers.image.description="Companion container for running component concat_text" -LABEL org.opencontainers.image.created="2024-08-19T07:26:27Z" +LABEL org.opencontainers.image.created="2024-09-12T15:41:16Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="373be82129c13f50558c0dae25c07afe0866a8ba" +LABEL org.opencontainers.image.revision="5705b88fa20f267475b5d0ae1ca25dbf55ff1295" LABEL org.opencontainers.image.version="main" VIASHDOCKER @@ -507,6 +508,9 @@ function ViashDockerBuildArgs { # ViashAbsolutePath /foo/bar/.. # returns /foo function ViashAbsolutePath { local thePath + local parr + local outp + local len if [[ ! "$1" =~ ^/ ]]; then thePath="$PWD/$1" else @@ -537,14 +541,17 @@ function ViashAbsolutePath { ) } # ViashDockerAutodetectMount: auto configuring docker mounts from parameters -# $1 : The parameter value -# returns : New parameter -# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $1 : The parameter value +# returns : New parameter +# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $VIASH_DOCKER_AUTOMOUNT_PREFIX : The prefix to be used for the automounts # examples: # ViashDockerAutodetectMount /path/to/bar # returns '/viash_automount/path/to/bar' # ViashDockerAutodetectMountArg /path/to/bar # returns '--volume="/path/to:/viash_automount/path/to"' function ViashDockerAutodetectMount { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -552,7 +559,7 @@ function ViashDockerAutodetectMount { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" if [ -z "$base_name" ]; then echo "$mount_target" else @@ -560,7 +567,9 @@ function ViashDockerAutodetectMount { fi } function ViashDockerAutodetectMountArg { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -568,17 +577,22 @@ function ViashDockerAutodetectMountArg { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" ViashDebug "ViashDockerAutodetectMountArg $1 -> $mount_source -> $mount_target" echo "--volume=\"$mount_source:$mount_target\"" } function ViashDockerStripAutomount { - abs_path=$(ViashAbsolutePath "$1") - echo "${abs_path#/viash_automount}" + local abs_path=$(ViashAbsolutePath "$1") + echo "${abs_path#$VIASH_DOCKER_AUTOMOUNT_PREFIX}" } # initialise variables VIASH_DIRECTORY_MOUNTS=() +# configure default docker automount prefix if it is unset +if [ -z "${VIASH_DOCKER_AUTOMOUNT_PREFIX+x}" ]; then + VIASH_DOCKER_AUTOMOUNT_PREFIX="/viash_automount" +fi + # initialise docker variables VIASH_DOCKER_RUN_ARGS=(-i --rm) @@ -662,6 +676,18 @@ while [[ $# -gt 0 ]]; do VIASH_MODE='dockerfile' shift 1 ;; + ---docker_run_args) + VIASH_DOCKER_RUN_ARGS+=("$2") + shift 2 + ;; + ---docker_run_args=*) + VIASH_DOCKER_RUN_ARGS+=("$(ViashRemoveFlags "$1")") + shift 1 + ;; + ---docker_image_id) + VIASH_MODE='docker_image_id' + shift 1 + ;; ---debug) VIASH_MODE='debug' shift 1 @@ -723,6 +749,10 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then if [ "$VIASH_MODE" == "dockerfile" ]; then ViashDockerfile "$VIASH_ENGINE_ID" exit 0 + + elif [ "$VIASH_MODE" == "docker_image_id" ]; then + echo "$VIASH_DOCKER_IMAGE_ID" + exit 0 # enter docker container elif [[ "$VIASH_MODE" == "debug" ]]; then diff --git a/target/executable/csv2fasta/.config.vsh.yaml b/target/executable/csv2fasta/.config.vsh.yaml index 4632137..38b6567 100644 --- a/target/executable/csv2fasta/.config.vsh.yaml +++ b/target/executable/csv2fasta/.config.vsh.yaml @@ -221,15 +221,15 @@ build_info: engine: "docker|native" output: "target/executable/csv2fasta" executable: "target/executable/csv2fasta/csv2fasta" - viash_version: "0.9.0-RC6" - git_commit: "373be82129c13f50558c0dae25c07afe0866a8ba" + viash_version: "0.9.0-RC7" + git_commit: "5705b88fa20f267475b5d0ae1ca25dbf55ff1295" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" version: "main" description: "A collection of custom-tailored scripts and applied tools.\n" info: null - viash_version: "0.9.0-RC6" + viash_version: "0.9.0-RC7" source: "src" target: "target" config_mods: diff --git a/target/executable/csv2fasta/csv2fasta b/target/executable/csv2fasta/csv2fasta index 5b664da..9636d65 100755 --- a/target/executable/csv2fasta/csv2fasta +++ b/target/executable/csv2fasta/csv2fasta @@ -2,7 +2,7 @@ # csv2fasta main # -# This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a +# This wrapper script is auto-generated by viash 0.9.0-RC7 and is thus a # derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from # Data Intuitive. # @@ -54,24 +54,24 @@ function ViashRemoveFlags { # $1 : Should always be set to ${BASH_SOURCE[0]} # returns : The absolute path of the bash file function ViashSourceDir { - SOURCE="$1" - while [ -h "$SOURCE" ]; do - DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + local source="$1" + while [ -h "$source" ]; do + local dir="$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )" + source="$(readlink "$source")" + [[ $source != /* ]] && source="$dir/$source" done - cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd + cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd } # ViashFindTargetDir: return the path of the '.build.yaml' file, following symlinks # usage : ViashFindTargetDir 'ScriptPath' # $1 : The location from where to start the upward search # returns : The absolute path of the '.build.yaml' file function ViashFindTargetDir { - SOURCE="$1" - while [[ "$SOURCE" != "" && ! -e "$SOURCE/.build.yaml" ]]; do - SOURCE=${SOURCE%/*} + local source="$1" + while [[ "$source" != "" && ! -e "$source/.build.yaml" ]]; do + source=${source%/*} done - echo $SOURCE + echo $source } # see https://en.wikipedia.org/wiki/Syslog#Severity_level VIASH_LOGCODE_EMERGENCY=0 @@ -261,9 +261,9 @@ function ViashDockerInstallationCheck { fi ViashDebug "Checking whether the Docker daemon is running" - save=$-; set +e - docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) - out=$? + local save=$-; set +e + local docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashCritical "Docker daemon does not seem to be running. Try one of the following:" @@ -315,9 +315,9 @@ function ViashDockerPull { if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker pull $1 && return 0 || return 1 else - save=$-; set +e + local save=$-; set +e docker pull $1 2> /dev/null > /dev/null - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashWarning "Could not pull from '$1'. Docker image doesn't exist or is not accessible." @@ -337,7 +337,8 @@ function ViashDockerPull { # echo $? # returns '1' function ViashDockerPush { ViashNotice "Pushing image to '$1'" - save=$-; set +e + local save=$-; set +e + local out if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker push $1 out=$? @@ -361,9 +362,9 @@ function ViashDockerPush { # examples: # ViashDockerPullElseBuild mynewcomponent function ViashDockerPullElseBuild { - save=$-; set +e + local save=$-; set +e ViashDockerPull $1 - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashDockerBuild $@ @@ -524,9 +525,9 @@ RUN pip install --upgrade pip && \ pip install --upgrade --no-cache-dir "dnaio" LABEL org.opencontainers.image.description="Companion container for running component csv2fasta" -LABEL org.opencontainers.image.created="2024-08-19T07:26:26Z" +LABEL org.opencontainers.image.created="2024-09-12T15:41:15Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="373be82129c13f50558c0dae25c07afe0866a8ba" +LABEL org.opencontainers.image.revision="5705b88fa20f267475b5d0ae1ca25dbf55ff1295" LABEL org.opencontainers.image.version="main" VIASHDOCKER @@ -553,6 +554,9 @@ function ViashDockerBuildArgs { # ViashAbsolutePath /foo/bar/.. # returns /foo function ViashAbsolutePath { local thePath + local parr + local outp + local len if [[ ! "$1" =~ ^/ ]]; then thePath="$PWD/$1" else @@ -583,14 +587,17 @@ function ViashAbsolutePath { ) } # ViashDockerAutodetectMount: auto configuring docker mounts from parameters -# $1 : The parameter value -# returns : New parameter -# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $1 : The parameter value +# returns : New parameter +# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $VIASH_DOCKER_AUTOMOUNT_PREFIX : The prefix to be used for the automounts # examples: # ViashDockerAutodetectMount /path/to/bar # returns '/viash_automount/path/to/bar' # ViashDockerAutodetectMountArg /path/to/bar # returns '--volume="/path/to:/viash_automount/path/to"' function ViashDockerAutodetectMount { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -598,7 +605,7 @@ function ViashDockerAutodetectMount { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" if [ -z "$base_name" ]; then echo "$mount_target" else @@ -606,7 +613,9 @@ function ViashDockerAutodetectMount { fi } function ViashDockerAutodetectMountArg { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -614,17 +623,22 @@ function ViashDockerAutodetectMountArg { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" ViashDebug "ViashDockerAutodetectMountArg $1 -> $mount_source -> $mount_target" echo "--volume=\"$mount_source:$mount_target\"" } function ViashDockerStripAutomount { - abs_path=$(ViashAbsolutePath "$1") - echo "${abs_path#/viash_automount}" + local abs_path=$(ViashAbsolutePath "$1") + echo "${abs_path#$VIASH_DOCKER_AUTOMOUNT_PREFIX}" } # initialise variables VIASH_DIRECTORY_MOUNTS=() +# configure default docker automount prefix if it is unset +if [ -z "${VIASH_DOCKER_AUTOMOUNT_PREFIX+x}" ]; then + VIASH_DOCKER_AUTOMOUNT_PREFIX="/viash_automount" +fi + # initialise docker variables VIASH_DOCKER_RUN_ARGS=(-i --rm) @@ -768,6 +782,18 @@ while [[ $# -gt 0 ]]; do VIASH_MODE='dockerfile' shift 1 ;; + ---docker_run_args) + VIASH_DOCKER_RUN_ARGS+=("$2") + shift 2 + ;; + ---docker_run_args=*) + VIASH_DOCKER_RUN_ARGS+=("$(ViashRemoveFlags "$1")") + shift 1 + ;; + ---docker_image_id) + VIASH_MODE='docker_image_id' + shift 1 + ;; ---debug) VIASH_MODE='debug' shift 1 @@ -829,6 +855,10 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then if [ "$VIASH_MODE" == "dockerfile" ]; then ViashDockerfile "$VIASH_ENGINE_ID" exit 0 + + elif [ "$VIASH_MODE" == "docker_image_id" ]; then + echo "$VIASH_DOCKER_IMAGE_ID" + exit 0 # enter docker container elif [[ "$VIASH_MODE" == "debug" ]]; then diff --git a/target/executable/untar/.config.vsh.yaml b/target/executable/untar/.config.vsh.yaml index 40a3319..ac4ee5c 100644 --- a/target/executable/untar/.config.vsh.yaml +++ b/target/executable/untar/.config.vsh.yaml @@ -146,15 +146,15 @@ build_info: engine: "docker|native" output: "target/executable/untar" executable: "target/executable/untar/untar" - viash_version: "0.9.0-RC6" - git_commit: "373be82129c13f50558c0dae25c07afe0866a8ba" + viash_version: "0.9.0-RC7" + git_commit: "5705b88fa20f267475b5d0ae1ca25dbf55ff1295" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" version: "main" description: "A collection of custom-tailored scripts and applied tools.\n" info: null - viash_version: "0.9.0-RC6" + viash_version: "0.9.0-RC7" source: "src" target: "target" config_mods: diff --git a/target/executable/untar/untar b/target/executable/untar/untar index 7e89a1a..ca4f140 100755 --- a/target/executable/untar/untar +++ b/target/executable/untar/untar @@ -2,7 +2,7 @@ # untar main # -# This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a +# This wrapper script is auto-generated by viash 0.9.0-RC7 and is thus a # derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from # Data Intuitive. # @@ -54,24 +54,24 @@ function ViashRemoveFlags { # $1 : Should always be set to ${BASH_SOURCE[0]} # returns : The absolute path of the bash file function ViashSourceDir { - SOURCE="$1" - while [ -h "$SOURCE" ]; do - DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + local source="$1" + while [ -h "$source" ]; do + local dir="$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )" + source="$(readlink "$source")" + [[ $source != /* ]] && source="$dir/$source" done - cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd + cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd } # ViashFindTargetDir: return the path of the '.build.yaml' file, following symlinks # usage : ViashFindTargetDir 'ScriptPath' # $1 : The location from where to start the upward search # returns : The absolute path of the '.build.yaml' file function ViashFindTargetDir { - SOURCE="$1" - while [[ "$SOURCE" != "" && ! -e "$SOURCE/.build.yaml" ]]; do - SOURCE=${SOURCE%/*} + local source="$1" + while [[ "$source" != "" && ! -e "$source/.build.yaml" ]]; do + source=${source%/*} done - echo $SOURCE + echo $source } # see https://en.wikipedia.org/wiki/Syslog#Severity_level VIASH_LOGCODE_EMERGENCY=0 @@ -215,9 +215,9 @@ function ViashDockerInstallationCheck { fi ViashDebug "Checking whether the Docker daemon is running" - save=$-; set +e - docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) - out=$? + local save=$-; set +e + local docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashCritical "Docker daemon does not seem to be running. Try one of the following:" @@ -269,9 +269,9 @@ function ViashDockerPull { if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker pull $1 && return 0 || return 1 else - save=$-; set +e + local save=$-; set +e docker pull $1 2> /dev/null > /dev/null - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashWarning "Could not pull from '$1'. Docker image doesn't exist or is not accessible." @@ -291,7 +291,8 @@ function ViashDockerPull { # echo $? # returns '1' function ViashDockerPush { ViashNotice "Pushing image to '$1'" - save=$-; set +e + local save=$-; set +e + local out if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker push $1 out=$? @@ -315,9 +316,9 @@ function ViashDockerPush { # examples: # ViashDockerPullElseBuild mynewcomponent function ViashDockerPullElseBuild { - save=$-; set +e + local save=$-; set +e ViashDockerPull $1 - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashDockerBuild $@ @@ -475,9 +476,9 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* LABEL org.opencontainers.image.description="Companion container for running component untar" -LABEL org.opencontainers.image.created="2024-08-19T07:26:27Z" +LABEL org.opencontainers.image.created="2024-09-12T15:41:15Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="373be82129c13f50558c0dae25c07afe0866a8ba" +LABEL org.opencontainers.image.revision="5705b88fa20f267475b5d0ae1ca25dbf55ff1295" LABEL org.opencontainers.image.version="main" VIASHDOCKER @@ -504,6 +505,9 @@ function ViashDockerBuildArgs { # ViashAbsolutePath /foo/bar/.. # returns /foo function ViashAbsolutePath { local thePath + local parr + local outp + local len if [[ ! "$1" =~ ^/ ]]; then thePath="$PWD/$1" else @@ -534,14 +538,17 @@ function ViashAbsolutePath { ) } # ViashDockerAutodetectMount: auto configuring docker mounts from parameters -# $1 : The parameter value -# returns : New parameter -# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $1 : The parameter value +# returns : New parameter +# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $VIASH_DOCKER_AUTOMOUNT_PREFIX : The prefix to be used for the automounts # examples: # ViashDockerAutodetectMount /path/to/bar # returns '/viash_automount/path/to/bar' # ViashDockerAutodetectMountArg /path/to/bar # returns '--volume="/path/to:/viash_automount/path/to"' function ViashDockerAutodetectMount { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -549,7 +556,7 @@ function ViashDockerAutodetectMount { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" if [ -z "$base_name" ]; then echo "$mount_target" else @@ -557,7 +564,9 @@ function ViashDockerAutodetectMount { fi } function ViashDockerAutodetectMountArg { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -565,17 +574,22 @@ function ViashDockerAutodetectMountArg { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" ViashDebug "ViashDockerAutodetectMountArg $1 -> $mount_source -> $mount_target" echo "--volume=\"$mount_source:$mount_target\"" } function ViashDockerStripAutomount { - abs_path=$(ViashAbsolutePath "$1") - echo "${abs_path#/viash_automount}" + local abs_path=$(ViashAbsolutePath "$1") + echo "${abs_path#$VIASH_DOCKER_AUTOMOUNT_PREFIX}" } # initialise variables VIASH_DIRECTORY_MOUNTS=() +# configure default docker automount prefix if it is unset +if [ -z "${VIASH_DOCKER_AUTOMOUNT_PREFIX+x}" ]; then + VIASH_DOCKER_AUTOMOUNT_PREFIX="/viash_automount" +fi + # initialise docker variables VIASH_DOCKER_RUN_ARGS=(-i --rm) @@ -665,6 +679,18 @@ while [[ $# -gt 0 ]]; do VIASH_MODE='dockerfile' shift 1 ;; + ---docker_run_args) + VIASH_DOCKER_RUN_ARGS+=("$2") + shift 2 + ;; + ---docker_run_args=*) + VIASH_DOCKER_RUN_ARGS+=("$(ViashRemoveFlags "$1")") + shift 1 + ;; + ---docker_image_id) + VIASH_MODE='docker_image_id' + shift 1 + ;; ---debug) VIASH_MODE='debug' shift 1 @@ -726,6 +752,10 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then if [ "$VIASH_MODE" == "dockerfile" ]; then ViashDockerfile "$VIASH_ENGINE_ID" exit 0 + + elif [ "$VIASH_MODE" == "docker_image_id" ]; then + echo "$VIASH_DOCKER_IMAGE_ID" + exit 0 # enter docker container elif [[ "$VIASH_MODE" == "debug" ]]; then diff --git a/target/nextflow/concat_text/.config.vsh.yaml b/target/nextflow/concat_text/.config.vsh.yaml index e645c34..eb5770a 100644 --- a/target/nextflow/concat_text/.config.vsh.yaml +++ b/target/nextflow/concat_text/.config.vsh.yaml @@ -170,15 +170,15 @@ build_info: engine: "docker|native" output: "target/nextflow/concat_text" executable: "target/nextflow/concat_text/main.nf" - viash_version: "0.9.0-RC6" - git_commit: "373be82129c13f50558c0dae25c07afe0866a8ba" + viash_version: "0.9.0-RC7" + git_commit: "5705b88fa20f267475b5d0ae1ca25dbf55ff1295" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" version: "main" description: "A collection of custom-tailored scripts and applied tools.\n" info: null - viash_version: "0.9.0-RC6" + viash_version: "0.9.0-RC7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/concat_text/main.nf b/target/nextflow/concat_text/main.nf index 4153e87..e78e522 100644 --- a/target/nextflow/concat_text/main.nf +++ b/target/nextflow/concat_text/main.nf @@ -1,6 +1,6 @@ // concat_text main // -// This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a +// This wrapper script is auto-generated by viash 0.9.0-RC7 and is thus a // derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from // Data Intuitive. // @@ -764,8 +764,11 @@ def runEach(Map args) { def fromState_ = args.fromState def toState_ = args.toState def filter_ = args.filter + def runIf_ = args.runIf def id_ = args.id + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + workflow runEachWf { take: input_ch main: @@ -787,7 +790,20 @@ def runEach(Map args) { [new_id] + tup.drop(1) } : filter_ch - def data_ch = id_ch | map{tup -> + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> def new_data = tup[1] if (fromState_ instanceof Map) { new_data = fromState_.collectEntries{ key0, key1 -> @@ -825,8 +841,11 @@ def runEach(Map args) { [tup[0], new_state] + tup.drop(3) } : out_ch + + def return_ch = post_ch + | concat(chPassthrough) - post_ch + return_ch } // mix all results @@ -1602,8 +1621,8 @@ def findStates(Map params, Map config) { // construct renameMap if (args.rename_keys) { def renameMap = args.rename_keys.collectEntries{renameString -> - def split = renameString.split(";") - assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey,newKey:oldKey'" + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" split } @@ -2630,30 +2649,31 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { tuple } - def chModifiedFiltered = workflowArgs.filter ? - chModified | filter{workflowArgs.filter(it)} : - chModified def chRun = null def chPassthrough = null if (workflowArgs.runIf) { - def runIfBranch = chModifiedFiltered.branch{ tup -> + def runIfBranch = chModified.branch{ tup -> run: workflowArgs.runIf(tup[0], tup[1]) passthrough: true } chRun = runIfBranch.run chPassthrough = runIfBranch.passthrough } else { - chRun = chModifiedFiltered + chRun = chModified chPassthrough = Channel.empty() } + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + def chArgs = workflowArgs.fromState ? - chRun | map{ + chRunFiltered | map{ def new_data = workflowArgs.fromState(it.take(2)) [it[0], new_data] } : - chRun | map {tup -> tup.take(2)} + chRunFiltered | map {tup -> tup.take(2)} // fill in defaults def chArgsWithDefaults = chArgs @@ -2724,7 +2744,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { // | view{"chInitialOutput: ${it.take(3)}"} // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] - def chNewState = safeJoin(chInitialOutput, chModifiedFiltered, key_) + def chNewState = safeJoin(chInitialOutput, chRunFiltered, key_) // input tuple format: [join_id, id, output, prev_state, ...] // output tuple format: [join_id, id, new_state, ...] | map{ tup -> @@ -3004,15 +3024,15 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/concat_text", - "viash_version" : "0.9.0-RC6", - "git_commit" : "373be82129c13f50558c0dae25c07afe0866a8ba", + "viash_version" : "0.9.0-RC7", + "git_commit" : "5705b88fa20f267475b5d0ae1ca25dbf55ff1295", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", "version" : "main", "description" : "A collection of custom-tailored scripts and applied tools.\n", - "viash_version" : "0.9.0-RC6", + "viash_version" : "0.9.0-RC7", "source" : "src", "target" : "target", "config_mods" : [ diff --git a/target/nextflow/concat_text/nextflow_schema.json b/target/nextflow/concat_text/nextflow_schema.json index 07a599a..230c614 100644 --- a/target/nextflow/concat_text/nextflow_schema.json +++ b/target/nextflow/concat_text/nextflow_schema.json @@ -17,8 +17,8 @@ "input": { "type": "string", - "description": "Type: List of `file`, required, example: `input?.txt.gz`, multiple_sep: `\":\"`. A list of (gzipped) text files", - "help_text": "Type: List of `file`, required, example: `input?.txt.gz`, multiple_sep: `\":\"`. A list of (gzipped) text files." + "description": "Type: List of `file`, required, example: `input?.txt.gz`, multiple_sep: `\";\"`. A list of (gzipped) text files", + "help_text": "Type: List of `file`, required, example: `input?.txt.gz`, multiple_sep: `\";\"`. A list of (gzipped) text files." } diff --git a/target/nextflow/csv2fasta/.config.vsh.yaml b/target/nextflow/csv2fasta/.config.vsh.yaml index efd6998..9eadfc5 100644 --- a/target/nextflow/csv2fasta/.config.vsh.yaml +++ b/target/nextflow/csv2fasta/.config.vsh.yaml @@ -221,15 +221,15 @@ build_info: engine: "docker|native" output: "target/nextflow/csv2fasta" executable: "target/nextflow/csv2fasta/main.nf" - viash_version: "0.9.0-RC6" - git_commit: "373be82129c13f50558c0dae25c07afe0866a8ba" + viash_version: "0.9.0-RC7" + git_commit: "5705b88fa20f267475b5d0ae1ca25dbf55ff1295" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" version: "main" description: "A collection of custom-tailored scripts and applied tools.\n" info: null - viash_version: "0.9.0-RC6" + viash_version: "0.9.0-RC7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/csv2fasta/main.nf b/target/nextflow/csv2fasta/main.nf index bfb45b2..9c9b7d1 100644 --- a/target/nextflow/csv2fasta/main.nf +++ b/target/nextflow/csv2fasta/main.nf @@ -1,6 +1,6 @@ // csv2fasta main // -// This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a +// This wrapper script is auto-generated by viash 0.9.0-RC7 and is thus a // derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from // Data Intuitive. // @@ -760,8 +760,11 @@ def runEach(Map args) { def fromState_ = args.fromState def toState_ = args.toState def filter_ = args.filter + def runIf_ = args.runIf def id_ = args.id + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + workflow runEachWf { take: input_ch main: @@ -783,7 +786,20 @@ def runEach(Map args) { [new_id] + tup.drop(1) } : filter_ch - def data_ch = id_ch | map{tup -> + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> def new_data = tup[1] if (fromState_ instanceof Map) { new_data = fromState_.collectEntries{ key0, key1 -> @@ -821,8 +837,11 @@ def runEach(Map args) { [tup[0], new_state] + tup.drop(3) } : out_ch + + def return_ch = post_ch + | concat(chPassthrough) - post_ch + return_ch } // mix all results @@ -1598,8 +1617,8 @@ def findStates(Map params, Map config) { // construct renameMap if (args.rename_keys) { def renameMap = args.rename_keys.collectEntries{renameString -> - def split = renameString.split(";") - assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey,newKey:oldKey'" + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" split } @@ -2626,30 +2645,31 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { tuple } - def chModifiedFiltered = workflowArgs.filter ? - chModified | filter{workflowArgs.filter(it)} : - chModified def chRun = null def chPassthrough = null if (workflowArgs.runIf) { - def runIfBranch = chModifiedFiltered.branch{ tup -> + def runIfBranch = chModified.branch{ tup -> run: workflowArgs.runIf(tup[0], tup[1]) passthrough: true } chRun = runIfBranch.run chPassthrough = runIfBranch.passthrough } else { - chRun = chModifiedFiltered + chRun = chModified chPassthrough = Channel.empty() } + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + def chArgs = workflowArgs.fromState ? - chRun | map{ + chRunFiltered | map{ def new_data = workflowArgs.fromState(it.take(2)) [it[0], new_data] } : - chRun | map {tup -> tup.take(2)} + chRunFiltered | map {tup -> tup.take(2)} // fill in defaults def chArgsWithDefaults = chArgs @@ -2720,7 +2740,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { // | view{"chInitialOutput: ${it.take(3)}"} // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] - def chNewState = safeJoin(chInitialOutput, chModifiedFiltered, key_) + def chNewState = safeJoin(chInitialOutput, chRunFiltered, key_) // input tuple format: [join_id, id, output, prev_state, ...] // output tuple format: [join_id, id, new_state, ...] | map{ tup -> @@ -3040,15 +3060,15 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/csv2fasta", - "viash_version" : "0.9.0-RC6", - "git_commit" : "373be82129c13f50558c0dae25c07afe0866a8ba", + "viash_version" : "0.9.0-RC7", + "git_commit" : "5705b88fa20f267475b5d0ae1ca25dbf55ff1295", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", "version" : "main", "description" : "A collection of custom-tailored scripts and applied tools.\n", - "viash_version" : "0.9.0-RC6", + "viash_version" : "0.9.0-RC7", "source" : "src", "target" : "target", "config_mods" : [ diff --git a/target/nextflow/untar/.config.vsh.yaml b/target/nextflow/untar/.config.vsh.yaml index d256b6a..fa909b1 100644 --- a/target/nextflow/untar/.config.vsh.yaml +++ b/target/nextflow/untar/.config.vsh.yaml @@ -146,15 +146,15 @@ build_info: engine: "docker|native" output: "target/nextflow/untar" executable: "target/nextflow/untar/main.nf" - viash_version: "0.9.0-RC6" - git_commit: "373be82129c13f50558c0dae25c07afe0866a8ba" + viash_version: "0.9.0-RC7" + git_commit: "5705b88fa20f267475b5d0ae1ca25dbf55ff1295" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" version: "main" description: "A collection of custom-tailored scripts and applied tools.\n" info: null - viash_version: "0.9.0-RC6" + viash_version: "0.9.0-RC7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/untar/main.nf b/target/nextflow/untar/main.nf index 61c830a..6396ab8 100644 --- a/target/nextflow/untar/main.nf +++ b/target/nextflow/untar/main.nf @@ -1,6 +1,6 @@ // untar main // -// This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a +// This wrapper script is auto-generated by viash 0.9.0-RC7 and is thus a // derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from // Data Intuitive. // @@ -760,8 +760,11 @@ def runEach(Map args) { def fromState_ = args.fromState def toState_ = args.toState def filter_ = args.filter + def runIf_ = args.runIf def id_ = args.id + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + workflow runEachWf { take: input_ch main: @@ -783,7 +786,20 @@ def runEach(Map args) { [new_id] + tup.drop(1) } : filter_ch - def data_ch = id_ch | map{tup -> + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> def new_data = tup[1] if (fromState_ instanceof Map) { new_data = fromState_.collectEntries{ key0, key1 -> @@ -821,8 +837,11 @@ def runEach(Map args) { [tup[0], new_state] + tup.drop(3) } : out_ch + + def return_ch = post_ch + | concat(chPassthrough) - post_ch + return_ch } // mix all results @@ -1598,8 +1617,8 @@ def findStates(Map params, Map config) { // construct renameMap if (args.rename_keys) { def renameMap = args.rename_keys.collectEntries{renameString -> - def split = renameString.split(";") - assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey,newKey:oldKey'" + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" split } @@ -2626,30 +2645,31 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { tuple } - def chModifiedFiltered = workflowArgs.filter ? - chModified | filter{workflowArgs.filter(it)} : - chModified def chRun = null def chPassthrough = null if (workflowArgs.runIf) { - def runIfBranch = chModifiedFiltered.branch{ tup -> + def runIfBranch = chModified.branch{ tup -> run: workflowArgs.runIf(tup[0], tup[1]) passthrough: true } chRun = runIfBranch.run chPassthrough = runIfBranch.passthrough } else { - chRun = chModifiedFiltered + chRun = chModified chPassthrough = Channel.empty() } + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + def chArgs = workflowArgs.fromState ? - chRun | map{ + chRunFiltered | map{ def new_data = workflowArgs.fromState(it.take(2)) [it[0], new_data] } : - chRun | map {tup -> tup.take(2)} + chRunFiltered | map {tup -> tup.take(2)} // fill in defaults def chArgsWithDefaults = chArgs @@ -2720,7 +2740,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { // | view{"chInitialOutput: ${it.take(3)}"} // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] - def chNewState = safeJoin(chInitialOutput, chModifiedFiltered, key_) + def chNewState = safeJoin(chInitialOutput, chRunFiltered, key_) // input tuple format: [join_id, id, output, prev_state, ...] // output tuple format: [join_id, id, new_state, ...] | map{ tup -> @@ -2961,15 +2981,15 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/untar", - "viash_version" : "0.9.0-RC6", - "git_commit" : "373be82129c13f50558c0dae25c07afe0866a8ba", + "viash_version" : "0.9.0-RC7", + "git_commit" : "5705b88fa20f267475b5d0ae1ca25dbf55ff1295", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", "version" : "main", "description" : "A collection of custom-tailored scripts and applied tools.\n", - "viash_version" : "0.9.0-RC6", + "viash_version" : "0.9.0-RC7", "source" : "src", "target" : "target", "config_mods" : [