use of net.minecraft.server.v1_7_R4.Container in project seldon-core by SeldonIO.
the class PredictorBean method predictorStateFromPredictorSpec.
// TODO
public PredictorState predictorStateFromPredictorSpec(PredictorSpec predictorSpec) {
// Boolean enabled = PredictorSpec.getEnabled();
Boolean enabled = true;
PredictiveUnit rootUnit = predictorSpec.getGraph();
Map<String, Container> containersMap = new HashMap<String, Container>();
for (Container container : predictorSpec.getComponentSpec().getSpec().getContainersList()) {
containersMap.put(container.getName(), container);
}
PredictiveUnitState rootState = new PredictiveUnitState(rootUnit, containersMap);
return new PredictorState(rootUnit.getName(), rootState, enabled);
}
use of net.minecraft.server.v1_7_R4.Container in project pravega by pravega.
the class BookkeeperService method createBookieApp.
private App createBookieApp() {
App app = new App();
app.setId(this.id);
app.setCpus(cpu);
app.setMem(mem);
app.setInstances(instances);
app.setConstraints(setConstraint("hostname", "UNIQUE"));
app.setContainer(new Container());
app.getContainer().setType(CONTAINER_TYPE);
app.getContainer().setDocker(new Docker());
app.getContainer().getDocker().setImage(IMAGE_PATH + "/nautilus/bookkeeper:" + PRAVEGA_VERSION);
Collection<Volume> volumeCollection = new ArrayList<>();
volumeCollection.add(createVolume("/bk", "mnt", "RW"));
// TODO: add persistent volume (see issue https://github.com/pravega/pravega/issues/639)
app.getContainer().setVolumes(volumeCollection);
app.setPorts(Arrays.asList(BK_PORT));
app.setRequirePorts(true);
// set env
String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;
Map<String, Object> map = new HashMap<>();
map.put("ZK_URL", zk);
map.put("ZK", zk);
map.put("bookiePort", String.valueOf(BK_PORT));
map.put("DLOG_EXTRA_OPTS", "-Xms512m");
app.setEnv(map);
// healthchecks
List<HealthCheck> healthCheckList = new ArrayList<>();
healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, BK_PORT));
app.setHealthChecks(healthCheckList);
return app;
}
use of net.minecraft.server.v1_7_R4.Container in project pravega by pravega.
the class ZookeeperService method createZookeeperApp.
private App createZookeeperApp() {
App app = new App();
app.setId(this.id);
app.setCpus(cpu);
app.setMem(mem);
app.setInstances(instances);
app.setContainer(new Container());
app.getContainer().setType(CONTAINER_TYPE);
app.getContainer().setDocker(new Docker());
app.getContainer().getDocker().setImage(ZK_IMAGE);
List<HealthCheck> healthCheckList = new ArrayList<>();
final HealthCheck hc = setHealthCheck(300, "TCP", false, 60, 20, 0, ZKSERVICE_ZKPORT);
healthCheckList.add(hc);
app.setHealthChecks(healthCheckList);
return app;
}
use of net.minecraft.server.v1_7_R4.Container in project mdsal by opendaylight.
the class Mdsal298Test method testKeyedDataTreeModification.
@Test
public void testKeyedDataTreeModification() throws InterruptedException, ExecutionException {
final DataTreeChangeListener<Container> listener = assertWrittenContainer(Container.QNAME, Container.class, new ContainerBuilder().build());
final DOMDataTreeWriteTransaction domTx = getDomBroker().newWriteOnlyTransaction();
domTx.put(CONFIGURATION, YangInstanceIdentifier.create(CONTAINER_NID).node(Keyed.QNAME), Builders.orderedMapBuilder().withNodeIdentifier(new NodeIdentifier(Keyed.QNAME)).addChild(Builders.mapEntryBuilder().withNodeIdentifier(NodeIdentifierWithPredicates.of(Keyed.QNAME, FOO_QNAME, "foo")).addChild(ImmutableNodes.leafNode(FOO_QNAME, "foo")).build()).addChild(Builders.mapEntryBuilder().withNodeIdentifier(NodeIdentifierWithPredicates.of(Keyed.QNAME, FOO_QNAME, "bar")).addChild(ImmutableNodes.leafNode(FOO_QNAME, "bar")).build()).build());
domTx.commit().get();
final ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
verify(listener).onDataTreeChanged(captor.capture());
Collection<DataTreeModification<Container>> capture = captor.getValue();
assertEquals(1, capture.size());
final DataTreeModification<Container> change = capture.iterator().next();
assertEquals(CONTAINER_TID, change.getRootPath());
final DataObjectModification<Container> changedContainer = change.getRootNode();
assertEquals(Item.of(Container.class), changedContainer.getIdentifier());
assertEquals(ModificationType.SUBTREE_MODIFIED, changedContainer.getModificationType());
final Container containerAfter = changedContainer.getDataAfter();
assertEquals(new ContainerBuilder().setKeyed(List.of(new KeyedBuilder().setFoo("foo").withKey(new KeyedKey("foo")).build(), new KeyedBuilder().setFoo("bar").withKey(new KeyedKey("bar")).build())).build(), containerAfter);
final Collection<? extends DataObjectModification<?>> changedChildren = changedContainer.getModifiedChildren();
assertEquals(2, changedChildren.size());
final Iterator<? extends DataObjectModification<?>> it = changedChildren.iterator();
final DataObjectModification<?> changedChild1 = it.next();
assertEquals(ModificationType.WRITE, changedChild1.getModificationType());
assertEquals(List.of(), changedChild1.getModifiedChildren());
final Keyed child1After = (Keyed) changedChild1.getDataAfter();
assertEquals("foo", child1After.getFoo());
final DataObjectModification<?> changedChild2 = it.next();
assertEquals(ModificationType.WRITE, changedChild2.getModificationType());
assertEquals(List.of(), changedChild2.getModifiedChildren());
final Keyed child2After = (Keyed) changedChild2.getDataAfter();
assertEquals("bar", child2After.getFoo());
}
use of net.minecraft.server.v1_7_R4.Container in project mdsal by opendaylight.
the class TestListSquashing method testUserOrderedList.
@Test
public void testUserOrderedList() {
final Keyed keyed = new KeyedBuilder().withKey(new KeyedKey("a")).build();
final Unkeyed unkeyed = new UnkeyedBuilder().build();
final Container cont = new ContainerBuilder().setKeyed(List.of(keyed)).setUnkeyed(List.of(unkeyed)).build();
// Non-empty Lists should be retained
assertEquals(List.of(keyed), cont.getKeyed());
assertEquals(List.of(unkeyed), cont.getUnkeyed());
}
Aggregations