Build branch check-resources with version check-resources (cf2c8d1)

Build pipeline: viash-hub.toolbox.check-resources-vph6n

Source commit: cf2c8d1810

Source message: add mock tests
This commit is contained in:
CI
2025-06-10 14:50:16 +00:00
parent 4a4d927975
commit 448ee2c648
8 changed files with 379 additions and 246 deletions

View File

@@ -3,27 +3,33 @@ version: "check-resources"
argument_groups:
- name: "Inputs"
arguments:
- type: "file"
name: "--input"
description: "Input yaml file containing input parameters of a workflow."
- type: "integer"
name: "--tmp_space_required"
description: "Temporary space required in MB."
info: null
default:
- "input.yaml"
must_exist: true
create_parent: true
required: true
- 1000
required: false
direction: "input"
multiple: false
multiple_sep: ";"
- name: "Options"
arguments:
- type: "integer"
name: "--req_disk_space"
description: "Required disk space percentage."
name: "--publish_space_required"
description: "Publish space required in MB."
info: null
default:
- 20
required: true
- 500
required: false
direction: "input"
multiple: false
multiple_sep: ";"
- type: "file"
name: "--publish_dir"
description: "Directory where workflow outputs will be published."
info: null
must_exist: true
create_parent: true
required: false
direction: "input"
multiple: false
multiple_sep: ";"
@@ -37,7 +43,7 @@ argument_groups:
- "output.txt"
must_exist: true
create_parent: true
required: true
required: false
direction: "output"
multiple: false
multiple_sep: ";"
@@ -46,6 +52,10 @@ resources:
path: "script.sh"
is_executable: true
description: "Check for available resources on the system."
test_resources:
- type: "bash_script"
path: "test.sh"
is_executable: true
info: null
status: "enabled"
requirements:
@@ -137,7 +147,7 @@ build_info:
output: "target/nextflow/check_resources"
executable: "target/nextflow/check_resources/main.nf"
viash_version: "0.9.0"
git_commit: "bd253a050d688b378752759d8c5293f4e333ee34"
git_commit: "cf2c8d1810fd106dbf1c36a5d25e885f8285d541"
git_remote: "https://github.com/viash-hub/toolbox"
package_config:
name: "toolbox"

View File

