@Override public ApplicationId getApplicationId() { for (ChildData childData : instancesCache.getCurrentData()) { byte[] data = getWorkerData(childData, WORKER_PREFIX); if (data == null) continue; ServiceRecord sr = null; try { sr = encoder.fromBytes(childData.getPath(), data); } catch (IOException e) { LOG.error("Unable to decode data for zkpath: {}." + " Ignoring from current instances list..", childData.getPath()); continue; } String containerStr = sr.get(HiveConf.ConfVars.LLAP_DAEMON_CONTAINER_ID.varname); if (containerStr == null || containerStr.isEmpty()) continue; return ContainerId.fromString(containerStr).getApplicationAttemptId().getApplicationId(); } return null; } }
public TaskAttemptStartedEvent(TaskAttemptID attemptId, TaskType taskType, long startTime, String trackerName, int httpPort, int shufflePort, String locality, String avataar) { this(attemptId, taskType, startTime, trackerName, httpPort, shufflePort, ContainerId.fromString("container_-1_-1_-1_-1"), locality, avataar); }
@Override protected final ContainerId containerIdLookup(String containerIdStr) { return (ContainerId.fromString(containerIdStr)); } }
@Override protected final ContainerId containerIdLookup(String containerIdStr) { return (ContainerId.fromString(containerIdStr)); } }
public static ContainerId toContainerId(String containerIdStr) { return ContainerId.fromString(containerIdStr); }
@Public @Deprecated public static ContainerId toContainerId(String containerIdStr) { return ContainerId.fromString(containerIdStr); }
/** Get the ContainerId */ public ContainerId getContainerId() { return ContainerId.fromString(datum.getContainerId().toString()); } /** Get the locality */
/** * Signals the containerId * * @param containerIdStr the container id * @param command the signal command * @throws YarnException */ private void signalToContainer(String containerIdStr, SignalContainerCommand command) throws YarnException, IOException { ContainerId containerId = ContainerId.fromString(containerIdStr); sysout.println("Signalling container " + containerIdStr); client.signalToContainer(containerId, command); }
private static void loadContainerToken(RecoveredContainerTokensState state, String key, String containerIdStr, byte[] value) throws IOException { ContainerId containerId; Long expTime; try { containerId = ContainerId.fromString(containerIdStr); expTime = Long.parseLong(asString(value)); } catch (IllegalArgumentException e) { throw new IOException("Bad container token state for " + key, e); } state.activeTokens.put(containerId, expTime); }
private static Entry<ContainerId, Long> loadContainerToken(String key, String containerIdStr, byte[] value) throws IOException { ContainerId containerId; Long expTime; try { containerId = ContainerId.fromString(containerIdStr); expTime = Long.parseLong(asString(value)); } catch (IllegalArgumentException e) { throw new IOException("Bad container token state for " + key, e); } return new AbstractMap.SimpleEntry<>(containerId, expTime); }
/** * @return the ContainerId for the MRAppMaster. */ public ContainerId getContainerId() { return ContainerId.fromString(datum.getContainerId().toString()); }
/** * Signals the containerId * * @param containerIdStr the container id * @param command the signal command * @throws YarnException */ private void signalToContainer(String containerIdStr, SignalContainerCommand command) throws YarnException, IOException { ContainerId containerId = ContainerId.fromString(containerIdStr); sysout.println("Signalling container " + containerIdStr); client.signalToContainer(containerId, command); }
@Private @VisibleForTesting public ContainerReport getContainerReport(String containerIdStr) throws YarnException, IOException { return yarnClient.getContainerReport( ContainerId.fromString(containerIdStr)); }
@Test(expected = IllegalArgumentException.class) @SuppressWarnings("deprecation") public void testInvalidContainerId() { ContainerId.fromString("container_e20_1423221031460_0003_01"); }
private ContainerReport getContainerReport(String containerIdStr) throws YarnException, IOException { YarnClient yarnClient = createYarnClient(); try { return yarnClient.getContainerReport( ContainerId.fromString(containerIdStr)); } finally { yarnClient.close(); } }
@Test(expected = IllegalArgumentException.class) @SuppressWarnings("deprecation") public void testInvalidContainerId() { ContainerId.fromString("container_e20_1423221031460_0003_01"); }
@Override public Set<TimelineEntityGroupId> getTimelineEntityGroupId(String entityId, String entityType) { if (ApplicationMaster.DSEntity.DS_CONTAINER.toString().equals(entityType)) { ContainerId containerId = ContainerId.fromString(entityId); ApplicationId appId = containerId.getApplicationAttemptId() .getApplicationId(); return toEntityGroupId(appId.toString()); } return null; }
@Before public void setup() throws Exception { appId = ApplicationId.fromString("application_1518143905142_509690"); cId = ContainerId.fromString("container_e138_1518143905142_509690_01_000001"); entities = new HashMap<>(); generateEntity(); request = Mockito.mock(HttpServletRequest.class); Mockito.when(request.getRemoteUser()) .thenReturn(System.getProperty("user.name")); logWebService = new LogWebServiceTest(); }
@Test public void testContainerId() throws URISyntaxException { ContainerId id = TestContainerId.newContainerId(0, 0, 0, 0); String cid = id.toString(); assertEquals("container_0_0000_00_000000", cid); ContainerId gen = ContainerId.fromString(cid); assertEquals(gen, id); }
@Test public void testContainerId() throws URISyntaxException { ContainerId id = TestContainerId.newContainerId(0, 0, 0, 0); String cid = id.toString(); assertEquals("container_0_0000_00_000000", cid); ContainerId gen = ContainerId.fromString(cid); assertEquals(gen, id); }