本文整理汇总了Java中org.apache.kylin.job.execution.Output.getState方法的典型用法代码示例。如果您正苦于以下问题:Java Output.getState方法的具体用法?Java Output.getState怎么用?Java Output.getState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.kylin.job.execution.Output
的用法示例。
在下文中一共展示了Output.getState方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resumeAllRunningJobs
import org.apache.kylin.job.execution.Output; //导入方法依赖的package包/类
private void resumeAllRunningJobs() {
for (final String id : executableManager.getAllJobIds()) {
final Output output = executableManager.getOutput(id);
AbstractExecutable executable = executableManager.getJob(id);
if (output.getState() == ExecutableState.RUNNING && executable instanceof DefaultChainedExecutable) {
try {
if (!jobLock.isLocked(getLockPath(executable.getParam(SEGMENT_ID)))) {
executableManager.resumeRunningJobForce(executable.getId());
fetcherPool.schedule(fetcher, 0, TimeUnit.SECONDS);
}
} catch (Exception e) {
logger.error("resume the job " + id + " fail in server: " + serverName, e);
}
}
}
}
示例2: onUnlock
import org.apache.kylin.job.execution.Output; //导入方法依赖的package包/类
@Override
public void onUnlock(String path, String nodeData) {
String[] paths = path.split("/");
String segmentId = paths[paths.length - 1];
for (final String id : executableManager.getAllJobIds()) {
final Output output = executableManager.getOutput(id);
if (output.getState() == ExecutableState.RUNNING) {
AbstractExecutable executable = executableManager.getJob(id);
if (executable instanceof DefaultChainedExecutable
&& executable.getParams().get(SEGMENT_ID).equalsIgnoreCase(segmentId)
&& !nodeData.equalsIgnoreCase(serverName)) {
try {
logger.warn(nodeData + " has released the lock for: " + segmentId
+ " but the job still running. so " + serverName + " resume the job");
if (!jobLock.isLocked(getLockPath(segmentId))) {
executableManager.resumeRunningJobForce(executable.getId());
fetcherPool.schedule(fetcher, 0, TimeUnit.SECONDS);
break;
}
} catch (Exception e) {
logger.error("resume the job but fail in server: " + serverName, e);
}
}
}
}
}
示例3: formatNotifications
import org.apache.kylin.job.execution.Output; //导入方法依赖的package包/类
@Override
protected Pair<String, String> formatNotifications(ExecutableState state) {
final Output output = jobService.getOutput(getId());
String logMsg;
switch (output.getState()) {
case ERROR:
logMsg = output.getVerboseMsg();
break;
case DISCARDED:
logMsg = "";
break;
case SUCCEED:
logMsg = "";
break;
default:
return null;
}
String content = ExecutableConstants.NOTIFY_EMAIL_TEMPLATE;
content = content.replaceAll("\\$\\{job_name\\}", getName());
content = content.replaceAll("\\$\\{result\\}", state.toString());
content = content.replaceAll("\\$\\{cube_name\\}", getCubeName());
content = content.replaceAll("\\$\\{start_time\\}", new Date(getStartTime()).toString());
content = content.replaceAll("\\$\\{duration\\}", getDuration() / 60000 + "mins");
content = content.replaceAll("\\$\\{mr_waiting\\}", getMapReduceWaitTime() / 60000 + "mins");
content = content.replaceAll("\\$\\{last_update_time\\}", new Date(getLastModified()).toString());
content = content.replaceAll("\\$\\{submitter\\}", getSubmitter());
content = content.replaceAll("\\$\\{error_log\\}", logMsg);
try {
InetAddress inetAddress = InetAddress.getLocalHost();
content = content.replaceAll("\\$\\{job_engine\\}", inetAddress.getCanonicalHostName());
} catch (UnknownHostException e) {
logger.warn(e.getLocalizedMessage(), e);
}
String title = "["+ state.toString() + "] - [Kylin Cube Build Job]-" + getCubeName();
return Pair.of(title, content);
}
示例4: run
import org.apache.kylin.job.execution.Output; //导入方法依赖的package包/类
@Override
public void run() {
// logger.debug("Job Fetcher is running...");
Map<String, Executable> runningJobs = context.getRunningJobs();
if (runningJobs.size() >= jobEngineConfig.getMaxConcurrentJobLimit()) {
logger.warn("There are too many jobs running, Job Fetch will wait until next schedule time");
return;
}
int nRunning = 0, nReady = 0, nOthers = 0;
for (final String id : executableManager.getAllJobIds()) {
if (runningJobs.containsKey(id)) {
// logger.debug("Job id:" + id + " is already running");
nRunning++;
continue;
}
final Output output = executableManager.getOutput(id);
if ((output.getState() != ExecutableState.READY)) {
// logger.debug("Job id:" + id + " not runnable");
nOthers++;
continue;
}
nReady++;
AbstractExecutable executable = executableManager.getJob(id);
String jobDesc = executable.toString();
logger.info(jobDesc + " prepare to schedule");
try {
context.addRunningJob(executable);
jobPool.execute(new JobRunner(executable));
logger.info(jobDesc + " scheduled");
} catch (Exception ex) {
context.removeRunningJob(executable);
logger.warn(jobDesc + " fail to schedule", ex);
}
}
logger.info("Job Fetcher: " + nRunning + " running, " + runningJobs.size() + " actual running, " + nReady + " ready, " + nOthers + " others");
}
示例5: formatNotifications
import org.apache.kylin.job.execution.Output; //导入方法依赖的package包/类
@Override
protected Pair<String, String> formatNotifications(ExecutableContext context, ExecutableState state) {
CubeInstance cubeInstance = CubeManager.getInstance(context.getConfig())
.getCube(CubingExecutableUtil.getCubeName(this.getParams()));
final Output output = getManager().getOutput(getId());
String logMsg;
state = output.getState();
if (state != ExecutableState.ERROR
&& !cubeInstance.getDescriptor().getStatusNeedNotify().contains(state.toString())) {
logger.info("state:" + state + " no need to notify users");
return null;
}
switch (state) {
case ERROR:
logMsg = output.getVerboseMsg();
break;
case DISCARDED:
logMsg = "job has been discarded";
break;
case SUCCEED:
logMsg = "job has succeeded";
break;
default:
return null;
}
String content = ExecutableConstants.NOTIFY_EMAIL_TEMPLATE;
content = content.replaceAll("\\$\\{job_name\\}", getName());
content = content.replaceAll("\\$\\{result\\}", state.toString());
content = content.replaceAll("\\$\\{env_name\\}", getDeployEnvName());
content = content.replaceAll("\\$\\{project_name\\}", getProjectName());
content = content.replaceAll("\\$\\{cube_name\\}", CubingExecutableUtil.getCubeName(this.getParams()));
content = content.replaceAll("\\$\\{source_records_count\\}", String.valueOf(findSourceRecordCount()));
content = content.replaceAll("\\$\\{start_time\\}", new Date(getStartTime()).toString());
content = content.replaceAll("\\$\\{duration\\}", getDuration() / 60000 + "mins");
content = content.replaceAll("\\$\\{mr_waiting\\}", getMapReduceWaitTime() / 60000 + "mins");
content = content.replaceAll("\\$\\{last_update_time\\}", new Date(getLastModified()).toString());
content = content.replaceAll("\\$\\{submitter\\}", StringUtil.noBlank(getSubmitter(), "missing submitter"));
content = content.replaceAll("\\$\\{error_log\\}",
Matcher.quoteReplacement(StringUtil.noBlank(logMsg, "no error message")));
try {
InetAddress inetAddress = InetAddress.getLocalHost();
content = content.replaceAll("\\$\\{job_engine\\}", inetAddress.getCanonicalHostName());
} catch (UnknownHostException e) {
logger.warn(e.getLocalizedMessage(), e);
}
String title = "[" + state.toString() + "] - [" + getDeployEnvName() + "] - [" + getProjectName() + "] - "
+ CubingExecutableUtil.getCubeName(this.getParams());
return Pair.of(title, content);
}
示例6: run
import org.apache.kylin.job.execution.Output; //导入方法依赖的package包/类
@Override
synchronized public void run() {
try {
Map<String, Executable> runningJobs = context.getRunningJobs();
if (runningJobs.size() >= jobEngineConfig.getMaxConcurrentJobLimit()) {
logger.warn("There are too many jobs running, Job Fetch will wait until next schedule time");
return;
}
int nRunning = 0, nOtherRunning = 0, nReady = 0, nOthers = 0;
for (final String id : executableManager.getAllJobIds()) {
if (runningJobs.containsKey(id)) {
nRunning++;
continue;
}
final Output output = executableManager.getOutput(id);
if ((output.getState() != ExecutableState.READY)) {
if (output.getState() == ExecutableState.RUNNING) {
nOtherRunning++;
} else {
nOthers++;
}
continue;
}
nReady++;
final AbstractExecutable executable = executableManager.getJob(id);
try {
jobPool.execute(new JobRunner(executable));
} catch (Exception ex) {
logger.warn(executable.toString() + " fail to schedule in server: " + serverName, ex);
}
}
logger.info("Job Fetcher: " + nRunning + " should running, " + runningJobs.size() + " actual running, "
+ nOtherRunning + " running in other server, " + nReady + " ready, " + nOthers + " others");
} catch (Exception e) {
logger.warn("Job Fetcher caught a exception " + e);
}
}
示例7: run
import org.apache.kylin.job.execution.Output; //导入方法依赖的package包/类
@Override
synchronized public void run() {
try (SetThreadName ignored = new SetThreadName("Scheduler %s FetcherRunner",
System.identityHashCode(DefaultScheduler.this))) {
// logger.debug("Job Fetcher is running...");
Map<String, Executable> runningJobs = context.getRunningJobs();
if (isJobPoolFull()) {
return;
}
int nRunning = 0, nReady = 0, nStopped = 0, nOthers = 0, nError = 0, nDiscarded = 0, nSUCCEED = 0;
for (final String id : executableManager.getAllJobIds()) {
if (isJobPoolFull()) {
return;
}
if (runningJobs.containsKey(id)) {
// logger.debug("Job id:" + id + " is already running");
nRunning++;
continue;
}
final AbstractExecutable executable = executableManager.getJob(id);
if (!executable.isReady()) {
final Output output = executableManager.getOutput(id);
// logger.debug("Job id:" + id + " not runnable");
if (output.getState() == ExecutableState.DISCARDED) {
nDiscarded++;
} else if (output.getState() == ExecutableState.ERROR) {
nError++;
} else if (output.getState() == ExecutableState.SUCCEED) {
nSUCCEED++;
} else if (output.getState() == ExecutableState.STOPPED) {
nStopped++;
} else {
if (fetchFailed) {
executableManager.forceKillJob(id);
nError++;
} else {
nOthers++;
}
}
continue;
}
nReady++;
String jobDesc = null;
try {
jobDesc = executable.toString();
logger.info(jobDesc + " prepare to schedule");
context.addRunningJob(executable);
jobPool.execute(new JobRunner(executable));
logger.info(jobDesc + " scheduled");
} catch (Exception ex) {
if (executable != null)
context.removeRunningJob(executable);
logger.warn(jobDesc + " fail to schedule", ex);
}
}
fetchFailed = false;
logger.info("Job Fetcher: " + nRunning + " should running, " + runningJobs.size() + " actual running, "
+ nStopped + " stopped, " + nReady + " ready, " + nSUCCEED + " already succeed, " + nError
+ " error, " + nDiscarded + " discarded, " + nOthers + " others");
} catch (Exception e) {
fetchFailed = true; // this could happen when resource store is unavailable
logger.warn("Job Fetcher caught a exception ", e);
}
}