当前位置: 首页>>代码示例>>Java>>正文


Java Job.Status方法代码示例

本文整理汇总了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;
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:51,代码来源:DownloadRequestServiceImpl.java

示例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));
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:7,代码来源:DownloadRequestServiceImplTest.java


注:本文中的org.apache.oozie.client.Job.Status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。