@Test public void shouldPropagateCreateTaskToStub() { TaskIdentifier identifier = TaskIdentifier.builder() .domain(DOMAIN) .project(PROJECT) .name(TASK_NAME) .version(TASK_VERSION) .build(); TypedInterface interface_ = TypedInterface.builder() .inputs(ImmutableMap.of("x", createVar(SimpleType.STRING))) .outputs(ImmutableMap.of("y", createVar(SimpleType.INTEGER))) .build(); Container container = Container.builder() .command(ImmutableList.of(COMMAND)) .args(ImmutableList.of()) .image(IMAGE_NAME) .env(ImmutableList.of(KeyValuePair.of("key", "value"))) .build(); TaskTemplate template = TaskTemplate.builder().container(container).interface_(interface_).build(); client.createTask(identifier, template); assertThat( stubService.createTaskRequest, equalTo( TaskOuterClass.TaskCreateRequest.newBuilder() .setId(newIdentifier(ResourceType.TASK, TASK_NAME, TASK_VERSION)) .setSpec(newTaskSpec()) .build())); }
void createTask(TaskIdentifier id, TaskTemplate template) { LOG.debug("createTask {}", id); TaskOuterClass.TaskCreateResponse response = stub.createTask( TaskOuterClass.TaskCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( TaskOuterClass.TaskSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating task: %s", id); }
FlyteAdminClient implements AutoCloseable { void createTask(TaskIdentifier id, TaskTemplate template) { LOG.debug("createTask {}", id); TaskOuterClass.TaskCreateResponse response = stub.createTask( TaskOuterClass.TaskCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( TaskOuterClass.TaskSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating task: %s", id); } }
FlyteAdminClient implements AutoCloseable { void createTask(TaskIdentifier id, TaskTemplate template) { LOG.debug("createTask {}", id); TaskOuterClass.TaskCreateResponse response = stub.createTask( TaskOuterClass.TaskCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( TaskOuterClass.TaskSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating task: %s", id); } @VisibleForTesting  FlyteAdminClient(AdminServiceGrpc.AdminServiceBlockingStub stub, ManagedChannel channel); }
FlyteAdminClient implements AutoCloseable { void createTask(TaskIdentifier id, TaskTemplate template) { LOG.debug("createTask {}", id); TaskOuterClass.TaskCreateResponse response = stub.createTask( TaskOuterClass.TaskCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( TaskOuterClass.TaskSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating task: %s", id); } @VisibleForTesting  FlyteAdminClient(AdminServiceGrpc.AdminServiceBlockingStub stub, ManagedChannel channel); @Override void close(); }
FlyteAdminClient implements AutoCloseable { void createTask(TaskIdentifier id, TaskTemplate template) { LOG.debug("createTask {}", id); TaskOuterClass.TaskCreateResponse response = stub.createTask( TaskOuterClass.TaskCreateRequest.newBuilder() .setId(ProtoUtil.serialize(id)) .setSpec( TaskOuterClass.TaskSpec.newBuilder() .setTemplate(ProtoUtil.serialize(template)) .build()) .build()); verifyNotNull(response, "Unexpected null response when creating task: %s", id); } @VisibleForTesting  FlyteAdminClient(AdminServiceGrpc.AdminServiceBlockingStub stub, ManagedChannel channel); @Override void close();  }