use of org.flyte.api.v1.PartialLaunchPlanIdentifier in project flytekit-java by flyteorg.
the class ProtoUtilTest method shouldSerializeWorkflowNodeForLaunchPlanRef.
@Test
void shouldSerializeWorkflowNodeForLaunchPlanRef() {
PartialLaunchPlanIdentifier launchPlanRef = PartialLaunchPlanIdentifier.builder().domain("domain").project("project").name("name").version("version").build();
WorkflowNode workflowNode = WorkflowNode.builder().reference(WorkflowNode.Reference.ofLaunchPlanRef(launchPlanRef)).build();
assertThat(ProtoUtil.serialize(workflowNode), equalTo(Workflow.WorkflowNode.newBuilder().setLaunchplanRef(IdentifierOuterClass.Identifier.newBuilder().setResourceType(LAUNCH_PLAN).setDomain("domain").setProject("project").setName("name").setVersion("version").build()).build()));
}
use of org.flyte.api.v1.PartialLaunchPlanIdentifier in project flytekit-java by flyteorg.
the class IdentifierRewriteTest method shouldRewriteWorkflowNodeForLaunchPlanRef.
@Test
void shouldRewriteWorkflowNodeForLaunchPlanRef() {
PartialLaunchPlanIdentifier identifier = PartialLaunchPlanIdentifier.builder().name("name").build();
PartialLaunchPlanIdentifier rewrittenIdentifier = PartialLaunchPlanIdentifier.builder().name("name").domain("rewritten-domain").version("rewritten-version").project("rewritten-project").build();
WorkflowNode workflowNode = WorkflowNode.builder().reference(WorkflowNode.Reference.ofLaunchPlanRef(identifier)).build();
assertThat(rewriter.visitor().visitWorkflowNode(workflowNode), equalTo(WorkflowNode.builder().reference(WorkflowNode.Reference.ofLaunchPlanRef(rewrittenIdentifier)).build()));
}
use of org.flyte.api.v1.PartialLaunchPlanIdentifier in project flytekit-java by flyteorg.
the class IdentifierRewriteTest method shouldRewriteLaunchPlanIdentifierWithLatestIdAndDomainForRewriter.
@Test
void shouldRewriteLaunchPlanIdentifierWithLatestIdAndDomainForRewriter() {
when(client.fetchLatestLaunchPlanId(NamedEntityIdentifier.builder().project("external-project").domain("rewritten-domain").name("external-lp").build())).thenReturn(LaunchPlanIdentifier.builder().project("external-project").domain("rewritten-domain").name("external-lp").version("latest-version").build());
PartialLaunchPlanIdentifier rewrittenLaunchPlanId = rewriter.apply(PartialLaunchPlanIdentifier.builder().project("external-project").name("external-lp").build());
assertThat(rewrittenLaunchPlanId, equalTo(PartialLaunchPlanIdentifier.builder().project("external-project").domain("rewritten-domain").name("external-lp").version("latest-version").build()));
}
use of org.flyte.api.v1.PartialLaunchPlanIdentifier in project flytekit-java by flyteorg.
the class SdkRemoteLaunchPlan method apply.
@Override
public SdkNode apply(SdkWorkflowBuilder builder, String nodeId, List<String> upstreamNodeIds, @Nullable SdkNodeMetadata metadata, Map<String, SdkBindingData> inputs) {
PartialLaunchPlanIdentifier workflowId = PartialLaunchPlanIdentifier.builder().name(name()).project(project()).domain(domain()).version(version()).build();
List<CompilerError> errors = Compiler.validateApply(nodeId, inputs, inputs().getVariableMap());
if (!errors.isEmpty()) {
throw new CompilerException(errors);
}
Map<String, SdkBindingData> outputs = outputs().getVariableMap().entrySet().stream().collect(toUnmodifiableMap(Map.Entry::getKey, entry -> SdkBindingData.ofOutputReference(nodeId, entry.getKey(), entry.getValue().literalType())));
return new SdkWorkflowNode(builder, nodeId, upstreamNodeIds, metadata, WorkflowNode.builder().reference(WorkflowNode.Reference.ofLaunchPlanRef(workflowId)).build(), inputs, outputs);
}
Aggregations