Skip to content

Commit

Permalink
Use Config
Browse files Browse the repository at this point in the history
Signed-off-by: Hongxin Liang <[email protected]>
  • Loading branch information
honnix committed Sep 28, 2023
1 parent 0290a5b commit a6b9bc2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class JFlyteContainer extends GenericContainer<JFlyteContainer> {
static final String IMAGE_NAME;
static final Map<String, String> envVars =
ImmutableMap.<String, String>builder()
.put("FLYTE_PLATFORM_URL", "flyte:30081")
.put("FLYTE_PLATFORM_INSECURE", "True")
.put("FLYTE_AWS_ENDPOINT", "http://flyte:30084")
.put("FLYTE_AWS_ACCESS_KEY_ID", "minio")
.put("FLYTE_AWS_SECRET_ACCESS_KEY", "miniostorage")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static java.lang.System.getenv;

import com.google.auto.value.AutoValue;
import javax.annotation.Nullable;

/** Configuration values available only during task execution. */
@AutoValue
Expand All @@ -31,18 +32,12 @@ public abstract class ExecutionConfig {

public abstract String version();

public abstract String platformUrl();

public abstract boolean platformInsecure();

public static ExecutionConfig load() {
return ExecutionConfig.builder()
.project(getenv("FLYTE_INTERNAL_PROJECT"))
.domain(getenv("FLYTE_INTERNAL_DOMAIN"))
.version(getenv("FLYTE_INTERNAL_VERSION"))
.image(getenv("FLYTE_INTERNAL_IMAGE"))
.platformUrl(getenv("FLYTE_PLATFORM_URL"))
.platformInsecure(Boolean.parseBoolean(getenv("FLYTE_PLATFORM_INSECURE")))
.build();
}

Expand All @@ -61,10 +56,6 @@ public abstract static class Builder {

public abstract Builder image(String image);

public abstract Builder platformUrl(String platformUrl);

public abstract Builder platformInsecure(boolean platformInsecure);

public abstract ExecutionConfig build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private void execute() {
});

DynamicJobSpec rewrittenFutures =
rewrite(executionConfig, futures, taskTemplates, workflowTemplates);
rewrite(config, executionConfig, futures, taskTemplates, workflowTemplates);

if (rewrittenFutures.nodes().isEmpty()) {
Map<String, Literal> outputs = getLiteralMap(rewrittenFutures.outputs());
Expand All @@ -197,16 +197,17 @@ private void execute() {
}

static DynamicJobSpec rewrite(
ExecutionConfig config,
Config config,
ExecutionConfig executionConfig,
DynamicJobSpec spec,
Map<TaskIdentifier, TaskTemplate> taskTemplates,
Map<WorkflowIdentifier, WorkflowTemplate> workflowTemplates) {

WorkflowNodeVisitor workflowNodeVisitor =
IdentifierRewrite.builder()
.domain(config.domain())
.project(config.project())
.version(config.version())
.domain(executionConfig.domain())
.project(executionConfig.project())
.version(executionConfig.version())
.adminClient(
FlyteAdminClient.create(config.platformUrl(), config.platformInsecure(), null))
.build()
Expand Down

0 comments on commit a6b9bc2

Please sign in to comment.