public java.lang.Object getFieldValue(_Fields field) { switch (field) { case TASK_START: return get_task_start(); case TASK_END: return get_task_end(); } throw new java.lang.IllegalStateException(); }
/** * Prettified executor info. * @param e from Nimbus call * @return prettified executor info string */ public static String prettyExecutorInfo(ExecutorInfo e) { return "[" + e.get_task_start() + "-" + e.get_task_end() + "]"; }
/** * convert executors stats into a HashMap, note that ExecutorStats are remained unchanged. */ public static Map<List<Integer>, ExecutorStats> convertExecutorsStats(Map<ExecutorInfo, ExecutorStats> stats) { Map<List<Integer>, ExecutorStats> ret = new HashMap<>(); for (Map.Entry<ExecutorInfo, ExecutorStats> entry : stats.entrySet()) { ExecutorInfo executorInfo = entry.getKey(); ExecutorStats executorStats = entry.getValue(); ret.put(Lists.newArrayList(executorInfo.get_task_start(), executorInfo.get_task_end()), executorStats); } return ret; }
/** * convert thrift executor heartbeats into a java HashMap. */ public static Map<List<Integer>, Map<String, Object>> convertExecutorBeats(Map<ExecutorInfo, ExecutorBeat> beats) { Map<List<Integer>, Map<String, Object>> ret = new HashMap<>(); for (Map.Entry<ExecutorInfo, ExecutorBeat> beat : beats.entrySet()) { ExecutorInfo executorInfo = beat.getKey(); ExecutorBeat executorBeat = beat.getValue(); ret.put(Lists.newArrayList(executorInfo.get_task_start(), executorInfo.get_task_end()), convertZkExecutorHb(executorBeat)); } return ret; }
/** * convert {@link SupervisorWorkerHeartbeat} to nimbus local report executor heartbeats. */ public static Map<List<Integer>, Map<String, Object>> convertWorkerBeats(SupervisorWorkerHeartbeat workerHeartbeat) { Map<List<Integer>, Map<String, Object>> ret = new HashMap<>(); for (ExecutorInfo executorInfo : workerHeartbeat.get_executors()) { Map<String, Object> reportBeat = new HashMap<>(); reportBeat.put(ClientStatsUtil.TIME_SECS, workerHeartbeat.get_time_secs()); ret.put(Lists.newArrayList(executorInfo.get_task_start(), executorInfo.get_task_end()), reportBeat); } return ret; }
/** * Update the heartbeats for a given worker. * @param workerHeartbeat the heartbeats from the worker. * @param taskTimeoutSecs the timeout we should be looking at. */ public void updateHeartbeat(SupervisorWorkerHeartbeat workerHeartbeat, Integer taskTimeoutSecs) { Map<List<Integer>, Map<String, Object>> executorBeats = StatsUtil.convertWorkerBeats(workerHeartbeat); String topoId = workerHeartbeat.get_storm_id(); Map<List<Integer>, ExecutorCache> topoCache = cache.computeIfAbsent(topoId, MAKE_MAP); for (ExecutorInfo executorInfo : workerHeartbeat.get_executors()) { List<Integer> executor = Arrays.asList(executorInfo.get_task_start(), executorInfo.get_task_end()); final Map<String, Object> newBeat = executorBeats.get(executor); ExecutorCache currBeat = topoCache.computeIfAbsent(executor, (k) -> new ExecutorCache(newBeat)); currBeat.updateFromHb(taskTimeoutSecs, newBeat); } }
public Object getFieldValue(_Fields field) { switch (field) { case TASK_START: return get_task_start(); case TASK_END: return get_task_end(); } throw new IllegalStateException(); }