Skip to content

New module section hello-compute environments #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
6 changes: 4 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "nfcore",
"image": "ghcr.io/nextflow-io/training:latest",
"build": {
"dockerfile": "../.github/gitpod.Dockerfile"
},
"remoteUser": "gitpod",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
Expand All @@ -23,7 +25,7 @@
"ms-python.vscode-pylance",
"nf-core.nf-core-extensionpack",
"nextflow.nextflow",
"codezombiech.gitignore",
"codezombiech.gitignore"
]
}
},
Expand Down
14 changes: 11 additions & 3 deletions .github/gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ RUN apt-get update --quiet && \
curl \
tree \
graphviz \
software-properties-common

software-properties-common && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Taken from: https://github.com/nf-core/tools/blob/master/nf_core/gitpod/gitpod.Dockerfile
# Install Apptainer (Singularity)
RUN add-apt-repository -y ppa:apptainer/ppa && \
apt-get update --quiet && \
apt install -y apptainer
apt install -y apptainer && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install Conda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
Expand All @@ -35,6 +38,11 @@ ENV PATH="/opt/conda/bin:$PATH"
RUN mkdir -p /workspace/data \
&& chown -R gitpod:gitpod /opt/conda /workspace/data

# Install Tower Agent
RUN curl -fSL https://github.com/seqeralabs/tower-agent/releases/latest/download/tw-agent-linux-x86_64 > tw-agent && \
chmod +x tw-agent && \
mv tw-agent /usr/local/bin/tw-agent

# Change user to gitpod
USER gitpod

Expand Down
172 changes: 169 additions & 3 deletions docs/hello_nextflow/10_hello_seqera.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,173 @@
---
title: "Part 9: Hello Seqera"
description: Get started with Seqera Platform
---

# Part 9: Hello Seqera

TODO
So far we've been running Nextflow workflows on our local machine using the command line interface.
In this section, we'll introduce you to Seqera Platform, a powerful cloud-based platform for running, monitoring, and sharing Nextflow workflows.

---
!!! tip

