Skip to content

♻️ refactor(cli): add -with-seqera and SEQERA_ACCESS_TOKEN as aliases for nextflow run #6168

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,9 @@ The `kuberun` command supports the following options from [`run`](#run):
- `-with-dag`
- `-N, -with-notification`
- `-with-report`
- `-with-seqera`
- `-with-spack`
- `-with-timeline`
- `-with-tower`
- `-with-trace`
- `-with-wave`
- `-with-weblog`
Expand Down Expand Up @@ -1194,6 +1194,9 @@ The `run` command is used to execute a local pipeline script or remote pipeline
`-with-report` (`report-<timestamp>.html`)
: Create workflow execution HTML report.

`-with-seqera`, `-with-tower` (`https://api.cloud.seqera.io`)
: Monitor workflow execution with [Seqera Platform](https://seqera.io/) (formerly Tower Cloud).

`-with-singularity`
: Enable process execution in a Singularity container.

Expand All @@ -1203,9 +1206,6 @@ The `run` command is used to execute a local pipeline script or remote pipeline
`-with-timeline` (`timeline-<timestamp>.html`)
: Create workflow execution timeline.

`-with-tower` (`https://api.cloud.seqera.io`)
: Monitor workflow execution with [Seqera Platform](https://seqera.io/) (formerly Tower Cloud).

`-with-trace` (`trace-<timestamp>.txt`)
: Create workflow execution trace file.

Expand Down Expand Up @@ -1271,7 +1271,7 @@ The `run` command is used to execute a local pipeline script or remote pipeline
- Execute a pipeline with integrated monitoring in [Seqera Platform](https://seqera.io).

```console
$ nextflow run nextflow-io/hello -with-tower
$ nextflow run nextflow-io/hello -with-seqera
```

- Execute a pipeline with a custom parameters file (YAML or JSON).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class CmdRun extends CmdBase implements HubOptions {
launcher.options.ansiLog = value
}

@Parameter(names = ['-with-tower'], description = 'Monitor workflow execution with Seqera Platform (formerly Tower Cloud)')
@Parameter(names = ['-with-tower', '-with-seqera'], description = 'Monitor workflow execution with Seqera Platform (formerly Tower Cloud)')
String withTower

@Parameter(names = ['-with-wave'], hidden = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class Launcher {
normalized << '-'
}

else if( current == '-with-tower' && (i==args.size() || args[i].startsWith('-'))) {
else if( (current == '-with-tower' || current == '-with-seqera') && (i==args.size() || args[i].startsWith('-'))) {
normalized << '-'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ class PlatformHelper {
/**
* Return the configured Platform access token: if `TOWER_WORKFLOW_ID` is provided in the environment, it means
* we are running in a Platform-made run and we should ONLY retrieve the token from the environment. Otherwise,
* check the configuration or fallback to the environment. If no token is found, return null.
* check the configuration or fallback to the environment. The access token can be provided via either
* SEQERA_ACCESS_TOKEN (preferred) or TOWER_ACCESS_TOKEN environment variables. If no token is found, return null.
*
* @param opts the configuration options for Platform (e.g. `session.config.navigate('tower')`)
* @param env the applicable environment variables
* @return the Platform access token
*/
static String getAccessToken(Map opts, Map<String,String> env) {
final token = env.get('TOWER_WORKFLOW_ID')
? env.get('TOWER_ACCESS_TOKEN')
: opts.containsKey('accessToken') ? opts.accessToken as String : env.get('TOWER_ACCESS_TOKEN')
? (env.get('SEQERA_ACCESS_TOKEN') ?: env.get('TOWER_ACCESS_TOKEN'))
: opts.containsKey('accessToken') ? opts.accessToken as String : (env.get('SEQERA_ACCESS_TOKEN') ?: env.get('TOWER_ACCESS_TOKEN'))
return token
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ class LauncherTest extends Specification {
launcher.normalizeArgs('run','-with-tower', '-x') == ['run', '-with-tower', '-', '-x']
launcher.normalizeArgs('run','-with-tower', 'foo.com') == ['run', '-with-tower','foo.com']

launcher.normalizeArgs('run','-with-seqera') == ['run', '-with-seqera', '-']
launcher.normalizeArgs('run','-with-seqera', '-x') == ['run', '-with-seqera', '-', '-x']
launcher.normalizeArgs('run','-with-seqera', 'foo.com') == ['run', '-with-seqera','foo.com']

launcher.normalizeArgs('run','-with-wave') == ['run', '-with-wave', '-']
launcher.normalizeArgs('run','-with-wave', '-x') == ['run', '-with-wave', '-', '-x']
launcher.normalizeArgs('run','-with-wave', 'foo.com') == ['run', '-with-wave','foo.com']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class PluginsFacade implements PluginStateListener {
}

// add tower plugin when config contains tower options
if( (Bolts.navigate(config,'tower.enabled') || Bolts.navigate(config,'fusion.enabled') || env.TOWER_ACCESS_TOKEN ) && !specs.find {it.id == 'nf-tower' } ) {
if( (Bolts.navigate(config,'tower.enabled') || Bolts.navigate(config,'fusion.enabled') || env.TOWER_ACCESS_TOKEN || env.SEQERA_ACCESS_TOKEN) && !specs.find {it.id == 'nf-tower' } ) {
specs << defaultPlugins.getPlugin('nf-tower')
}
if( (Bolts.navigate(config,'wave.enabled') || Bolts.navigate(config,'fusion.enabled')) && !specs.find {it.id == 'nf-wave' } ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,19 @@ class TowerClient implements TraceObserver {
log.info(LoggerHelper.STICKY, msg)
}

/**
* Get the access token for Seqera Platform authentication.
* When 'TOWER_WORKFLOW_ID' is provided in the env, it's a tower made launch
* therefore the access token should only be taken from the env.
* Otherwise check into the config file and fallback in the env.
* The access token can be provided via either SEQERA_ACCESS_TOKEN (preferred) or TOWER_ACCESS_TOKEN environment variables.
*/
String getAccessToken() {
// when 'TOWER_WORKFLOW_ID' is provided in the env, it's a tower made launch
// therefore the access token should only be taken from the env
// otherwise check into the config file and fallback in the env
def token = env.get('TOWER_WORKFLOW_ID')
? env.get('TOWER_ACCESS_TOKEN')
: session.config.navigate('tower.accessToken', env.get('TOWER_ACCESS_TOKEN'))
? (env.get('SEQERA_ACCESS_TOKEN') ?: env.get('TOWER_ACCESS_TOKEN'))
: session.config.navigate('tower.accessToken', env.get('SEQERA_ACCESS_TOKEN') ?: env.get('TOWER_ACCESS_TOKEN'))
if( !token )
throw new AbortOperationException("Missing Seqera Platform access token -- Make sure there's a variable TOWER_ACCESS_TOKEN in your environment")
throw new AbortOperationException("Missing Seqera Platform access token -- Make sure there's a variable SEQERA_ACCESS_TOKEN or TOWER_ACCESS_TOKEN in your environment")
return token
}

Expand Down
Loading