本文整理了Java中org.apache.hadoop.yarn.api.records.YarnApplicationState.valueOf()
方法的一些代码示例,展示了YarnApplicationState.valueOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnApplicationState.valueOf()
方法的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.YarnApplicationState
类名称:YarnApplicationState
方法名:valueOf
暂无
代码示例来源:origin: uber/AthenaX
static StateView computeState(Map<UUID, JobDefinition> jobs, Map<UUID, InstanceInfo> instances) {
// Instance ID -> JobDefinition ID
HashMap<UUID, UUID> instanceToJob = new HashMap<>();
HashMap<UUID, List<InstanceInfo>> jobInstances = new HashMap<>();
for (Map.Entry<UUID, InstanceInfo> e : instances.entrySet()) {
YarnApplicationState state = YarnApplicationState.valueOf(e.getValue().status().getState().toString());
if (!isInstanceAlive(state)) {
continue;
}
UUID jobId = e.getValue().metadata().jobDefinition();
UUID instanceId = e.getKey();
instanceToJob.put(instanceId, jobId);
if (!jobInstances.containsKey(jobId)) {
jobInstances.put(jobId, new ArrayList<>());
}
jobInstances.get(jobId).add(e.getValue());
}
jobs.keySet().stream().filter(x -> !jobInstances.containsKey(x))
.forEach(x -> jobInstances.put(x, Collections.emptyList()));
return new StateView(jobs, instances, instanceToJob, jobInstances);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
public static YarnApplicationState convertFromProtoFormat(YarnApplicationStateProto e) {
return YarnApplicationState.valueOf(e.name());
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common
public static YarnApplicationState convertFromProtoFormat(YarnApplicationStateProto e) {
return YarnApplicationState.valueOf(e.name());
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-common
public static YarnApplicationState convertFromProtoFormat(YarnApplicationStateProto e) {
return YarnApplicationState.valueOf(e.name());
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
private static Map<YarnApplicationState, Map<String, Long>> buildScoreboard(
Set<String> states, Set<String> types) {
Map<YarnApplicationState, Map<String, Long>> scoreboard
= new HashMap<YarnApplicationState, Map<String, Long>>();
// default states will result in enumerating all YarnApplicationStates
assert !states.isEmpty();
for (String state : states) {
Map<String, Long> partScoreboard = new HashMap<String, Long>();
scoreboard.put(
YarnApplicationState.valueOf(StringUtils.toUpperCase(state)),
partScoreboard);
// types is verified no to be empty
for (String type : types) {
partScoreboard.put(type, 0L);
}
}
return scoreboard;
}
代码示例来源:origin: org.apache.slider/slider-core
/**
* Extract the state of a Yarn application --state argument
* @param state state argument
* @return the application state
* @throws BadCommandArgumentsException if the argument did not match
* any known state
*/
private YarnApplicationState extractYarnApplicationState(String state) throws
BadCommandArgumentsException {
YarnApplicationState stateVal;
try {
stateVal = YarnApplicationState.valueOf(state.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException e) {
throw new BadCommandArgumentsException("Unknown state: " + state);
}
return stateVal;
}
代码示例来源:origin: apache/incubator-slider
/**
* Extract the state of a Yarn application --state argument
* @param state state argument
* @return the application state
* @throws BadCommandArgumentsException if the argument did not match
* any known state
*/
private YarnApplicationState extractYarnApplicationState(String state) throws
BadCommandArgumentsException {
YarnApplicationState stateVal;
try {
stateVal = YarnApplicationState.valueOf(state.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException e) {
throw new BadCommandArgumentsException("Unknown state: " + state);
}
return stateVal;
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
private static Map<YarnApplicationState, Map<String, Long>> buildScoreboard(
Set<String> states, Set<String> types) {
Map<YarnApplicationState, Map<String, Long>> scoreboard =
new HashMap<YarnApplicationState, Map<String, Long>>();
// default states will result in enumerating all YarnApplicationStates
assert !states.isEmpty();
for (String state : states) {
Map<String, Long> partScoreboard = new HashMap<String, Long>();
scoreboard.put(
YarnApplicationState.valueOf(StringUtils.toUpperCase(state)),
partScoreboard);
// types is verified no to be empty
for (String type : types) {
partScoreboard.put(type, 0L);
}
}
return scoreboard;
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
private static Map<YarnApplicationState, Map<String, Long>> buildScoreboard(
Set<String> states, Set<String> types) {
Map<YarnApplicationState, Map<String, Long>> scoreboard
= new HashMap<YarnApplicationState, Map<String, Long>>();
// default states will result in enumerating all YarnApplicationStates
assert !states.isEmpty();
for (String state : states) {
Map<String, Long> partScoreboard = new HashMap<String, Long>();
scoreboard.put(
YarnApplicationState.valueOf(StringUtils.toUpperCase(state)),
partScoreboard);
// types is verified no to be empty
for (String type : types) {
partScoreboard.put(type, 0L);
}
}
return scoreboard;
}
代码示例来源:origin: io.hops/hadoop-yarn-server-common
try {
YarnApplicationState.valueOf(
StringUtils.toUpperCase(paramStr.trim()));
} catch (RuntimeException e) {
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-common
try {
YarnApplicationState.valueOf(
StringUtils.toUpperCase(paramStr.trim()));
} catch (RuntimeException e) {
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-common
try {
YarnApplicationState.valueOf(
StringUtils.toUpperCase(paramStr.trim()));
} catch (RuntimeException e) {
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
try {
YarnApplicationState.valueOf(
StringUtils.toUpperCase(paramStr.trim()));
} catch (RuntimeException e) {
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
try {
YarnApplicationState.valueOf(
StringUtils.toUpperCase(paramStr.trim()));
} catch (RuntimeException e) {
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-applicationhistoryservice
private static void
validateStates(String stateQuery, Set<String> statesQuery) {
// stateQuery is deprecated.
if (stateQuery != null && !stateQuery.isEmpty()) {
statesQuery.add(stateQuery);
}
Set<String> appStates = parseQueries(statesQuery, true);
for (String appState : appStates) {
switch (YarnApplicationState.valueOf(
StringUtils.toUpperCase(appState))) {
case FINISHED:
case FAILED:
case KILLED:
continue;
default:
throw new BadRequestException("Invalid application-state " + appState
+ " specified. It should be a final state");
}
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-applicationhistoryservice
private static void
validateStates(String stateQuery, Set<String> statesQuery) {
// stateQuery is deprecated.
if (stateQuery != null && !stateQuery.isEmpty()) {
statesQuery.add(stateQuery);
}
Set<String> appStates = parseQueries(statesQuery, true);
for (String appState : appStates) {
switch (YarnApplicationState.valueOf(
StringUtils.toUpperCase(appState))) {
case FINISHED:
case FAILED:
case KILLED:
continue;
default:
throw new BadRequestException("Invalid application-state " + appState
+ " specified. It should be a final state");
}
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-applicationhistoryservice
private static void
validateStates(String stateQuery, Set<String> statesQuery) {
// stateQuery is deprecated.
if (stateQuery != null && !stateQuery.isEmpty()) {
statesQuery.add(stateQuery);
}
Set<String> appStates = parseQueries(statesQuery, true);
for (String appState : appStates) {
switch (YarnApplicationState.valueOf(
StringUtils.toUpperCase(appState))) {
case FINISHED:
case FAILED:
case KILLED:
continue;
default:
throw new BadRequestException("Invalid application-state " + appState
+ " specified. It should be a final state");
}
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-common
String[] appStateStrings = reqStateString.split(",");
for (String stateString : appStateStrings) {
reqAppStates.add(YarnApplicationState.valueOf(stateString.trim()));
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-common
String[] appStateStrings = reqStateString.split(",");
for (String stateString : appStateStrings) {
reqAppStates.add(YarnApplicationState.valueOf(stateString.trim()));
代码示例来源:origin: apache/samza
JobStatus samzaStatus = yarnStateToSamzaStatus(YarnApplicationState.valueOf(app.getState().toUpperCase()));
内容来源于网络,如有侵权,请联系作者删除!