Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • workers/base-worker
1 result
Show changes
Commits on Source (2)
docs/contents/workers/user_configuration/list_config.png

91.2 KiB

......@@ -87,6 +87,7 @@ include:
- `command`
: Custom command line to be used when launching the Docker container for
this Worker. By default, the command specified in the Dockerfile will be used.
- `shm_size`: Size of the available shared memory in `/dev/shm`. The default value is `64M`, but when training machine learning models an increase might be necessary. The given value must be either an integer, or an integer followed by a unit (`b` for bytes, `k` for kilobytes, `m` for megabytes and `g` for gigabytes). If no unit is specified, the default unit is `bytes`. See the [Docker documentation](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources).
- `environment`
: Mapping of string keys and string values to define environment variables to be
set when the Docker image runs.
......@@ -119,6 +120,7 @@ A parameter is defined using the following settings:
- `float`
- `string`
- `enum`
- `list`
- `dict`
`default`
......@@ -130,6 +132,9 @@ A parameter is defined using the following settings:
`choices`
: Optional. A list of options for `enum` type parameters.
`subtype`
: Optional. The type of the elements of `list` type parameters.
This definition allows for both validation of the input and the display of a form to make configuring workers easy for Arkindex users.
![User configuration](user_configuration/configuration_form.png "User configuration form on Arkindex")
......@@ -227,6 +232,29 @@ Which will result in the following display for the user:
![Enum-type parameter](user_configuration/enum_config.png "Example enum-type parameter.")
#### List parameters
List-type parameters must be defined using a `title`, the `list` `type` and a `subtype` for the elements inside the list. You can also set a `default` value for this parameter, which must be a list containing elements of the given `subtype`, as well as make it a `required` parameter, which prevents users from leaving it blank.
The allowed `subtype`s are `int`, `float` and `string`.
In the configuration form, list parameters are displayed as rows of input fields.
For example, a list-type parameter can be defined like this:
```yaml
a_list:
title: A List of Values
type: list
subtype: int
default: [4, 3, 12]
```
Which will result in the following display for the user:
![List-type parameter](user_configuration/list_config.png "Example list-type parameter.")
#### Dictionary parameters
Dictionary-type parameters must be defined using a `title`, the `dict` `type`. You can also set a `default` value for this parameter, which must be one a dictionary, as well as make it a `required` parameter, which prevents users from leaving it blank. You can use dictionary parameters for example to specify a correspondence between the classes that are predicted by a worker and the elements that are created on Arkindex from these predictions.
......@@ -302,6 +330,7 @@ workers:
build: project/Dockerfile
image: hub.docker.com/project/image:tag
command: python mysuperscript.py --blabla
shm_size: 128m
environment:
TOKEN: deadBeefToken
configuration:
......