@Test public void shouldPropagateCreateWorkflowToStub() { String nodeId = "node"; WorkflowIdentifier identifier = WorkflowIdentifier.builder() .domain(DOMAIN) .project(PROJECT) .name(WF_NAME) .version(WF_VERSION) .build(); TaskNode taskNode = TaskNode.builder() .referenceId( PartialTaskIdentifier.builder() .domain(DOMAIN) .project(PROJECT) .name(TASK_NAME) .version(TASK_VERSION) .build()) .build(); Node node = Node.builder() .id(nodeId) .taskNode(taskNode) .inputs( ImmutableList.of( Binding.builder() .var_(VAR_NAME) .binding(BindingData.of(Scalar.of(Primitive.ofString(SCALAR)))) .build())) .upstreamNodeIds(emptyList()) .build(); TypedInterface interface_ = TypedInterface.builder().inputs(ImmutableMap.of()).outputs(ImmutableMap.of()).build(); WorkflowTemplate template = WorkflowTemplate.builder() .nodes(ImmutableList.of(node)) .metadata(WorkflowMetadata.builder().build()) .interface_(interface_) .outputs(ImmutableList.of()) .build(); client.createWorkflow(identifier, template); assertThat( stubService.createWorkflowRequest, equalTo( WorkflowOuterClass.WorkflowCreateRequest.newBuilder() .setId(newIdentifier(ResourceType.WORKFLOW, WF_NAME, WF_VERSION)) .setSpec(newWorkflowSpec(nodeId)) .build())); }
void createWorkflow(WorkflowIdentifier id, WorkflowTemplate template) { LOG.debug("createWorkflow {}", id); WorkflowOuterClass.WorkflowCreateResponse response = stub.createWorkflow( WorkflowOuterClass.WorkflowCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( WorkflowOuterClass.WorkflowSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating workflow: %s", id); }
FlyteAdminClient implements AutoCloseable { void createWorkflow(WorkflowIdentifier id, WorkflowTemplate template) { LOG.debug("createWorkflow {}", id); WorkflowOuterClass.WorkflowCreateResponse response = stub.createWorkflow( WorkflowOuterClass.WorkflowCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( WorkflowOuterClass.WorkflowSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating workflow: %s", id); } }
FlyteAdminClient implements AutoCloseable { void createWorkflow(WorkflowIdentifier id, WorkflowTemplate template) { LOG.debug("createWorkflow {}", id); WorkflowOuterClass.WorkflowCreateResponse response = stub.createWorkflow( WorkflowOuterClass.WorkflowCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( WorkflowOuterClass.WorkflowSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating workflow: %s", id); } @VisibleForTesting  FlyteAdminClient(AdminServiceGrpc.AdminServiceBlockingStub stub, ManagedChannel channel); }
FlyteAdminClient implements AutoCloseable { void createWorkflow(WorkflowIdentifier id, WorkflowTemplate template) { LOG.debug("createWorkflow {}", id); WorkflowOuterClass.WorkflowCreateResponse response = stub.createWorkflow( WorkflowOuterClass.WorkflowCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( WorkflowOuterClass.WorkflowSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating workflow: %s", id); } @VisibleForTesting  FlyteAdminClient(AdminServiceGrpc.AdminServiceBlockingStub stub, ManagedChannel channel); @Override void close(); }
FlyteAdminClient implements AutoCloseable { void createWorkflow(WorkflowIdentifier id, WorkflowTemplate template) { LOG.debug("createWorkflow {}", id); WorkflowOuterClass.WorkflowCreateResponse response = stub.createWorkflow( WorkflowOuterClass.WorkflowCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( WorkflowOuterClass.WorkflowSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating workflow: %s", id); } @VisibleForTesting  FlyteAdminClient(AdminServiceGrpc.AdminServiceBlockingStub stub, ManagedChannel channel); @Override void close();  }