Worker shell

The worker shell is a worker ready to run and on which you can configure shell tasks.

Prepare the configuration files

Shell tasks must be declared in a .yml file (worker.yml by convention), below an example with a Python task:

  - id: kcoloring-python
    command: python
    description: This task computes a coloration of a partial Europe map with k colors.
    - name: k
      type: NUMERIC
      description: Number of colors to be used by the coloration.
      required: true
    - name: coloration
      type: JSON
      description: "The coloration found: for each country, the associated color."

The command is the command (like in a command line shell) to run and workingDirectory is the directory where the command is ran. Make sure the command can be ran in workingDirectory (like with your command line shell in this directory).

Then, you must write a application.yml file (see the configuration of the Java worker and place it in the execution directory of the worker shell.

Run the worker shell

Using the jar

Simply use the command:

java -jar worker-shell-3.2.1.jar --worker.configurationFileName=/path/to/worker.yml

Or use an environment variable:

export WORKER_CONFIGURATIONFILENAME=/path/to/worker.yml

java -jar worker-shell-3.2.1.jar

Using gradle

You can use a build.gradle file similar to the one below:

apply plugin: 'java'

repositories {
    maven {
        url ""
        credentials  {
            username = "${decisionBrainUser}"
            password = "${decisionBrainPassword}"
        authentication {                            

dependencies {

task workerShell(type: JavaExec) {
    classpath = files(configurations.runtime.first())
    workingDir = projectDir

And a file with:


Then use:

gradle workerShell

Using Docker

You can use the Docker image dbos-worker-shell:3.2.1 available in our Docker registry. The environment variables of the image are : * WORKER_CONFIGURATIONFILENAME : path to the worker.yml file (default to worker/worker.yml) * JAR_DIR : path to the directory where the Jar is located (working directory), available as build arg too * JAR_PATH : path to the executable Jar of the worker shell, available as build arg too

The image contains only Java but is based on Debian, so you can complete your custom image by installing the packages required to run your shell tasks.

First, create your Dockerfile :

FROM dbos-worker-shell:3.2.1
# Install your libraries:
#RUN apt-get install ...

You can use the JAR_DIR build arg to contains your shell tasks and declare those shell tasks with relative path in your worker.yml file.

For example, for a Python based worker:

FROM dbos-worker-shell:3.2.1

RUN apt-get update
RUN apt-get install -y python3=3.7.3-1 python3-pip
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
RUN apt-get clean
pip3 install -i "" optimserver-workerbridge==3.2.1 

COPY <project path>/ $JAR_DIR/

Then build your image with :

docker build -t custom-worker .

Finally, to test your image, you can run it locally with :

docker run -it --rm --network host custom-worker