Skip to content

Commit

Permalink
allow local command to accept manifest state to test empty or other v…
Browse files Browse the repository at this point in the history
…alid states locally
  • Loading branch information
cwensel committed Jul 31, 2023
1 parent 61b31b1 commit 8febd60
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package clusterless.command;

import clusterless.model.manifest.ManifestState;
import picocli.CommandLine;

/**
Expand Down Expand Up @@ -37,6 +38,12 @@ public class LocalCommandOptions extends ProjectCommandOptions {
)
String role;

@CommandLine.Option(
names = {"-s", "--manifest-state"},
description = "manifest state"
)
ManifestState manifestState = ManifestState.complete;

public String arc() {
return arc;
}
Expand All @@ -48,4 +55,8 @@ public String lotId() {
public String role() {
return role;
}

public ManifestState manifestState() {
return manifestState;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

package clusterless.managed.component;

import clusterless.model.manifest.ManifestState;

import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -97,5 +99,5 @@ public Command build() {
}
}

List<Command> commands(String role, String lotId);
List<Command> commands(String role, String lotId, ManifestState manifestState);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import clusterless.json.JSONUtil;
import clusterless.managed.component.ArcLocalExecutor;
import clusterless.model.deploy.Placement;
import clusterless.model.manifest.ManifestState;
import clusterless.substrate.aws.arc.props.ArcEnvBuilder;
import clusterless.substrate.aws.event.ArcWorkloadContext;

Expand Down Expand Up @@ -56,10 +57,10 @@ public BatchExecArcLocalExecutor(Placement placement, BatchExecArc arc) {
}

@Override
public List<Command> commands(String role, String lotId) {
public List<Command> commands(String role, String lotId, ManifestState manifestState) {
ArcEnvBuilder arcEnvBuilder = new ArcEnvBuilder(placement, arc);
Map<String, String> arcEnvironment = arcEnvBuilder.asEnvironment();
ArcWorkloadContext arcWorkloadContext = arcEnvBuilder.execContext(role, lotId);
ArcWorkloadContext arcWorkloadContext = arcEnvBuilder.execContext(role, lotId, manifestState);

Map<String, String> localComments = new LinkedHashMap<>();
Map<String, String> localEnvironment = new LinkedHashMap<>(arcEnvironment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ public Map<String, String> asEnvironment() {
}

@NotNull
public ArcWorkloadContext execContext(String role, String lotId) {
public ArcWorkloadContext execContext(String role, String lotId, ManifestState manifestState) {
URI manifest = arcProps.sourceManifestPaths()
.get(role)
.withState(ManifestState.complete)
.withState(manifestState)
.withLot(lotId)
.uri();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Integer call() throws Exception {

ArcLocalExecutor executor = executorFor(deployable.placement(), arc);

List<ArcLocalExecutor.Command> commands = executor.commands(commandOptions.role(), commandOptions.lotId());
List<ArcLocalExecutor.Command> commands = executor.commands(commandOptions.role(), commandOptions.lotId(), commandOptions.manifestState());

ShellWriter shellWriter = new ShellWriter(Runtimes.current());

Expand Down

0 comments on commit 8febd60

Please sign in to comment.