use of net.minecraft.server.v1_10_R1.Container in project flytekit-java by flyteorg.
the class ProtoUtilTest method shouldSerializeContainerWithResources.
@Test
void shouldSerializeContainerWithResources() {
Container container = createContainer(Resources.builder().requests(ImmutableMap.of(Resources.ResourceName.CPU, "200m", Resources.ResourceName.MEMORY, "1Gi")).limits(ImmutableMap.of(Resources.ResourceName.CPU, "8", Resources.ResourceName.MEMORY, "32G")).build());
Tasks.Container actual = ProtoUtil.serialize(container);
assertThat(actual, equalTo(Tasks.Container.newBuilder().setImage("busybox").addCommand("bash").addAllArgs(asList("-c", "echo", "hello")).setResources(Tasks.Resources.newBuilder().addRequests(Tasks.Resources.ResourceEntry.newBuilder().setName(Tasks.Resources.ResourceName.CPU).setValue("200m").build()).addRequests(Tasks.Resources.ResourceEntry.newBuilder().setName(Tasks.Resources.ResourceName.MEMORY).setValue("1Gi").build()).addLimits(Tasks.Resources.ResourceEntry.newBuilder().setName(Tasks.Resources.ResourceName.CPU).setValue("8").build()).addLimits(Tasks.Resources.ResourceEntry.newBuilder().setName(Tasks.Resources.ResourceName.MEMORY).setValue("32G").build()).build()).build()));
}
use of net.minecraft.server.v1_10_R1.Container in project flytekit-java by flyteorg.
the class ProjectClosureTest method testCreateTaskTemplateForRunnableTask.
@Test
public void testCreateTaskTemplateForRunnableTask() {
// given
RunnableTask task = createRunnableTask(null);
String image = "my-image";
Resources expectedResources = Resources.builder().build();
// when
TaskTemplate result = ProjectClosure.createTaskTemplateForRunnableTask(task, image);
// then
Container container = result.container();
assertNotNull(container);
assertThat(container.image(), equalTo(image));
assertThat(container.resources(), equalTo(expectedResources));
assertThat(result.interface_(), equalTo(TypedInterface.builder().inputs(SdkTypes.nulls().getVariableMap()).outputs(SdkTypes.nulls().getVariableMap()).build()));
assertThat(result.custom(), equalTo(Struct.of(emptyMap())));
assertThat(result.retries(), equalTo(RetryStrategy.builder().retries(0).build()));
assertThat(result.type(), equalTo("java-task"));
}
Aggregations