Skip to content
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

Launch with optimization turned off #424

Merged
merged 10 commits into from
Jul 22, 2024
8 changes: 5 additions & 3 deletions conf/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2824,7 +2824,8 @@
{
"name":"io.seqera.tower.model.PipelineOptimizationStatus",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true
"queryAllDeclaredMethods":true,
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }, {"name":"fromValue","parameterTypes":["java.lang.String"] }]
},
{
"name":"io.seqera.tower.model.PipelineSecret",
Expand Down Expand Up @@ -2895,13 +2896,14 @@
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }]
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"getLaunch","parameterTypes":[] }]
},
{
"name":"io.seqera.tower.model.SubmitWorkflowLaunchResponse",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
"allDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"setWorkflowId","parameterTypes":["java.lang.String"] }]
},
{
"name":"io.seqera.tower.model.Task",
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/io/seqera/tower/cli/commands/LaunchCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ private WorkflowLaunchRequest updateLaunchRequest(WorkflowLaunchRequest base) th
.schemaName(coalesce(adv().schemaName, base.getSchemaName()))
.pullLatest(coalesce(adv().pullLatest, base.getPullLatest()))
.stubRun(coalesce(adv().stubRun, base.getStubRun()))
.optimizationId(base.getOptimizationId())
.optimizationTargets(base.getOptimizationTargets())
.optimizationId(coalesce(adv().disableOptimization, false) ? null : base.getOptimizationId())
.optimizationTargets(coalesce(adv().disableOptimization, false) ? null : base.getOptimizationTargets())
.labelIds(base.getLabelIds())
.headJobCpus(base.getHeadJobCpus())
.headJobMemoryMb(base.getHeadJobMemoryMb());
Expand Down Expand Up @@ -245,7 +245,7 @@ protected Integer onBeforeExit(int exitCode, Response response) {

private WorkflowStatus checkWorkflowStatus(String workflowId, Long workspaceId) {
try {
return api().describeWorkflow(workflowId, workspaceId, Collections.emptyList()).getWorkflow().getStatus();
return api().describeWorkflow(workflowId, workspaceId, NO_WORKFLOW_ATTRIBUTES).getWorkflow().getStatus();
} catch (ApiException | NullPointerException e) {
return null;
}
Expand Down Expand Up @@ -373,6 +373,9 @@ public static class AdvancedOptions {
@Option(names = {"--workspace-secrets"}, split = ",", description = "Pipeline Secrets required by the pipeline execution. Those secrets must be defined in the launching workspace.")
public List<String> workspaceSecrets;

@Option(names = {"--disable-optimization"}, description = "Turn off the optimization for the pipeline before launching.")
public Boolean disableOptimization;

}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,22 @@
import io.seqera.tower.model.GetProgressResponse;
import io.seqera.tower.model.Launch;
import io.seqera.tower.model.WorkflowLoad;
import io.seqera.tower.model.WorkflowQueryAttribute;
import picocli.CommandLine.Command;

import java.util.List;

@Command
abstract public class AbstractRunsCmd extends AbstractApiCmd {

public AbstractRunsCmd() {
}

protected DescribeWorkflowResponse workflowById(Long workspaceId, String id) throws ApiException {
DescribeWorkflowResponse workflowResponse = api().describeWorkflow(id, workspaceId, NO_WORKFLOW_ATTRIBUTES);
protected DescribeWorkflowResponse workflowById(Long workspaceId, String id, List<WorkflowQueryAttribute> extraQueryAttributes) throws ApiException {

List<WorkflowQueryAttribute> wfQueryAttrs = (extraQueryAttributes == null) ? NO_WORKFLOW_ATTRIBUTES : extraQueryAttributes;

DescribeWorkflowResponse workflowResponse = api().describeWorkflow(id, workspaceId, wfQueryAttrs);

if (workflowResponse == null) {
throw new RunNotFoundException(id, workspaceRef(workspaceId));
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/io/seqera/tower/cli/commands/runs/DumpCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.seqera.tower.model.Workflow;
import io.seqera.tower.model.WorkflowLoad;
import io.seqera.tower.model.WorkflowMetrics;
import io.seqera.tower.model.WorkflowQueryAttribute;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
Expand Down Expand Up @@ -169,8 +170,10 @@ private void dumpTasks(PrintWriter progress, TarArchiveOutputStream out, Long ws
private void dumpWorkflowDetails(PrintWriter progress, TarArchiveOutputStream out, Long wspId) throws ApiException, IOException {
progress.println(ansi("- Workflow details"));

// General workflow info
DescribeWorkflowResponse workflowResponse = workflowById(wspId, id);
// General workflow info including:
// + labels
// + optimization status
DescribeWorkflowResponse workflowResponse = workflowById(wspId, id, List.of(WorkflowQueryAttribute.LABELS, WorkflowQueryAttribute.OPTIMIZED));
Workflow workflow = workflowResponse.getWorkflow();
if (workflow == null) {
throw new TowerException("Unknown workflow");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected Response exec() throws ApiException, IOException {
throw new TowerException("Not allowed to change '--work-dir' option when resuming. Use '--no-resume' if you want to relaunch into a different working directory without resuming.");
}

Workflow workflow = workflowById(wspId, id).getWorkflow();
Workflow workflow = workflowById(wspId, id, NO_WORKFLOW_ATTRIBUTES).getWorkflow();
WorkflowLaunchResponse launch = workflowLaunchResponse(workflow.getId(), wspId);

ComputeEnvResponseDto ce = null;
Expand Down
Loading
Loading