this.lightLDAIpPortStr = null; this.applicationContext = applicationContext; this.clock = new SystemClock(); this.runningContainers = new ConcurrentHashMap<>(); this.containerTimeOut = conf.getInt(XLearningConfiguration.XLEARNING_TASK_TIMEOUT, XLearningConfiguration.DEFAULT_XLEARNING_TASK_TIMEOUT);
static EventLogger getInstance(HiveConf conf) { if (instance == null) { synchronized (EventLogger.class) { if (instance == null) { instance = new EventLogger(conf, SystemClock.getInstance()); ShutdownHookManager.addShutdownHook(instance::shutdown); } } } return instance; } }
/** * Compute the expired date partition, using the underlying clock in UTC time. */ private static void computeExpiredDatePtn(long ttl) { // Use UTC date to ensure reader date is same on all timezones. LocalDate expiredDate = LocalDateTime.ofEpochSecond((clock.getTime() - ttl) / 1000, 0, ZoneOffset.UTC).toLocalDate(); expiredDatePtn = "date=" + DateTimeFormatter.ISO_LOCAL_DATE.format(expiredDate); }
public ContainerImpl(Configuration conf, Dispatcher dispatcher, ContainerLaunchContext launchContext, Credentials creds, NodeManagerMetrics metrics, ContainerTokenIdentifier containerTokenIdentifier, Context context) { this(conf, dispatcher, launchContext, creds, metrics, containerTokenIdentifier, context, SystemClock.getInstance().getTime()); }
public void turnOnAppActivitiesRecording(ApplicationId applicationId, double maxTime) { long startTS = SystemClock.getInstance().getTime(); long endTS = startTS + (long) (maxTime * 1000); recordingAppActivitiesUntilSpecifiedTime.put(applicationId, endTS); }
int logMaxAge = conf.getInt(XLearningConfiguration.XLEARNING_HISTORY_LOG_MAX_AGE_MS, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_LOG_MAX_AGE_MS); final Clock clock = new SystemClock(); while (!Thread.currentThread().isInterrupted()) { try {
private ProtoMessageReader<HiveHookEventProto> getTestReader(HiveConf conf, String tmpFolder) throws IOException { Path path = new Path(tmpFolder); FileSystem fs = path.getFileSystem(conf); FileStatus[] status = fs.listStatus(path); Assert.assertEquals(1, status.length); status = fs.listStatus(status[0].getPath()); Assert.assertEquals(1, status.length); DatePartitionedLogger<HiveHookEventProto> logger = new DatePartitionedLogger<>( HiveHookEventProto.PARSER, path, conf, SystemClock.getInstance()); return logger.getReader(status[0].getPath()); }
public AppActivitiesInfo(String errorMessage, String applicationId) { this.diagnostic = errorMessage; this.applicationId = applicationId; Date date = new Date(); date.setTime(SystemClock.getInstance().getTime()); this.timeStamp = date.toString(); }
@Override public long getLastHeartbeatTime() { return clock.getTime(); } @Override
victim2.setSleepAfterKill(); ControlledClock clock = new ControlledClock(new SystemClock()); clock.setTime(0); TaskExecutorServiceForTest taskExecutorService = new TaskExecutorServiceForTest(
private ApplicationReport getAppReport(String appName, ServiceClient serviceClient, long timeoutMs) throws LlapStatusCliException { Clock clock = SystemClock.getInstance(); long startTime = clock.getTime(); long timeoutTime = timeoutMs < 0 ? Long.MAX_VALUE : (startTime + timeoutMs);
public AppActivitiesInfo(List<AppAllocation> appAllocations, ApplicationId applicationId) { this.applicationId = applicationId.toString(); this.allocations = new ArrayList<>(); if (appAllocations == null) { diagnostic = "waiting for display"; Date date = new Date(); date.setTime(SystemClock.getInstance().getTime()); this.timeStamp = date.toString(); } else { for (int i = appAllocations.size() - 1; i > -1; i--) { AppAllocation appAllocation = appAllocations.get(i); AppAllocationInfo appAllocationInfo = new AppAllocationInfo( appAllocation); this.allocations.add(appAllocationInfo); } } } }
public MRAppMaster(ApplicationAttemptId applicationAttemptId, ContainerId containerId, String nmHost, int nmPort, int nmHttpPort, long appSubmitTime) { this(applicationAttemptId, containerId, nmHost, nmPort, nmHttpPort, new SystemClock(), appSubmitTime); }
Clock clock = SystemClock.getInstance(); long lastSummaryLogTime = -1;
@Override public void onContainerStarted(ContainerId containerId, Map<String, ByteBuffer> allServiceResponse) { if (LOG.isDebugEnabled()) { LOG.debug("Succeeded to start Container " + containerId); } Container container = containers.get(containerId); if (container != null) { applicationMaster.nmClientAsync.getContainerStatusAsync( containerId, container.getNodeId()); } if (applicationMaster.timelineServiceV2Enabled) { long startTime = SystemClock.getInstance().getTime(); applicationMaster.getContainerStartTimes().put(containerId, startTime); applicationMaster.publishContainerStartEventOnTimelineServiceV2( container, startTime); } if (applicationMaster.timelineServiceV1Enabled) { applicationMaster.publishContainerStartEvent( applicationMaster.timelineClient, container, applicationMaster.domainId, applicationMaster.appSubmitterUgi); } }
public MRAppMaster(ApplicationAttemptId applicationAttemptId, ContainerId containerId, String nmHost, int nmPort, int nmHttpPort, long appSubmitTime) { this(applicationAttemptId, containerId, nmHost, nmPort, nmHttpPort, new SystemClock(), appSubmitTime); }
@Test public void testPostEventLog() throws Exception { context.setHookType(HookType.POST_EXEC_HOOK); context.getPerfLogger().PerfLogBegin("test", "LogTest"); context.getPerfLogger().PerfLogEnd("test", "LogTest"); EventLogger evtLogger = new EventLogger(conf, SystemClock.getInstance()); evtLogger.handle(context); evtLogger.shutdown(); HiveHookEventProto event = loadEvent(conf, tmpFolder); Assert.assertEquals(EventType.QUERY_COMPLETED.name(), event.getEventType()); Assert.assertEquals(System.getProperty("user.name"), event.getUser()); Assert.assertEquals("test_user", event.getRequestUser()); Assert.assertEquals("test_queryId", event.getHiveQueryId()); Assert.assertEquals("test_op_id", event.getOperationId()); assertOtherInfo(event, OtherInfoType.STATUS, Boolean.TRUE.toString()); String val = findOtherInfo(event, OtherInfoType.PERF); Map<String, Long> map = new ObjectMapper().readValue(val, new TypeReference<Map<String, Long>>() {}); // This should be really close to zero. Assert.assertTrue("Expected LogTest in PERF", map.get("LogTest") < 100); }
void finishAppAllocationRecording(ApplicationId applicationId, ContainerId containerId, ActivityState appState, String diagnostic) { if (shouldRecordThisApp(applicationId)) { long currTS = SystemClock.getInstance().getTime(); AppAllocation appAllocation = appsAllocation.remove(applicationId); appAllocation.updateAppContainerStateAndTime(containerId, appState, currTS, diagnostic); List<AppAllocation> appAllocations; if (completedAppAllocations.containsKey(applicationId)) { appAllocations = completedAppAllocations.get(applicationId); } else { appAllocations = new ArrayList<>(); completedAppAllocations.put(applicationId, appAllocations); } if (appAllocations.size() == 1000) { appAllocations.remove(0); } appAllocations.add(appAllocation); if (recordingAppActivitiesUntilSpecifiedTime.get(applicationId) <= currTS) { turnOffActivityMonitoringForApp(applicationId); } } }
public StreamingContainerManager(LogicalPlan dag) { this(dag, false, new SystemClock()); }
@Test public void testFailureEventLog() throws Exception { context.setHookType(HookType.ON_FAILURE_HOOK); EventLogger evtLogger = new EventLogger(conf, SystemClock.getInstance()); evtLogger.handle(context); evtLogger.shutdown(); HiveHookEventProto event = loadEvent(conf, tmpFolder); Assert.assertEquals(EventType.QUERY_COMPLETED.name(), event.getEventType()); Assert.assertEquals(System.getProperty("user.name"), event.getUser()); Assert.assertEquals("test_user", event.getRequestUser()); Assert.assertEquals("test_queryId", event.getHiveQueryId()); Assert.assertEquals("test_op_id", event.getOperationId()); assertOtherInfo(event, OtherInfoType.STATUS, Boolean.FALSE.toString()); assertOtherInfo(event, OtherInfoType.PERF, null); }