Skip to content
Snippets Groups Projects
Commit 2678f5e3 authored by Vasileios Georgopoulos's avatar Vasileios Georgopoulos
Browse files

Initial commit for examples using the StreamFlow Python package

parent 3f8883b5
No related branches found
No related tags found
No related merge requests found
Showing
with 249 additions and 0 deletions
message: "Hello from StreamFlow!"
\ No newline at end of file
# CASE 1: Containerized CWL Workflow
## Description
If a CWL workflow is already designed to run inside a container (the `.cwl` file contains the `DockerRequirement`), there is no need to convert the CWL into a different format for it to work in **StreamFlow**. Instead, **StreamFlow** can execute the CWL workflow as it is, by simply running the container that the CWL specifies.
## Files
- **`workflow.cwl`**: A simple tool (not a full workflow) that runs the `echo` command inside a **Docker container** (`DockerRequirement`) using the `ubuntu:latest` image. It takes an input string (`message`) that is passed to the `echo` command.
- **`job.yml`**: It contains the input message.
- **`streamflow.yml`**: The **StreamFlow** configuration file. It defines the **CWL workflow** (`workflow.cwl`) that will be executed, uses a settings file (`job.yml`) to define input parameters, and specifies the execution environment where the workflow runs.
## Requirements
- **`StreamFlow`** python package
- **`Docker`**
## Execution
```sh
streamflow run streamflow.yml
\ No newline at end of file
version: v1.0
workflows:
example:
type: cwl
config:
file: workflow.cwl
settings: job.yml
bindings:
- step: /
target:
model: docker-example
models:
docker-example:
type: docker
config:
image: ubuntu:latest
\ No newline at end of file
cwlVersion: v1.2
class: CommandLineTool
baseCommand: echo
requirements:
DockerRequirement:
dockerPull: "ubuntu:latest"
inputs:
message:
type: string
inputBinding:
position: 1
outputs: []
\ No newline at end of file
cwlVersion: v1.2
class: CommandLineTool
baseCommand: echo
requirements:
DockerRequirement:
dockerPull: "ubuntu:latest"
inputs:
message:
type: string
inputBinding:
position: 1
outputs:
output_message:
type: File
outputBinding:
glob: output.txt
stdout: output.txt
\ No newline at end of file
message: "Hello from StreamFlow Case 2!"
\ No newline at end of file
# CASE 2: CWL Workflow With One Step
## Description
This example showcases a **CWL workflow** that executes a step inside a **Docker container** using **StreamFlow**. Unlike a single CWL tool execution, this setup involves a **workflow (`workflow.cwl`)** that orchestrates the execution of a **CWL step (`echo_tool.cwl`)**.
The workflow:
- Takes an **input string**.
- Passes it to a **command-line tool (`echo_tool.cwl`)** that writes the message to a file.
- Captures the generated output.
The execution environment is **fully containerized** via **Docker (`ubuntu:latest`)**.
## Files
- **`workflow.cwl`**: A **CWL workflow** that defines a step (`echo_step`) running **`echo_tool.cwl`** inside a **Docker container (`ubuntu:latest`)**. It passes an **input string (`message`)** to the tool and retrieves an **output file**.
- **`echo_tool.cwl`**: A **CWL CommandLineTool** that executes the **`echo`** command, writing the received message to `output.txt`. This step runs inside a **Docker container (`ubuntu:latest`)**.
- **`job.yml`**: It contains the **input message**.
- **`streamflow.yml`**: The **StreamFlow configuration file**. It defines the **CWL workflow (`workflow.cwl`)** that will be executed, uses a **settings file (`job.yml`)** to define input parameters, and specifies the **execution environment** where the workflow runs.
## Requirements
- **`StreamFlow`** python package
- **`Docker`**
## Execution
```sh
streamflow run streamflow.yml
\ No newline at end of file
version: v1.0
workflows:
example:
type: cwl
config:
file: workflow.cwl
settings: job.yml
bindings:
- step: /
target:
model: docker-example
models:
docker-example:
type: docker
config:
image: ubuntu:latest
\ No newline at end of file
cwlVersion: v1.2
class: Workflow
inputs:
message:
type: string
outputs:
output_message:
type: File
outputSource: echo_step/output_message
steps:
echo_step:
run: echo_tool.cwl
in:
message: message
out: [output_message]
\ No newline at end of file
cwlVersion: v1.2
class: CommandLineTool
baseCommand: echo
requirements:
DockerRequirement:
dockerPull: "ubuntu:latest"
inputs:
message:
type: string
inputBinding:
position: 1
outputs:
output_message:
type: File
outputBinding:
glob: output.txt
stdout: output.txt
\ No newline at end of file
message: "Hello from StreamFlow Case 3!"
\ No newline at end of file
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: "ubuntu:latest"
baseCommand: [wc, -m]
inputs:
input_file:
type: File
inputBinding:
position: 1
outputs:
length_output:
type: File
outputBinding:
glob: length.txt
stdout: length.txt
\ No newline at end of file
# CASE 2: CWL Workflow With One Step
## Description
This example showcases a **CWL workflow** that executes a step inside a **Docker container** using **StreamFlow**. Unlike a single CWL tool execution, this setup involves a **workflow (`workflow.cwl`)** that orchestrates the execution of a **CWL step (`echo_tool.cwl`)**.
The workflow:
- Takes an **input string**.
- Passes it to a **command-line tool (`echo_tool.cwl`)** that writes the message to a file.
- Passes the message to a second tool (length_tool.cwl), which prints the length of the message
- Captures the generated output.
The execution environment is **fully containerized** via **Docker (`ubuntu:latest`)**.
## Files
- **`workflow.cwl`**: A **CWL workflow** that defines two steps, (`echo_step`) running **`echo_tool.cwl`** and (`length_step`) running **`length_tool.cwl`** inside a **Docker container (`ubuntu:latest`)**.
- **`echo_tool.cwl`**: A **CWL CommandLineTool** that executes the **`echo`** command, writing the received message to `output.txt`. This step runs inside a **Docker container (`ubuntu:latest`)**.
- **`length_tool.cwl`**: A CWL CommandLineTool that calculates and prints the length of the message printed by **`echo_tool.cwl`**. This step also runs inside a Docker container (ubuntu:latest).
- **`job.yml`**: It contains the **input message**.
- **`streamflow.yml`**: The **StreamFlow configuration file**. It defines the **CWL workflow (`workflow.cwl`)** that will be executed, uses a **settings file (`job.yml`)** to define input parameters, and specifies the **execution environment** where the workflow runs.
## Requirements
- **`StreamFlow`** python package
- **`Docker`**
## Execution
```sh
streamflow run streamflow.yml
\ No newline at end of file
version: v1.0
workflows:
example:
type: cwl
config:
file: workflow.cwl
settings: job.yml
bindings:
- step: /
target:
model: docker-example
models:
docker-example:
type: docker
config:
image: ubuntu:latest
\ No newline at end of file
cwlVersion: v1.2
class: Workflow
inputs:
message:
type: string
outputs:
output_message:
type: File
outputSource: echo_step/output_message
length_message:
type: File
outputSource: length_step/length_output
steps:
echo_step:
run: echo_tool.cwl
in:
message: message
out: [output_message]
length_step:
run: length_tool.cwl
in:
input_file: echo_step/output_message
out: [length_output]
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment