Skip to content

Commit a61861f

Browse files
committed
feat(PLAT-2723): Support creation of Seqera Compute environments
1 parent ff9446a commit a61861f

21 files changed

Lines changed: 285 additions & 3 deletions

conf/reflect-config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,12 @@
471471
"queryAllDeclaredMethods":true,
472472
"methods":[{"name":"<init>","parameterTypes":[] }]
473473
},
474+
{
475+
"name":"io.seqera.tower.cli.commands.computeenvs.add.AddSeqeraComputeCmd",
476+
"allDeclaredFields":true,
477+
"queryAllDeclaredMethods":true,
478+
"methods":[{"name":"<init>","parameterTypes":[] }]
479+
},
474480
{
475481
"name":"io.seqera.tower.cli.commands.computeenvs.add.AddSlurmCmd",
476482
"allDeclaredFields":true,
@@ -666,6 +672,12 @@
666672
"allDeclaredFields":true,
667673
"queryAllDeclaredMethods":true
668674
},
675+
{
676+
"name":"io.seqera.tower.cli.commands.computeenvs.platforms.SeqeraComputePlatform",
677+
"allDeclaredFields":true,
678+
"queryAllDeclaredMethods":true,
679+
"methods":[{"name":"<init>","parameterTypes":[] }]
680+
},
669681
{
670682
"name":"io.seqera.tower.cli.commands.computeenvs.platforms.SlurmPlatform",
671683
"allDeclaredFields":true,

src/main/java/io/seqera/tower/cli/commands/computeenvs/AddCmd.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import io.seqera.tower.cli.commands.computeenvs.add.AddK8sCmd;
3030
import io.seqera.tower.cli.commands.computeenvs.add.AddLsfCmd;
3131
import io.seqera.tower.cli.commands.computeenvs.add.AddMoabCmd;
32+
import io.seqera.tower.cli.commands.computeenvs.add.AddSeqeraComputeCmd;
3233
import io.seqera.tower.cli.commands.computeenvs.add.AddSlurmCmd;
3334
import io.seqera.tower.cli.commands.computeenvs.add.AddUgeCmd;
3435
import io.seqera.tower.cli.exceptions.ShowUsageException;
@@ -53,6 +54,7 @@
5354
AddGoogleLifeSciencesCmd.class,
5455
AddGoogleBatchCmd.class,
5556
AddAzureCmd.class,
57+
AddSeqeraComputeCmd.class
5658
}
5759
)
5860
public class AddCmd extends AbstractComputeEnvCmd {

src/main/java/io/seqera/tower/cli/commands/computeenvs/add/AbstractAddCmd.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ protected ComputeEnvAdded addComputeEnvWithLabels(PlatformEnum platform, Compute
128128
}
129129

130130
private String findWorkspaceCredentials(PlatformEnum type, Long wspId) throws ApiException {
131+
if (type == PlatformEnum.SEQERACOMPUTE_PLATFORM) {
132+
// seqera-compute handles credentials automatically
133+
return null;
134+
}
135+
131136
List<Credentials> credentials = credentialsApi().listCredentials(wspId, type.getValue()).getCredentials();
132137
if (credentials.isEmpty()) {
133138
throw new TowerException("No valid credentials found at the workspace");
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2021-2023, Seqera.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
package io.seqera.tower.cli.commands.computeenvs.add;
19+
20+
import io.seqera.tower.cli.commands.computeenvs.platforms.Platform;
21+
import io.seqera.tower.cli.commands.computeenvs.platforms.SeqeraComputePlatform;
22+
import picocli.CommandLine;
23+
24+
@CommandLine.Command(
25+
name = "seqera-compute",
26+
description = "Add new Seqera Compute environment."
27+
)
28+
public class AddSeqeraComputeCmd extends AbstractAddCmd {
29+
30+
@CommandLine.Mixin
31+
SeqeraComputePlatform platform;
32+
33+
@Override
34+
protected Platform getPlatform() {
35+
return platform;
36+
}
37+
}

src/main/java/io/seqera/tower/cli/commands/computeenvs/platforms/AbstractPlatform.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434

3535
public abstract class AbstractPlatform<T extends ComputeConfig> implements Platform {
3636

37-
@Option(names = {"--work-dir"}, description = "Work directory.", required = true)
38-
public String workDir;
39-
4037
@ArgGroup(heading = "%nStaging options:%n", validate = false)
4138
public StagingOptions staging;
4239

src/main/java/io/seqera/tower/cli/commands/computeenvs/platforms/AltairPlatform.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
public class AltairPlatform extends AbstractPlatform<AltairPbsComputeConfig> {
2929

30+
@Option(names = {"--work-dir"}, description = "Work directory.", required = true)
31+
public String workDir;
32+
3033
@Option(names = {"-u", "--user-name"}, description = "The username on the cluster used to launch the pipeline execution.")
3134
public String userName;
3235

src/main/java/io/seqera/tower/cli/commands/computeenvs/platforms/AwsBatchForgePlatform.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232

3333
public class AwsBatchForgePlatform extends AbstractPlatform<AwsBatchConfig> {
3434

35+
@Option(names = {"--work-dir"}, description = "Work directory.", required = true)
36+
public String workDir;
37+
3538
@Option(names = {"-r", "--region"}, description = "AWS region.", required = true)
3639
public String region;
3740

src/main/java/io/seqera/tower/cli/commands/computeenvs/platforms/AwsBatchManualPlatform.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
public class AwsBatchManualPlatform extends AbstractPlatform<AwsBatchConfig> {
3030

31+
@Option(names = {"--work-dir"}, description = "Work directory.", required = true)
32+
public String workDir;
33+
3134
@Option(names = {"-r", "--region"}, description = "AWS region.", required = true)
3235
public String region;
3336

src/main/java/io/seqera/tower/cli/commands/computeenvs/platforms/AzBatchForgePlatform.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535

3636
public class AzBatchForgePlatform extends AbstractPlatform<AzBatchConfig> {
3737

38+
@Option(names = {"--work-dir"}, description = "Work directory.", required = true)
39+
public String workDir;
40+
3841
@Option(names = {"-l", "--location"}, description = "The Azure location where the workload will be deployed.", required = true)
3942
public String location;
4043

src/main/java/io/seqera/tower/cli/commands/computeenvs/platforms/AzBatchManualPlatform.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
public class AzBatchManualPlatform extends AbstractPlatform<AzBatchConfig> {
3030

31+
@Option(names = {"--work-dir"}, description = "Work directory.", required = true)
32+
public String workDir;
33+
3134
@Option(names = {"-l", "--location"}, description = "The Azure location where the workload will be deployed.", required = true)
3235
public String location;
3336

0 commit comments

Comments
 (0)