- Defining parameters allows you to easily rerun, sort, and keep track of executions based on the parameter values used to run them.
- You can easily create (or copy) an execution and change the parameters in the UI, without changing your code.
- Defining parameters allows you to start creating Tasks where you run multiple parallel executions with different parameter combinations.
- Each step has its own parameter configuration in
valohai.yaml
. - A parameter can be a type of a
string
,integer
,float
, andflag
(=boolean). - Parameters are passed as command-line arguments to your code.
- Edit how parameters are passed to your code using pass-as.
- You can also parse parameter values from YAML and JSON files inside your execution. See file-based configuration.
Define parameters in R
library(optparse)
option_list <- list(
make_option("--iterations", default = 10),
)
parser <- OptionParser(option_list = option_list)
args <- parse_args(parser)
iterations <- args$iterations
write(iterations, stdout())
Create a valohai.yaml configuration file and add parameters to your step.
- Define the parameters
- Add a {parameters} placeholder after your command. Valohai will add all the parameters and values passed to your code as arguments.
- step:
name: train
image: r-base:3.4.2
command: Rscript myexample.R {parameters}
parameters:
- name: iterations
type: integer
default: 100
Comments
0 comments
Please sign in to leave a comment.