@@ -2811,32 +2811,36 @@ meta = [
"name" : "Inputs",
"arguments" : [
{
"type" : "file",
"name" : "--input",
"description" : "Input yaml file containing input parameters of a workflow.",
"type" : "integer",
"name" : "--tmp_space_required",
"description" : "Temporary space required in MB.",
"default" : [
"input.yaml"
1000
],
"must_exist" : true,
"create_parent" : true,
"required" : true,
"required" : false,
"direction" : "input",
"multiple" : false,
"multiple_sep" : ";"
}
]
},
{
"name" : "Options",
"arguments" : [
},
{
"type" : "integer",
"name" : "--req_disk_space",
"description" : "Required disk space percentage.",
"name" : "--publish_space_required",
"description" : "Publish space required in MB.",
"default" : [
20
500
],
"required" : true,
"required" : false,
"direction" : "input",
"multiple" : false,
"multiple_sep" : ";"
},
{
"type" : "file",
"name" : "--publish_dir",
"description" : "Directory where workflow outputs will be published.",
"must_exist" : true,
"create_parent" : true,
"required" : false,
"direction" : "input",
"multiple" : false,
"multiple_sep" : ";"
@@ -2855,7 +2859,7 @@ meta = [
],
"must_exist" : true,
"create_parent" : true,
"required" : true,
"required" : false,
"direction" : "output",
"multiple" : false,
"multiple_sep" : ";"
@@ -2871,6 +2875,13 @@ meta = [
}
],
"description" : "Check for available resources on the system.",
"test_resources" : [
{
"type" : "bash_script",
"path" : "test.sh",
"is_executable" : true
}
],
"status" : "enabled",
"requirements" : {
"commands" : [
@@ -2975,7 +2986,7 @@ meta = [
"engine" : "docker|native",
"output" : "target/nextflow/check_resources",
"viash_version" : "0.9.0",
"git_commit" : "bd253a050d688b378752759d8c5293f4e333ee34",
"git_commit" : "cf2c8d1810fd106dbf1c36a5d25e885f8285d541",
"git_remote" : "https://github.com/viash-hub/toolbox"
},
"package_config" : {
@@ -3017,8 +3028,9 @@ tempscript=".viash_script.sh"
cat > "$tempscript" << VIASHMAIN
## VIASH START
# The following code has been auto-generated by Viash.
$( if [ ! -z ${VIASH_PAR_INPUT+x} ]; then echo "${VIASH_PAR_INPUT}" | sed "s#'#'\\"'\\"'#g;s#.*#par_input='&'#" ; else echo "# par_input="; fi )
$( if [ ! -z ${VIASH_PAR_REQ_DISK_SPACE+x} ]; then echo "${VIASH_PAR_REQ_DISK_SPACE}" | sed "s#'#'\\"'\\"'#g;s#.*#par_req_disk_space='&'#" ; else echo "# par_req_disk_space="; fi )
$( if [ ! -z ${VIASH_PAR_TMP_SPACE_REQUIRED+x} ]; then echo "${VIASH_PAR_TMP_SPACE_REQUIRED}" | sed "s#'#'\\"'\\"'#g;s#.*#par_tmp_space_required='&'#" ; else echo "# par_tmp_space_required="; fi )
$( if [ ! -z ${VIASH_PAR_PUBLISH_SPACE_REQUIRED+x} ]; then echo "${VIASH_PAR_PUBLISH_SPACE_REQUIRED}" | sed "s#'#'\\"'\\"'#g;s#.*#par_publish_space_required='&'#" ; else echo "# par_publish_space_required="; fi )
$( if [ ! -z ${VIASH_PAR_PUBLISH_DIR+x} ]; then echo "${VIASH_PAR_PUBLISH_DIR}" | sed "s#'#'\\"'\\"'#g;s#.*#par_publish_dir='&'#" ; else echo "# par_publish_dir="; fi )
$( if [ ! -z ${VIASH_PAR_OUTPUT+x} ]; then echo "${VIASH_PAR_OUTPUT}" | sed "s#'#'\\"'\\"'#g;s#.*#par_output='&'#" ; else echo "# par_output="; fi )
$( if [ ! -z ${VIASH_META_NAME+x} ]; then echo "${VIASH_META_NAME}" | sed "s#'#'\\"'\\"'#g;s#.*#meta_name='&'#" ; else echo "# meta_name="; fi )
$( if [ ! -z ${VIASH_META_FUNCTIONALITY_NAME+x} ]; then echo "${VIASH_META_FUNCTIONALITY_NAME}" | sed "s#'#'\\"'\\"'#g;s#.*#meta_functionality_name='&'#" ; else echo "# meta_functionality_name="; fi )
@@ -3040,12 +3052,24 @@ $( if [ ! -z ${VIASH_META_MEMORY_TIB+x} ]; then echo "${VIASH_META_MEMORY_TIB}"
$( if [ ! -z ${VIASH_META_MEMORY_PIB+x} ]; then echo "${VIASH_META_MEMORY_PIB}" | sed "s#'#'\\"'\\"'#g;s#.*#meta_memory_pib='&'#" ; else echo "# meta_memory_pib="; fi )
## VIASH END
usage_percentage=\\$(df -h "\\$(pwd)" | awk 'NR==2 {print \\$5}' | tr -d '%')
df -h "\\$(pwd)" > "\\$par_output"
#!/bin/bash
max_allowed_usage=\\$((100-par_req_disk_space))
if [ "\\$usage_percentage" -gt "\\$max_allowed_usage" ]; then
echo "WARNING: Disk usage is at \\${usage_percentage}%, exceeding maximum allowed usage of \\${max_allowed_usage}%"
# Check temporary directory space
tmp_avail_kb=\\$(df -k "\\$meta_temp_dir" | awk 'NR==2 {print \\$4}')
tmp_avail_mb=\\$((tmp_avail_kb / 1024))
echo -e "\\\\nTemporary directory (\\$meta_temp_dir) available space: \\${tmp_avail_mb}MB" >> "\\$par_output"
if [ "\\$tmp_avail_mb" -lt "\\$par_tmp_space_required" ]; then
echo "WARNING: Available temporary space (\\${tmp_avail_mb}MB) is less than required (\\${par_tmp_space_required}MB)" | tee -a "\\$par_output"
fi
# Check publish directory space if specified
publish_avail_kb=\\$(df -k "\\$par_publish_dir" | awk 'NR==2 {print \\$4}')
publish_avail_mb=\\$((publish_avail_kb / 1024))
echo -e "\\\\nPublish directory (\\$par_publish_dir) available space: \\${publish_avail_mb}MB" >> "\\$par_output"
if [ "\\$publish_avail_mb" -lt "\\$par_publish_space_required" ]; then
echo "WARNING: Available publish space (\\${publish_avail_mb}MB) is less than required (\\${par_publish_space_required}MB)" | tee -a "\\$par_output"
fi
VIASHMAIN
bash "$tempscript"

View File

@@ -1,121 +1,70 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "check_resources",
"description": "Check for available resources on the system.",
"type": "object",
"definitions": {
"inputs" : {
"title": "Inputs",
"type": "object",
"description": "No description",
"properties": {
"input": {
"type":
"string",
"description": "Type: `file`, required, default: `input.yaml`. Input yaml file containing input parameters of a workflow",
"help_text": "Type: `file`, required, default: `input.yaml`. Input yaml file containing input parameters of a workflow."
,
"default":"input.yaml"
}
}
},
"outputs" : {
"title": "Outputs",
"type": "object",
"description": "No description",
"properties": {
"output": {
"type":
"string",
"description": "Type: `file`, required, default: `$id.$key.output.txt`. Output file containing system resources details",
"help_text": "Type: `file`, required, default: `$id.$key.output.txt`. Output file containing system resources details."
,
"default":"$id.$key.output.txt"
}
}
},
"options" : {
"title": "Options",
"type": "object",
"description": "No description",
"properties": {
"req_disk_space": {
"type":
"integer",
"description": "Type: `integer`, required, default: `20`. Required disk space percentage",
"help_text": "Type: `integer`, required, default: `20`. Required disk space percentage."
,
"default":20
}
}
},
"nextflow input-output arguments" : {
"title": "Nextflow input-output arguments",
"type": "object",
"description": "Input/output parameters for Nextflow itself. Please note that both publishDir and publish_dir are supported but at least one has to be configured.",
"properties": {
"publish_dir": {
"type":
"string",
"description": "Type: `string`, required, example: `output/`. Path to an output directory",
"help_text": "Type: `string`, required, example: `output/`. Path to an output directory."
}
,
"param_list": {
"type":
"string",
"description": "Type: `string`, example: `my_params.yaml`. Allows inputting multiple parameter sets to initialise a Nextflow channel",
"help_text": "Type: `string`, example: `my_params.yaml`. Allows inputting multiple parameter sets to initialise a Nextflow channel. A `param_list` can either be a list of maps, a csv file, a json file, a yaml file, or simply a yaml blob.\n\n* A list of maps (as-is) where the keys of each map corresponds to the arguments of the pipeline. Example: in a `nextflow.config` file: `param_list: [ [\u0027id\u0027: \u0027foo\u0027, \u0027input\u0027: \u0027foo.txt\u0027], [\u0027id\u0027: \u0027bar\u0027, \u0027input\u0027: \u0027bar.txt\u0027] ]`.\n* A csv file should have column names which correspond to the different arguments of this pipeline. Example: `--param_list data.csv` with columns `id,input`.\n* A json or a yaml file should be a list of maps, each of which has keys corresponding to the arguments of the pipeline. Example: `--param_list data.json` with contents `[ {\u0027id\u0027: \u0027foo\u0027, \u0027input\u0027: \u0027foo.txt\u0027}, {\u0027id\u0027: \u0027bar\u0027, \u0027input\u0027: \u0027bar.txt\u0027} ]`.\n* A yaml blob can also be passed directly as a string. Example: `--param_list \"[ {\u0027id\u0027: \u0027foo\u0027, \u0027input\u0027: \u0027foo.txt\u0027}, {\u0027id\u0027: \u0027bar\u0027, \u0027input\u0027: \u0027bar.txt\u0027} ]\"`.\n\nWhen passing a csv, json or yaml file, relative path names are relativized to the location of the parameter file. No relativation is performed when `param_list` is a list of maps (as-is) or a yaml blob.",
"hidden": true
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/inputs"
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "check_resources",
"description": "Check for available resources on the system.",
"type": "object",
"$defs": {
"inputs": {
"title": "Inputs",
"type": "object",
"description": "No description",
"properties": {
"tmp_space_required": {
"type": "integer",
"description": "Temporary space required in MB.",
"help_text": "Type: `integer`, multiple: `False`, default: `1000`. ",
"default": 1000
},
"publish_space_required": {
"type": "integer",
"description": "Publish space required in MB.",
"help_text": "Type: `integer`, multiple: `False`, default: `500`. ",
"default": 500
},
"publish_dir": {
"type": "string",
"format": "path",
"description": "Directory where workflow outputs will be published.",
"help_text": "Type: `file`, multiple: `False`, direction: `input`. "
}
}
},
{
"$ref": "#/definitions/outputs"
"outputs": {
"title": "Outputs",
"type": "object",
"description": "No description",
"properties": {
"output": {
"type": "string",
"format": "path",
"description": "Output file containing system resources details.",
"help_text": "Type: `file`, multiple: `False`, default: `\"output.txt\"`, direction: `output`. ",
"default": "output.txt"
}
}
},
{
"$ref": "#/definitions/options"
},
{
"$ref": "#/definitions/nextflow input-output arguments"
"nextflow input-output arguments": {
"title": "Nextflow input-output arguments",
"type": "object",
"description": "Input/output parameters for Nextflow itself. Please note that both publishDir and publish_dir are supported but at least one has to be configured.",
"properties": {
"publish_dir": {
"type": "string",
"description": "Path to an output directory.",
"help_text": "Type: `string`, multiple: `False`, required, example: `\"output/\"`. "
}
}
}
]
},
"allOf": [
{
"$ref": "#/$defs/inputs"
},
{
"$ref": "#/$defs/outputs"
},
{
"$ref": "#/$defs/nextflow input-output arguments"
}
]
}