---
# System prepended metadata

title: 'AWS/GCP execution [issue_5](https://github.com/dib-lab/2020-nih-r03-ihmp/issues/5)'
tags: [dib-lab]

---

###### tags: `dib-lab`
# AWS/GCP execution [issue_5](https://github.com/dib-lab/2020-nih-r03-ihmp/issues/5)


## CWL workflow

### Installation

using conda

```
conda install -c conda-forge cwltool -y
pip install cwlref-runner
```

### Workflow files

File name: `grist.cwl`

```
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool
baseCommand: [make, test]
hints:
  DockerRequirement:
    dockerPull: "mlim13/ggrist:tag0"
inputs:
  grist_directory:
    type: string
    inputBinding:
        position: 1
        prefix: --directory
outputs:
  example_out:
    type: stdout
stdout: grist_stdout.txt
```

File name: `grist-job.yml`

```
grist_directory: /usr/genome-grist/
```

### Running


Run with the command `cwltool --no-read-only grist.cwl grist-job.yml`

> make sure `docker` is installed. There's another way to run with `singularity` but let's just test with docker for now.


### ~~Output~~ ~~[Error]~~

Resolved by running with `cwltool` instead of `cwl-runner` and passing the `--no-read-only` flag to allow writing in the container.

```
INFO /root/miniconda3/bin/cwl-runner 3.0.20201203173111
INFO Resolved 'grist.cwl' to 'file:///root/issue5/grist.cwl'
INFO [job grist.cwl] /tmp/d6t7e7av$ docker \
    run \
    -i \
    --mount=type=bind,source=/tmp/d6t7e7av,target=/PBVADA \
    --mount=type=bind,source=/tmp/t3kth0_3,target=/tmp \
    --workdir=/PBVADA \
    --read-only=true \
    --log-driver=none \
    --user=0:0 \
    --rm \
    --env=TMPDIR=/tmp \
    --env=HOME=/PBVADA \
    --cidfile=/tmp/o6eqqoj7/20210102182328-261586.cid \
    mlim13/ggrist:tag0 \
    make \
    test \
    --directory \
    /usr/genome-grist/ > /tmp/d6t7e7av/grist_stdout.txt
Traceback (most recent call last):
  File "/root/miniconda3/bin/snakemake", line 8, in <module>
    sys.exit(main())
  File "/root/miniconda3/lib/python3.8/site-packages/snakemake/__init__.py", line 2562, in main
    success = snakemake(
  File "/root/miniconda3/lib/python3.8/site-packages/snakemake/__init__.py", line 525, in snakemake
    logger.setup_logfile()
  File "/root/miniconda3/lib/python3.8/site-packages/snakemake/logging.py", line 137, in setup_logfile
    os.makedirs(os.path.join(".snakemake", "log"), exist_ok=True)
  File "/root/miniconda3/lib/python3.8/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/root/miniconda3/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '.snakemake'
Error in snakemake invocation: Command '['snakemake', '-s', '/usr/genome-grist/genome_grist/conf/Snakefile', '-j', '1', '--use-conda', 'summarize', 'make_sgc_conf', '-j', '8', '-p', '--configfile', '/usr/genome-grist/genome_grist/conf/defaults.conf', '/usr/genome-grist/genome_grist/conf/system.conf', 'tests/test-data/HSMA33MX.conf']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/root/miniconda3/bin/snakemake", line 8, in <module>
    sys.exit(main())
  File "/root/miniconda3/lib/python3.8/site-packages/snakemake/__init__.py", line 2562, in main
    success = snakemake(
  File "/root/miniconda3/lib/python3.8/site-packages/snakemake/__init__.py", line 525, in snakemake
    logger.setup_logfile()
  File "/root/miniconda3/lib/python3.8/site-packages/snakemake/logging.py", line 137, in setup_logfile
    os.makedirs(os.path.join(".snakemake", "log"), exist_ok=True)
  File "/root/miniconda3/lib/python3.8/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/root/miniconda3/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '.snakemake'
Error in snakemake invocation: Command '['snakemake', '-s', '/usr/genome-grist/genome_grist/conf/Snakefile', '-j', '1', '--use-conda', 'summarize', 'make_sgc_conf', '-j', '8', '-p', '--configfile', '/usr/genome-grist/genome_grist/conf/defaults.conf', '/usr/genome-grist/genome_grist/conf/system.conf', 'tests/test-data/HSMA33MX.conf']' returned non-zero exit status 1.
INFO [job grist.cwl] Max memory used: 31MiB
INFO [job grist.cwl] completed success
{
    "example_out": {
        "location": "file:///root/issue5/grist_stdout.txt",
        "basename": "grist_stdout.txt",
        "class": "File",
        "checksum": "sha1$5ca595197b5384d01635196b13f2caa266080f4b",
        "size": 247,
        "path": "/root/issue5/grist_stdout.txt"
    }
}
INFO Final process status is success
```