Exporting remove_comments (demo) =docker=> /home/runner/work/website/website/guide/_viash_project_template/target/docker/demo/remove_comments
[notice] Building container 'ghcr.io/viash-io/viash_project_template/demo/remove_comments:dev' with Dockerfile
Exporting remove_comments (demo) =nextflow=> /home/runner/work/website/website/guide/_viash_project_template/target/nextflow/demo/remove_comments
Exporting combine_columns (demo) =docker=> /home/runner/work/website/website/guide/_viash_project_template/target/docker/demo/combine_columns
[notice] Building container 'ghcr.io/viash-io/viash_project_template/demo/combine_columns:dev' with Dockerfile
Exporting combine_columns (demo) =nextflow=> /home/runner/work/website/website/guide/_viash_project_template/target/nextflow/demo/combine_columns
Exporting take_column (demo) =docker=> /home/runner/work/website/website/guide/_viash_project_template/target/docker/demo/take_column
[notice] Building container 'ghcr.io/viash-io/viash_project_template/demo/take_column:dev' with Dockerfile
Exporting take_column (demo) =nextflow=> /home/runner/work/website/website/guide/_viash_project_template/target/nextflow/demo/take_column
[32mAll 6 configs built successfully[0m
Batch processing
Within this project it’s possible to do all of the same things mentioned in the “Component” guide such as build a target executable with viash build
and test a component with viash test
. However, doing this for all components in the repository can bet quite tedious.
Luckily, Viash provides a set of commands for building, testing or inspecting all Viash components in the current namespace (ns).
Build all components
You can generate your first full development build using the viash ns build
command.
viash ns build --setup cachedbuild
Output
Here are some useful optional arguments:
--parallel
: Run multiple builds in parallel.--setup cachedbuild
: Build Docker images using thecachedbuild
strategy.--query demo
: Only select components that have ‘demo’ in the namespace or name.
Test all components
You can run all of the component tests using the viash ns test
command.
viash ns test
Output
namespace functionality platform test_name exit_code duration result[0m
demo remove_comments docker start [0m
The working directory for the namespace tests is /tmp/viash_ns_test5637339606182808323
[32m demo remove_comments docker build_executable 0 0 SUCCESS[0m
[32m demo remove_comments docker test.sh 0 1 SUCCESS[0m
demo combine_columns docker start [0m
[32m demo combine_columns docker build_executable 0 0 SUCCESS[0m
[33m demo combine_columns docker tests -1 0 MISSING[0m
no tests found
====================================================================
demo take_column docker start [0m
[32m demo take_column docker build_executable 0 0 SUCCESS[0m
[33m demo take_column docker tests -1 0 MISSING[0m
no tests found
====================================================================
[33mNot all configs built and tested successfully[0m
[33m2/6 tests missing[0m
[32m4/6 configs built and tested successfully[0m
Listing components
You can run list all components using the viash ns list
command.
viash ns list
Output
- functionality:
name: "remove_comments"
namespace: "demo"
version: "dev"
authors: []
arguments:
- type: "file"
[32mAll 3 configs parsed successfully[0m
name: "--input"
alternatives:
- "-i"
example:
- "file.tsv"
default: []
must_exist: true
create_parent: true
required: true
direction: "input"
multiple: false
multiple_sep: ":"
dest: "par"
- type: "file"
name: "--output"
alternatives:
- "-o"
example:
- "file.tsv"
default: []
must_exist: true
create_parent: true
required: true
direction: "output"
multiple: false
multiple_sep: ":"
dest: "par"
- type: "string"
name: "--id"
alternatives: []
example: []
default:
- "remove_comments"
required: false
choices: []
direction: "input"
multiple: false
multiple_sep: ":"
dest: "par"
argument_groups: []
resources:
- type: "bash_script"
path: "script.sh"
is_executable: true
parent: "file:/home/runner/work/website/website/guide/_viash_project_template/src/demo/remove_comments/config.vsh.yaml"
test_resources:
- type: "bash_script"
path: "test.sh"
is_executable: true
parent: "file:/home/runner/work/website/website/guide/_viash_project_template/src/demo/remove_comments/config.vsh.yaml"
status: "enabled"
requirements:
commands: []
set_wd_to_resources_dir: false
platforms:
- type: "docker"
id: "docker"
image: "ubuntu:20.04"
target_organization: "viash-io/viash_project_template"
target_registry: "ghcr.io"
namespace_separator: "/"
resolve_volume: "Automatic"
chown: true
port: []
setup_strategy: "ifneedbepullelsecachedbuild"
run_args: []
target_image_source: "https://github.com/viash-io/viash_project_template"
setup: []
test_setup: []
- type: "nextflow"
id: "nextflow"
variant: "vdsl3"
directives:
accelerator: {}
conda: []
containerOptions: []
label: []
module: []
pod: []
publishDir: []
queue: []
tag: "$id"
auto:
simplifyInput: true
simplifyOutput: true
transcript: false
publish: false
debug: false
container: "docker"
info:
config: "/home/runner/work/website/website/guide/_viash_project_template/src/demo/remove_comments/config.vsh.yaml"
viash_version: "0.7.1"
git_commit: "ffa7b1bee3fb192bec568a772b44c6b527cd941b"
git_remote: "https://github.com/viash-io/viash_project_template.git"
- functionality:
name: "combine_columns"
namespace: "demo"
version: "dev"
authors: []
arguments:
- type: "file"
name: "--input"
alternatives:
- "-i"
example: []
default: []
must_exist: true
create_parent: true
required: true
direction: "input"
multiple: true
multiple_sep: ":"
dest: "par"
- type: "file"
name: "--output"
alternatives:
- "-o"
example: []
default: []
must_exist: true
create_parent: true
required: true
direction: "output"
multiple: false
multiple_sep: ":"
dest: "par"
- type: "string"
name: "--id"
alternatives: []
example: []
default:
- "combine_columns"
required: false
choices: []
direction: "input"
multiple: false
multiple_sep: ":"
dest: "par"
argument_groups: []
resources:
- type: "r_script"
path: "script.R"
is_executable: true
parent: "file:/home/runner/work/website/website/guide/_viash_project_template/src/demo/combine_columns/config.vsh.yaml"
test_resources: []
status: "enabled"
requirements:
commands: []
set_wd_to_resources_dir: false
platforms:
- type: "docker"
id: "docker"
image: "eddelbuettel/r2u:22.04"
target_organization: "viash-io/viash_project_template"
target_registry: "ghcr.io"
namespace_separator: "/"
resolve_volume: "Automatic"
chown: true
port: []
setup_strategy: "ifneedbepullelsecachedbuild"
run_args: []
target_image_source: "https://github.com/viash-io/viash_project_template"
setup: []
test_setup: []
- type: "nextflow"
id: "nextflow"
variant: "vdsl3"
directives:
accelerator: {}
conda: []
containerOptions: []
label: []
module: []
pod: []
publishDir: []
queue: []
tag: "$id"
auto:
simplifyInput: true
simplifyOutput: true
transcript: false
publish: false
debug: false
container: "docker"
info:
config: "/home/runner/work/website/website/guide/_viash_project_template/src/demo/combine_columns/config.vsh.yaml"
viash_version: "0.7.1"
git_commit: "ffa7b1bee3fb192bec568a772b44c6b527cd941b"
git_remote: "https://github.com/viash-io/viash_project_template.git"
- functionality:
name: "take_column"
namespace: "demo"
version: "dev"
authors: []
arguments:
- type: "file"
name: "--input"
alternatives:
- "-i"
example: []
default: []
must_exist: true
create_parent: true
required: true
direction: "input"
multiple: false
multiple_sep: ":"
dest: "par"
- type: "file"
name: "--output"
alternatives:
- "-o"
example: []
default: []
must_exist: true
create_parent: true
required: true
direction: "output"
multiple: false
multiple_sep: ":"
dest: "par"
- type: "integer"
name: "--column"
alternatives: []
example: []
default:
- 2
required: false
choices: []
direction: "input"
multiple: false
multiple_sep: ":"
dest: "par"
- type: "string"
name: "--id"
alternatives: []
example: []
default:
- "take_column"
required: false
choices: []
direction: "input"
multiple: false
multiple_sep: ":"
dest: "par"
argument_groups: []
resources:
- type: "python_script"
path: "script.py"
is_executable: true
parent: "file:/home/runner/work/website/website/guide/_viash_project_template/src/demo/take_column/config.vsh.yaml"
test_resources: []
status: "enabled"
requirements:
commands: []
set_wd_to_resources_dir: false
platforms:
- type: "docker"
id: "docker"
image: "python:3.10-slim"
target_organization: "viash-io/viash_project_template"
target_registry: "ghcr.io"
namespace_separator: "/"
resolve_volume: "Automatic"
chown: true
port: []
setup_strategy: "ifneedbepullelsecachedbuild"
run_args: []
target_image_source: "https://github.com/viash-io/viash_project_template"
setup:
- type: "python"
user: false
packages:
- "pandas"
pip: []
pypi: []
git: []
github: []
gitlab: []
mercurial: []
svn: []
bazaar: []
url: []
script: []
upgrade: true
test_setup: []
- type: "nextflow"
id: "nextflow"
variant: "vdsl3"
directives:
accelerator: {}
conda: []
containerOptions: []
label: []
module: []
pod: []
publishDir: []
queue: []
tag: "$id"
auto:
simplifyInput: true
simplifyOutput: true
transcript: false
publish: false
debug: false
container: "docker"
info:
config: "/home/runner/work/website/website/guide/_viash_project_template/src/demo/take_column/config.vsh.yaml"
viash_version: "0.7.1"
git_commit: "ffa7b1bee3fb192bec568a772b44c6b527cd941b"
git_remote: "https://github.com/viash-io/viash_project_template.git"
Custom batch processing
The viash ns exec
command can be used to run a command on every component.
viash ns exec "echo Hello {}"
Output
+ echo Hello /home/runner/work/website/website/guide/_viash_project_template/src/demo/remove_comments/config.vsh.yaml
Exit code: 0
Output:
+ echo Hello /home/runner/work/website/website/guide/_viash_project_template/src/demo/combine_columns/config.vsh.yaml
Hello /home/runner/work/website/website/guide/_viash_project_template/src/demo/remove_comments/config.vsh.yaml
Exit code: 0
Output:
+ echo Hello /home/runner/work/website/website/guide/_viash_project_template/src/demo/take_column/config.vsh.yaml
Hello /home/runner/work/website/website/guide/_viash_project_template/src/demo/combine_columns/config.vsh.yaml
Exit code: 0
Output:
Hello /home/runner/work/website/website/guide/_viash_project_template/src/demo/take_column/config.vsh.yaml
Tips
Parallel builds
Some commands shown above can be optimized by adding the --parallel
option:
viash ns build --parallel
will build in parallelviash ns test --parallel
will test in parallel
For example:
viash ns test --parallel
Output
The working directory for the namespace tests is /tmp/viash_ns_test15059123328229860176
namespace functionality platform test_name exit_code duration result[0m
demo remove_comments docker start [0m
demo combine_columns docker start [0m
[32m demo combine_columns docker build_executable 0 0 SUCCESS[0m
[33m demo combine_columns docker tests -1 0 MISSING[0m
no tests found
====================================================================
demo take_column docker start [0m
[32m demo take_column docker build_executable 0 0 SUCCESS[0m
[33m demo take_column docker tests -1 0 MISSING[0m
no tests found
====================================================================
[32m demo remove_comments docker build_executable 0 0 SUCCESS[0m
[32m demo remove_comments docker test.sh 0 1 SUCCESS[0m
[33mNot all configs built and tested successfully[0m
[33m2/6 tests missing[0m
[32m4/6 configs built and tested successfully[0m
Subset to components or namespaces
In a development context, one often needs to rebuild one or a few components rather than the full repository. For this situation, viash ns
has the option to specify query arguments: --query
, query_name
and query_namespace
. We refer to the reference documentation for details and illustrate the use using an example:
viash ns build --query "^.*columns$"
Output
Exporting combine_columns (demo) =docker=> /home/runner/work/website/website/guide/_viash_project_template/target/docker/demo/combine_columns
Exporting combine_columns (demo) =nextflow=> /home/runner/work/website/website/guide/_viash_project_template/target/nextflow/demo/combine_columns
[33mNot all configs built successfully[0m
[33m2/4 configs were disabled[0m
[32m2/4 configs built successfully[0m
As shown here, the query arguments accept regular expressions.