• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Status类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.oozie.client.WorkflowJob.Status的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Status类属于org.apache.oozie.client.WorkflowJob包,在下文中一共展示了Status类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findBundles

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private List<BundleJob> findBundles(Entity entity, String cluster)
		throws IvoryException {
	try {
		OozieClient client = OozieClientFactory.get(cluster);
		List<BundleJob> jobs = client.getBundleJobsInfo(
				OozieClient.FILTER_NAME + "="
						+ EntityUtil.getWorkflowName(entity) + ";", 0, 256);
		if (jobs != null) {
		    List<BundleJob> filteredJobs = new ArrayList<BundleJob>();
		    for(BundleJob job:jobs)
		        if(job.getStatus() != Job.Status.KILLED || job.getEndTime() == null)
		            filteredJobs.add(job);
			return filteredJobs;
		}
		return new ArrayList<BundleJob>();
	} catch (OozieClientException e) {
		throw new IvoryException(e);
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:20,代码来源:OozieWorkflowEngine.java


示例2: getRunningWorkflows

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private List<WorkflowJob> getRunningWorkflows(String cluster,
		List<String> wfNames) throws IvoryException {
	StringBuilder filter = new StringBuilder();
	filter.append(OozieClient.FILTER_STATUS).append('=')
			.append(Job.Status.RUNNING.name());
	for (String wfName : wfNames)
		filter.append(';').append(OozieClient.FILTER_NAME).append('=')
				.append(wfName);

	OozieClient client = OozieClientFactory.get(cluster);
	try {
		return client.getJobsInfo(filter.toString(), 1, 1000);
	} catch (OozieClientException e) {
		throw new IvoryException(e);
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:17,代码来源:OozieWorkflowEngine.java


示例3: reRun

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
@Override
public void reRun(String cluster, String jobId, Properties props)
		throws IvoryException {
	OozieClient client = OozieClientFactory.get(cluster);
	try {
		WorkflowJob jobInfo = client.getJobInfo(jobId);
		Properties jobprops = OozieUtils.toProperties(jobInfo.getConf());
		if (props == null || props.isEmpty())
			jobprops.put(OozieClient.RERUN_FAIL_NODES, "false");
		else
			for (Entry<Object, Object> entry : props.entrySet()) {
				jobprops.put(entry.getKey(), entry.getValue());
			}
		jobprops.remove(OozieClient.COORDINATOR_APP_PATH);
		jobprops.remove(OozieClient.BUNDLE_APP_PATH);
		client.reRun(jobId, jobprops);
		assertStatus(cluster, jobId, WorkflowJob.Status.RUNNING);
		LOG.info("Rerun job " + jobId + " on cluster " + cluster);
	} catch (Exception e) {
		LOG.error("Unable to rerun workflows", e);
		throw new IvoryException(e);
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:24,代码来源:OozieWorkflowEngine.java


示例4: assertStatus

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private void assertStatus(String cluster, String jobId, Status... statuses)
		throws IvoryException {
	String actualStatus = getWorkflowStatus(cluster, jobId);
	for (int counter = 0; counter < 3; counter++) {
		if (!statusEquals(actualStatus, statuses)) {
			try {
				Thread.sleep(100);
			} catch (InterruptedException ignore) {
			}
		} else {
			return;
		}
		actualStatus = getWorkflowStatus(cluster, jobId);
	}
	throw new IvoryException("For Job" + jobId + ", actual statuses: "
			+ actualStatus + ", expected statuses: "
			+ Arrays.toString(statuses));
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:19,代码来源:OozieWorkflowEngine.java


示例5: getJobDetails

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
@Override
public InstancesResult getJobDetails(String cluster, String jobId)
		throws IvoryException {
	OozieClient client = OozieClientFactory.get(cluster);
	Instance[] instances = new Instance[1];
	Instance instance = new Instance();
	try {
		WorkflowJob jobInfo = client.getJobInfo(jobId);
		instance.startTime = jobInfo.getStartTime();
		if (jobInfo.getStatus() == Status.RUNNING) {
			instance.endTime = new Date();
		} else {
			instance.endTime = jobInfo.getEndTime();
		}
		instance.cluster = cluster;
		instances[0] = instance;
		return new InstancesResult("Instance for workflow id:" + jobId,
				instances);
	} catch (Exception e) {
		throw new IvoryException(e);
	}

}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:24,代码来源:OozieWorkflowEngine.java


示例6: findBundles

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private List<BundleJob> findBundles(Entity entity, String cluster)
    throws FalconException {

    try {
        OozieClient client = OozieClientFactory.get(cluster);
        List<BundleJob> jobs = client.getBundleJobsInfo(
                OozieClient.FILTER_NAME + "="
                        + EntityUtil.getWorkflowName(entity) + ";", 0, 256);
        if (jobs != null) {
            List<BundleJob> filteredJobs = new ArrayList<BundleJob>();
            for (BundleJob job : jobs) {
                if (job.getStatus() != Job.Status.KILLED || job.getEndTime() == null) {
                    filteredJobs.add(job);
                    LOG.debug("Found bundle " + job.getId());
                }
            }
            return filteredJobs;
        }
        return new ArrayList<BundleJob>();
    } catch (OozieClientException e) {
        throw new FalconException(e);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:24,代码来源:OozieWorkflowEngine.java


示例7: getRunningWorkflows

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private List<WorkflowJob> getRunningWorkflows(String cluster,
                                              List<String> wfNames) throws FalconException {
    StringBuilder filter = new StringBuilder();
    filter.append(OozieClient.FILTER_STATUS).append('=')
            .append(Job.Status.RUNNING.name());
    for (String wfName : wfNames) {
        filter.append(';').append(OozieClient.FILTER_NAME).append('=')
                .append(wfName);
    }

    OozieClient client = OozieClientFactory.get(cluster);
    try {
        return client.getJobsInfo(filter.toString(), 1, 1000);
    } catch (OozieClientException e) {
        throw new FalconException(e);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:18,代码来源:OozieWorkflowEngine.java


示例8: reRun

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
@Override
public void reRun(String cluster, String jobId, Properties props)
    throws FalconException {

    OozieClient client = OozieClientFactory.get(cluster);
    try {
        WorkflowJob jobInfo = client.getJobInfo(jobId);
        Properties jobprops = OozieUtils.toProperties(jobInfo.getConf());
        if (props == null || props.isEmpty()) {
            jobprops.put(OozieClient.RERUN_FAIL_NODES, "false");
        } else {
            for (Entry<Object, Object> entry : props.entrySet()) {
                jobprops.put(entry.getKey(), entry.getValue());
            }
        }
        jobprops.remove(OozieClient.COORDINATOR_APP_PATH);
        jobprops.remove(OozieClient.BUNDLE_APP_PATH);
        client.reRun(jobId, jobprops);
        assertStatus(cluster, jobId, WorkflowJob.Status.RUNNING);
        LOG.info("Rerun job " + jobId + " on cluster " + cluster);
    } catch (Exception e) {
        LOG.error("Unable to rerun workflows", e);
        throw new FalconException(e);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:26,代码来源:OozieWorkflowEngine.java


示例9: assertStatus

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private void assertStatus(String cluster, String jobId, Status... statuses)
    throws FalconException {

    String actualStatus = getWorkflowStatus(cluster, jobId);
    for (int counter = 0; counter < 3; counter++) {
        if (!statusEquals(actualStatus, statuses)) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException ignore) {
                //ignore
            }
        } else {
            return;
        }
        actualStatus = getWorkflowStatus(cluster, jobId);
    }
    throw new FalconException("For Job" + jobId + ", actual statuses: "
            + actualStatus + ", expected statuses: "
            + Arrays.toString(statuses));
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:21,代码来源:OozieWorkflowEngine.java


示例10: getJobDetails

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
@Override
public InstancesResult getJobDetails(String cluster, String jobId)
    throws FalconException {

    OozieClient client = OozieClientFactory.get(cluster);
    Instance[] instances = new Instance[1];
    Instance instance = new Instance();
    try {
        WorkflowJob jobInfo = client.getJobInfo(jobId);
        instance.startTime = jobInfo.getStartTime();
        if (jobInfo.getStatus() == Status.RUNNING) {
            instance.endTime = new Date();
        } else {
            instance.endTime = jobInfo.getEndTime();
        }
        instance.cluster = cluster;
        instances[0] = instance;
        return new InstancesResult("Instance for workflow id:" + jobId,
                instances);
    } catch (Exception e) {
        throw new FalconException(e);
    }

}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:25,代码来源:OozieWorkflowEngine.java


示例11: readStatusFromJobInfo

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
/**
 * Returns oozie job status based on job info string
 */
public Status readStatusFromJobInfo(String jobInfoString) {
	Status status;
	Matcher matcher = JOB_STATUS_PATTERN.matcher(jobInfoString);
	
	if (matcher.find()) {
		String statusString = matcher.group(1);
		status = Status.valueOf(statusString);
	} else {
		throw new RuntimeException("Unable to find job status in job info string");
	}
	
	return status;
}
 
开发者ID:openaire,项目名称:iis,代码行数:17,代码来源:OozieCmdLineAnswerParser.java


示例12: waitForJobFinish

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private Status waitForJobFinish(String jobId, long timeoutInSeconds) {

		long timeout = 1000L * timeoutInSeconds;
		long checkInterval = 1000L * 10;
		long startTime = System.currentTimeMillis();
		List<Status> jobFinishedStatuses = Lists.newArrayList(Status.SUCCEEDED, Status.FAILED, Status.KILLED, Status.SUSPENDED);

		while ((System.currentTimeMillis()-startTime)<timeout) {
			Status status;
			try {
				Thread.sleep(checkInterval);
				status = sshOozieClient.getJobStatus(jobId);
			} catch (InterruptedException e) {
				throw new RuntimeException(e);
			}

			if (jobFinishedStatuses.contains(status)) {
				return status;
			}

			log.debug("Job {} is still running with status: {} [{} ms]", new Object[] { jobId, status, System.currentTimeMillis()-startTime });
		}
		
		printOozieJobLog(jobId);
                killOozieJob(jobId);
		Assert.fail("Execution of job " + jobId + " exceeded waiting time limit");

		return null;
	}
 
开发者ID:openaire,项目名称:iis,代码行数:30,代码来源:AbstractOozieWorkflowTestCase.java


示例13: assertJobStatus

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private void assertJobStatus(String jobId, Status status, Status expectedStatus) {
	if (status != expectedStatus) {
		printOozieJobLog(jobId);
		Assert.fail("Job has finished with status: " + status + " but " + expectedStatus + " was expected");
	}
	
	log.info("Job has finished sucessfully");
}
 
开发者ID:openaire,项目名称:iis,代码行数:9,代码来源:AbstractOozieWorkflowTestCase.java


示例14: mapActionStatus

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private String mapActionStatus(CoordinatorAction.Status status) {
	if (status == CoordinatorAction.Status.READY
			|| status == CoordinatorAction.Status.WAITING
			|| status == CoordinatorAction.Status.TIMEDOUT
			|| status == CoordinatorAction.Status.SUBMITTED) {
		return InstancesResult.WorkflowStatus.WAITING.name();
	} else if (status == CoordinatorAction.Status.DISCARDED) {
		return InstancesResult.WorkflowStatus.KILLED.name();
	} else {
		return status.name();
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:13,代码来源:OozieWorkflowEngine.java


示例15: mapWorkflowStatus

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private String mapWorkflowStatus(WorkflowJob.Status status) {
	if (status == WorkflowJob.Status.PREP) {
		return InstancesResult.WorkflowStatus.RUNNING.name();
	} else {
		return status.name();
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:8,代码来源:OozieWorkflowEngine.java


示例16: updateInternal

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private void updateInternal(Entity oldEntity, Entity newEntity,
		String cluster, BundleJob bundle, boolean alreadyCreated)
		throws IvoryException {
	OozieWorkflowBuilder<Entity> builder = (OozieWorkflowBuilder<Entity>) WorkflowBuilder
			.getBuilder(ENGINE, oldEntity);

	// Change end time of coords and schedule new bundle
	Job.Status oldBundleStatus = bundle.getStatus();
	suspend(cluster, bundle);

	BundleJob newBundle = findBundle(newEntity, cluster);
	Date endTime;
	if (newBundle == MISSING || !alreadyCreated) { // new entity is not
													// scheduled yet
		LOG.info("New bundle hasn't been created yet. So will create one");
		endTime = offsetTime(now(), 3);
		Date newStartTime = builder.getNextStartTime(newEntity, cluster,
				endTime);
		scheduleForUpdate(newEntity, cluster, newStartTime, bundle.getUser());
		LOG.info("New bundle scheduled successfully "
				+ SchemaHelper.formatDateUTC(newStartTime));
	} else {
		LOG.info("New bundle has already been created. Bundle Id: "
				+ newBundle.getId() + ", Start: "
				+ SchemaHelper.formatDateUTC(newBundle.getStartTime())
				+ ", End: " + newBundle.getEndTime());
		endTime = getMinStartTime(newBundle);
		LOG.info("Will set old coord end time to "
				+ SchemaHelper.formatDateUTC(endTime));
	}
	if (endTime != null)
		updateCoords(cluster, bundle.getId(),
				EntityUtil.getParallel(oldEntity), endTime);

	if (oldBundleStatus != Job.Status.SUSPENDED
			&& oldBundleStatus != Job.Status.PREPSUSPENDED) {
		resume(cluster, bundle);
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:40,代码来源:OozieWorkflowEngine.java


示例17: statusEquals

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private boolean statusEquals(String left, Status... right) {
	for (Status rightElement : right) {
		if (left.equals(rightElement.name()))
			return true;
	}
	return false;
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:8,代码来源:OozieWorkflowEngine.java


示例18: suspend

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private void suspend(String cluster, String jobId) throws IvoryException {
	OozieClient client = OozieClientFactory.get(cluster);
	try {
		client.suspend(jobId);
		assertStatus(cluster, jobId, Status.SUSPENDED, Status.SUCCEEDED,
				Status.FAILED, Status.KILLED);
		LOG.info("Suspended job " + jobId + " on cluster " + cluster);
	} catch (OozieClientException e) {
		throw new IvoryException(e);
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:12,代码来源:OozieWorkflowEngine.java


示例19: resume

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private void resume(String cluster, String jobId) throws IvoryException {
	OozieClient client = OozieClientFactory.get(cluster);
	try {
		client.resume(jobId);
		assertStatus(cluster, jobId, Status.RUNNING, Status.SUCCEEDED,
				Status.FAILED, Status.KILLED);
		LOG.info("Resumed job " + jobId + " on cluster " + cluster);
	} catch (OozieClientException e) {
		throw new IvoryException(e);
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:12,代码来源:OozieWorkflowEngine.java


示例20: kill

import org.apache.oozie.client.WorkflowJob.Status; //导入依赖的package包/类
private void kill(String cluster, String jobId) throws IvoryException {
	OozieClient client = OozieClientFactory.get(cluster);
	try {
		client.kill(jobId);
		assertStatus(cluster, jobId, Status.KILLED, Status.SUCCEEDED,
				Status.FAILED);
		LOG.info("Killed job " + jobId + " on cluster " + cluster);
	} catch (OozieClientException e) {
		throw new IvoryException(e);
	}
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:12,代码来源:OozieWorkflowEngine.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FrameworkSupportInModuleConfigurable类代码示例发布时间:2022-05-23
下一篇:
Java IDEInternalPreferences类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap