/** * Gets the heap size. * * @return The size of the executor's JVM heap in Mb. */ public int getHeapMb() { return Integer.parseInt( getValue("JAVA_OPTS", info.getCommand().getEnvironment()) .replace("-Xmx", "") .replace("M", "")); }
/** * Gets the API port. * * @return The port the executor's API will listen on. */ public int getApiPort() { return Integer.parseInt( getValue("EXECUTOR_API_PORT", info.getCommand() .getEnvironment())); }
@Test public void shouldAddJarInfoAndRemoveContainerInfo() { when(configuration.isFrameworkUseDocker()).thenReturn(false); String address = "http://localhost:1234"; when(configuration.getFrameworkFileServerAddress()).thenReturn(address); when(configuration.nativeCommand(any())).thenReturn("ls"); TaskInfoFactory factory = new TaskInfoFactory(clusterState); Date now = new DateTime().withDayOfMonth(1).withDayOfYear(1).withYear(1970).withHourOfDay(1).withMinuteOfHour(2).withSecondOfMinute(3).withMillisOfSecond(400).toDate(); when(clock.now()).thenReturn(now); when(clock.nowUTC()).thenReturn(ZonedDateTime.now(ZoneOffset.UTC)); Protos.TaskInfo taskInfo = factory.createTask(configuration, frameworkState, getOffer(frameworkState.getFrameworkID()), clock); assertFalse(taskInfo.getContainer().isInitialized()); assertTrue(taskInfo.getExecutor().getCommand().isInitialized()); assertEquals(2, taskInfo.getCommand().getUrisCount()); assertTrue(taskInfo.getCommand().getUris(0).getValue().contains(address)); }
Protos.CommandInfo cmd = executorInfo.getCommand(); Assert.assertEquals(4, cmd.getUrisList().size());
updatedTestExecutorConfig, TEST_CONFIG_ID); Assert.assertTrue(allUrisAreCacheable(updatedTask.getTaskInfo().getExecutor().getCommand().getUrisList(), true));
@Test public void testUpdateCpuConfig() { CassandraDaemonTask daemonTask = testTaskFactory.create( TEST_DAEMON_NAME, TEST_CONFIG_NAME, testTaskExecutor, CassandraConfig.DEFAULT); double newCpu = 1.0; CassandraConfig updatedConfig = CassandraConfig.create( "2.2.5", newCpu, 4096, 10240, VolumeRequirement.VolumeType.ROOT, "", HeapConfig.DEFAULT, Location.DEFAULT, 7199, false, UUID.randomUUID().toString(), CassandraApplicationConfig.builder().build()); CassandraDaemonTask updatedTask = daemonTask.updateConfig( updatedConfig, testExecutorConfig, TEST_CONFIG_ID); Assert.assertNotEquals(normalizeCassandraTaskInfo(daemonTask), normalizeCassandraTaskInfo(updatedTask)); Assert.assertEquals(newCpu, updatedTask.getConfig().getCpus(), 0.0); Assert.assertTrue(allUrisAreCacheable(updatedTask.getTaskInfo().getExecutor().getCommand().getUrisList(), false)); }
public Set<String> getURIs() { return toSet(info.getCommand().getUrisList()); }
/** * Gets the Java home. * * @return The location of the executor's local Java installation. */ public String getJavaHome() { return getValue("JAVA_HOME", info.getCommand().getEnvironment()); }
/** * Gets the command. * * @return The command used to launch the executor. */ public String getCommand() { return info.getCommand().getValue(); }
public List<Variable> getEnv() { return taskInfo.getExecutor().getCommand().getEnvironment().getVariablesList(); }