Search in sources :

Example 61 with Container

use of net.minecraft.server.v1_8_R3.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()));
}
Also used : Container(org.flyte.api.v1.Container) Tasks(flyteidl.core.Tasks) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 62 with Container

use of net.minecraft.server.v1_8_R3.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"));
}
Also used : TaskTemplate(org.flyte.api.v1.TaskTemplate) Container(org.flyte.api.v1.Container) RunnableTask(org.flyte.api.v1.RunnableTask) ByteString(com.google.protobuf.ByteString) Resources(org.flyte.api.v1.Resources) Test(org.junit.jupiter.api.Test)

Aggregations

Container (org.flyte.api.v1.Container)9 HashMap (java.util.HashMap)5 Test (org.junit.Test)5 Tasks (flyteidl.core.Tasks)4 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_11_R1.ContainerManager_v1_11_R1.SelfContainer)4 ArrayList (java.util.ArrayList)4 App (mesosphere.marathon.client.model.v2.App)4 Container (mesosphere.marathon.client.model.v2.Container)4 Docker (mesosphere.marathon.client.model.v2.Docker)4 HealthCheck (mesosphere.marathon.client.model.v2.HealthCheck)4 Container (net.minecraft.server.v1_11_R1.Container)4 Container (net.minecraft.server.v1_12_R1.Container)4 Container (net.minecraft.server.v1_16_R3.Container)4 Container (net.minecraft.server.v1_8_R3.Container)4 TaskTemplate (org.flyte.api.v1.TaskTemplate)4 Test (org.junit.jupiter.api.Test)4 Container (org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container)4 ContainerBuilder (org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.ContainerBuilder)4 TileEntityContainer (com.bgsoftware.wildchests.objects.containers.TileEntityContainer)3 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_10_R1.ContainerManager_v1_10_R1.SelfContainer)3