[Sign up](https://cloud.seqera.io/) to try Seqera for free or request a [demo](https://seqera.io/demo/) for deployments in your own on-premise or cloud environment.

You'll learn how to use Seqera Platform within Nextflow CLI command-line interface, the Seqera Platform GUI (Graphical User Interface), and the Seqera API (Application Program Interface).

--8<-- "docs/hello_nextflow/seqera/01_run_with_cli.md"

--8<-- "docs/hello_nextflow/seqera/02_run_with_launchpad.md"

--8<-- "docs/hello_nextflow/seqera/03_add_compute_environment.md"

--8<-- "docs/hello_nextflow/seqera/04_setup_launchpad.md"

!!! Warning WORK-IN-PROGRESS

Everything below this note is content that was copied from the original guide and needs to be moved or rewritten into the above sub-pages.

## Online GUI

To run using the GUI, there are three main steps:

1. Create an account and login into Seqera Platform, available free of charge, at [cloud.seqera.io](https://cloud.seqera.io).
2. Create and configure a new [compute environment](https://docs.seqera.io/platform/24.1/compute-envs/overview).
3. Start [launching pipelines](https://docs.seqera.io/platform/24.1/launch/launchpad#launchpad).

### Selecting a default compute environment

If you have more than one **Compute Environment**, you can select which one will be used by default when launching a pipeline.

1. Navigate to your [compute environments](https://docs.seqera.io/platform/24.1/compute-envs/overview).
2. Choose your default environment by selecting the **Make primary** button.

**Congratulations!**

You are now ready to launch workflows with your primary compute environment.

### Launchpad

Launchpad makes it easy for any workspace user to launch a pre-configured pipeline.

![Launchpad](img/overview_launch.png)

A pipeline is a repository containing a Nextflow workflow, a compute environment and workflow parameters.

### Pipeline Parameters Form

Launchpad automatically detects the presence of a `nextflow_schema.json` in the root of the repository and dynamically creates a form where users can easily update the parameters.

!!! info

The parameter forms view will appear if the pipeline has a Nextflow schema file for the parameters. Please refer to the [Nextflow Schema guide](https://docs.seqera.io/platform/24.1/pipeline-schema/overview) to learn more about the schema file use-cases and how to create them.

This makes it trivial for users without any expertise in Nextflow to enter their workflow parameters and launch.

![Pipeline parameters](img/launch_rnaseq_nextflow_schema.png)

### Adding a new pipeline

Adding a pipeline to the pre-saved workspace launchpad is detailed in full on the [Seqera webpage docs](https://docs.seqera.io/platform/24.1/launch/launchpad#add-new-pipeline).

In brief, these are the steps you need to follow to set up a pipeline.

1. Select the Launchpad button in the navigation bar. This will open the **Launch Form**.
2. Select a [compute environment](https://docs.seqera.io/platform/24.1/compute-envs/overview).
3. Enter the repository of the workflow you want to launch. e.g. <https://github.com/nf-core/rnaseq.git>
4. Select a workflow **Revision number**. The Git default branch (main/master) or `manifest.defaultBranch` in the Nextflow configuration will be used by default.
5. Set the **Work directory** location of the Nextflow work directory. The location associated with the compute environment will be selected by default.
6. Enter the name(s) of each of the Nextflow **Config profiles** followed by the `Enter` key. See the Nextflow [Config profiles](https://www.nextflow.io/docs/latest/config.html#config-profiles) documentation for more details.
7. Enter any workflow parameters in YAML or JSON format. YAML example:

```yaml
reads: "s3://nf-bucket/exome-data/ERR013140_{1,2}.fastq.bz2"
paired_end: true
```

8. Select Launch to begin the pipeline execution.

!!! info

Nextflow workflows are simply Git repositories and can be changed to any public or private Git-hosting platform. See [Git Integration](https://docs.seqera.io/platform/24.1/git/overview) in the Seqera Platform docs and [Pipeline Sharing](https://www.nextflow.io/docs/latest/sharing.html) in the Nextflow docs for more details.

!!! note

The credentials associated with the compute environment must be able to access the work directory.

!!! info

In the configuration, the full path to a bucket must be specified with single quotes around strings and no quotes around booleans or numbers.

!!! tip

To create your own customized Nextflow Schema for your workflow, see the examples from the `nf-core` workflows that have adopted this approach. For example, [eager](https://github.com/nf-core/eager/blob/2.3.3/nextflow_schema.json) and [rnaseq](https://github.com/nf-core/rnaseq/blob/3.0/nextflow_schema.json).

For advanced settings options check out this [page](https://docs.seqera.io/platform/24.1/launch/launchpad#advanced-settings).

There is also community support available if you get into trouble, join the Nextflow Slack by following this [link](https://www.nextflow.io/slack-invite.html).

!!! cboard-list-2 "Summary"

In this step you have learned:

1. How to create an account and login into Seqera Platform
2. How to configure your compute environment.
3. How to add, customize, and launch a pipeline with Seqera Platform.

## API

To learn more about using the Seqera Platform API, visit the [API section](https://docs.seqera.io/platform/24.1/api/overview) in the documentation.

## Workspaces and Organizations

Seqera Platform simplifies the development and execution of pipeline by providing a centralized interface for users and organizations.

Each user has a unique **workspace** where they can interact and manage all resources such as workflows, compute environments and credentials. Details of this can be found [here](https://docs.seqera.io/platform/24.1/getting-started/workspace-setup).

Organizations can have multiple workspaces with customized access for specific organization **members** and **collaborators**.

### Organization resources

You can create your own organization and participant workspace by following the docs at [Seqera](https://docs.seqera.io/platform/24.1/orgs-and-teams/workspace-management).

Seqera Platform allows the creation of multiple organizations, each of which can contain multiple workspaces with shared users and resources. This allows any organization to customize and organize the usage of resources while maintaining an access control layer for users associated with a workspace.

### Organization users

Any user can be added or removed from a particular organization or a workspace and can be allocated a specific access role within that workspace.

The Teams feature provides a way for organizations to group various users and participants together into teams. For example, `workflow-developers` or `analysts`, and apply access control to all the users within this team collectively.

For further information, please refer to the [User Management](https://docs.seqera.io/platform/24.1/orgs-and-teams/organizations) section.

### Setting up a new organization

Organizations are the top-level structure and contain Workspaces, Members, Teams and Collaborators.

To create a new Organization:

1. Click on the dropdown next to your name and select New organization to open the creation dialog.
2. On the dialog, fill in the fields as per your organization. The Name and Full name fields are compulsory.

!!! note

A valid name for the organization must follow a specific pattern. Please refer to the UI for further instructions.

3. The rest of the fields such as Description, Location, Website URL and Logo Url are optional.
4. Once the details are filled in, you can access the newly created organization using the organization’s page, which lists all of your organizations.

!!! note

It is possible to change the values of the optional fields either using the Edit option on the organization’s page or by using the Settings tab within the organization page, provided that you are the Owner of the organization.

!!! tip

A list of all the included Members, Teams and Collaborators can be found on the organization page.

!!! cboard-list-2 "Summary"

In this step you have learned:

TODO
1. How to create a new organization
2. How to access the newly created organization
3. How to change organization settings
168 changes: 168 additions & 0 deletions docs/hello_nextflow/seqera/01_run_with_cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
## 1. Use Seqera Platform to capture and monitor Nextflow jobs launched from the CLI

We'll start by using the Nextflow CLI to launch a pipeline and monitor it in Seqera Platform.
Start by logging into the [Seqera Platform](https://cloud.seqera.io/).

!!! info "Nextflow Tower"

Seqera Platform was previously known as Nextflow Tower.
You'll still see references to the previous name in environment variable and cli option names.

### 1.1. Set up your Seqera Platform token by exporting it to your environment

Follow these steps to set up your token:

1. Create a new token by clicking on the **Settings** drop-down menu:

![Create a token](seqera/img/usage_create_token.png)

2. Name your token:

![Name your token](seqera/img/usage_name_token.png)

3. Save your token safely:

![Save token](seqera/img/usage_token.png)

!!! note

Leave this browser tab open as we will need the token once more to store it as a Nextflow secret.

4. To make your token available to the Nextflow CLI, export it on the command line:

Open a terminal and type:

```bash
export TOWER_ACCESS_TOKEN=eyxxxxxxxxxxxxxxxQ1ZTE=
```

Where `eyxxxxxxxxxxxxxxxQ1ZTE=` is the token you have just created.

### 1.2. Run Nextflow cli with Seqera Platform visualizing and capturing logs

Run your Nextflow workflows as usual with the addition of the `-with-tower` command:

```bash
nextflow run nextflow-io/hello -with-tower
```

You will see output similar to the following:

```console title="Output"
N E X T F L O W ~ version 24.04.4

Launching `https://github.com/nextflow-io/hello` [evil_engelbart] DSL2 - revision: afff16a9b4 [master]

Downloading plugin [email protected]
Monitor the execution with Seqera Platform using this URL: https://cloud.seqera.io/user/kenbrewer/watch/5Gs0qqV9Y9rguE
executor > local (4)
[80/810411] process > sayHello (1) [100%] 4 of 4 ✔
Ciao world!

Bonjour world!

Hola world!

Hello world!
```

Use ++ctrl+click++ or ++cmd+click++ on the link to open it in your browser.
You'll see the Seqera Platform interface with the job finished and the logs captured.

![Seqera Platform](seqera/img/run_with_tower.png)

You will see and be able to monitor your **Nextflow jobs** in Seqera Platform.

### 1.3. Set up Seqera Platform in Nextflow configuration

Doing that token setup regularly can get bit tedious, but the same setup can be applied in configuration applied to Nexflow configuration so that it does not need to be set each time.
This can be the `nextflow.config` file of a specific project, or the global file located at `$HOME/.nextflow/config`, which will apply to all your runs.

Before we set the configuration, we need to permanently store the token in Nextflow using a [Nextflow secret](https://www.nextflow.io/docs/latest/secrets.html):

```bash
nextflow secrets set tower_access_token "eyxxxxxxxxxxxxxxxQ1ZTE="
```

We want to configure Nextflow to use Seqera Platform by default across all our pipelines, so we will open the global Nextflow configuration file (`$HOME/.nextflow/config`) for editing:

```bash
code $HOME/.nextflow/config
```

Add the following configuration to the file:

```groovy title="$HOME/.nextflow/config"
tower {
enabled = true
accessToken = secrets.tower_access_token
workspaceId = secrets.tower_workspace_id
endpoint = "https://api.cloud.seqera.io"
}
```

!!! hint "Workspace ID and Endpoint`

We haven't set `secrets.tower_workspace_id` yet, and so Nextflow will fill in an empty string for this value.
This will default to the user's workspace in Seqera Platform which is what we want for now.

The `endpoint` is the URL of the Seqera Platform API.
If your institution is running a private instance of Seqera Platform, you will want to change this to the appropriate URL.

Run your Nextflow workflows as usual:

```bash
nextflow run nextflow-io/hello
```

You will see the following output:

```console title="Output"
N E X T F L O W ~ version 24.04.4

Launching `https://github.com/nextflow-io/hello` [fabulous_euclid] DSL2 - revision: afff16a9b4 [master]

Monitor the execution with Seqera Platform using this URL: https://cloud.seqera.io/user/kenbrewer/watch/KYjRktIlOuxrh
executor > local (4)
[71/eaa915] process > sayHello (3) [100%] 4 of 4 ✔
Ciao world!

Bonjour world!

Hola world!

Hello world!
```

Note that we are logging to Seqera Platform even though we did not use the `-with-tower` command!

### 1.4. Use Seqera Platform to explore the resolved configuration of a Nextflow pipeline

Click on the link provided in the output to open the Seqera Platform for your run, then click on the `Configuration` tab.
If you ran your pipeline from the `hello_nextflow` directory, you'll see something like this:

![Seqera Platform Configuration](seqera/img/resolved_configuration.png)

Notice that configuration for our pipeline run is being run pulled from three separate files:

- `/home/gitpod/.nextflow/config` - This is the global configuration file we just added.
- `/home/gitpod/.nextflow/assets/nextflow-io/hello/nextflow.config` - This is the `nextflow.config` file from the `nextflow-io/hello` repository.
- `/workspace/gitpod/nf-training/hello-nextflow/nextflow.config` - This is the `nextflow.config` file from our current working directory.

Nextflow resolves these configurations at runtime with a [specific order of precedence](https://www.nextflow.io/docs/latest/config.html#configuration-file).
The general rule, however, is that more specific configurations override less specific ones, and config/params specified on the CLI will override defaults in the config files.

Helpfully, Seqera Platform shows us the final output of this configuration resolution process which can be very useful for debugging!

### Takeaway

You have learned how to:

- Set up your Seqera Platform token by exporting it to your environment.
- Run Nextflow CLI with Seqera Platform visualizing and capturing logs.
- Set up Seqera Platform logging by default.
- Use Seqera Platform to explore the resolved configuration of a Nextflow pipeline.

### What's next?

Learn how to launch Nextflow pipelines from Seqera Platform using the Launchpad feature.
Loading
Loading