本文整理汇总了Java中org.apache.oozie.client.Job.Status方法的典型用法代码示例。如果您正苦于以下问题:Java Job.Status方法的具体用法?Java Job.Status怎么用?Java Job.Status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.oozie.client.Job
的用法示例。
在下文中一共展示了Job.Status方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processCallback
import org.apache.oozie.client.Job; //导入方法依赖的package包/类
/**
* Processes a callback from Oozie which update the download status.
*/
@Override
public void processCallback(String jobId, String status) {
Preconditions.checkNotNull(Strings.isNullOrEmpty(jobId), "<jobId> may not be null or empty");
Preconditions.checkNotNull(Strings.isNullOrEmpty(status), "<status> may not be null or empty");
Optional<Job.Status> opStatus = Enums.getIfPresent(Job.Status.class, status.toUpperCase());
Preconditions.checkArgument(opStatus.isPresent(), "<status> the requested status is not valid");
String downloadId = DownloadUtils.workflowToDownloadId(jobId);
LOG.debug("Processing callback for jobId [{}] with status [{}]", jobId, status);
Download download = occurrenceDownloadService.get(downloadId);
if (download == null) {
// Download can be null if the oozie reports status before the download is persisted
LOG.info(String.format("Download [%s] not found [Oozie may be issuing callback before download persisted]", downloadId));
return;
}
Download.Status newStatus = STATUSES_MAP.get(opStatus.get());
switch (newStatus) {
case KILLED:
// Keep a manually cancelled download status as opposed to a killed one
if (download.getStatus() == Download.Status.CANCELLED) {
CANCELLED_DOWNLOADS.inc();
return;
}
case FAILED:
LOG.error(NOTIFY_ADMIN, "Got callback for failed query. JobId [{}], Status [{}]", jobId, status);
updateDownloadStatus(download, newStatus);
downloadEmailUtils.sendErrorNotificationMail(download);
FAILED_DOWNLOADS.inc();
break;
case SUCCEEDED:
SUCCESSFUL_DOWNLOADS.inc();
updateDownloadStatus(download, newStatus);
// notify about download
if (download.getRequest().getSendNotification()) {
downloadEmailUtils.sendSuccessNotificationMail(download);
}
break;
default:
updateDownloadStatus(download, newStatus);
break;
}
}
示例2: testStatusMapCompleteness
import org.apache.oozie.client.Job; //导入方法依赖的package包/类
@Test
public void testStatusMapCompleteness() throws Exception {
for (Job.Status st : Job.Status.values()) {
assertTrue(DownloadRequestServiceImpl.STATUSES_MAP.containsKey(st));
}
}