## Boutiques Descriptor examples

## Example1

A more elaborate example of how a tool within a Docker container is executed by Boutiques.
Many tests in `./boutiques/tests/` use this tool to validate Boutiques features.

*   Dockerfile

      Configures the container in which the example tool will run.

*   exampleTool1.py

      Example tool to be executed by Boutiques within the container.
      This tool is written in Python for simplicity, but can be any tool with a CLI.

*   example1_docker.json

      Descriptor to describe the tool to be executed by Boutiques.

*   invocation.json

      During the tools' execution, arguments in the invocation will be passed to the tool by Boutiques.

## Sample execution walk-through

Run the following command in the base directory eg: \[...\]/Boutiques/

`bosh exec launch boutiques/schema/examples/example1/example1_docker.json -i boutiques/schema/examples/example1/invocation.json`

### What each output section means

`Shell command`

Command sent to container, this is generated by Boutiques according to values given in the invocation and the descriptor's inputs section.
  ```
  exampleTool1.py -c ./test_temp/config.txt -i 'fo '"'"'; echo FAIL' bar -s 'coin;plop' -t /test_mount1 /test_mount2 -e val1 ./pyproject.toml 'log-4-coin;plop.txt' -l 1 2 3
  ```

`Container location`

Information about where the container is found.
```
Local copy
```

`Container command`

Command sent to container manager, in this case Docker, to configure the current execution's docker image. This is generated by Boutiques.
```
docker run --entrypoint=/bin/sh --rm  -e ENVAR='theValue'  -v [...]/boutiques:[...]/boutiques -v [...]/boutiques/pyproject.toml:[...]/boutiques/pyproject.toml -v /test_mount1:/test_mount1 -v /test_mount2:/test_mount2 -w [...]/boutiques -e HOME=$PWD boutiques/example1:test [...]/boutiques/temp-500118712217-1595528604456.localExec.boshjob.sh
```

### Execution output section

The following section includes all the output information given by the tool after it has been executed.
```
Exit code
0
Std out
This is stdout
Std err
This is stderr
Error message

Output files
        - ./test_temp/log-4-coin;plop.txt (logfile, Required)
        - ./test_temp/config.txt (config_file, Required)
Missing files

```

## Example2

A simple tool that takes in a list of string inputs and outputs them in a `log.txt` file. Since no container information is given in the descriptor, the shell command is executed on the local system.

## Example3

A simple tool that takes in a list of string inputs and outputs them in a `log.txt` file. Executed in a container.

## fsl_bet

A real-world example with [fsl_bet](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/BET), a tutorial using this example can be found [HERE](https://nbviewer.jupyter.org/github/boutiques/tutorial/blob/master/notebooks/boutiques-tutorial.ipynb).
