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


Java OozieClient类代码示例

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


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

示例1: waitForWorkflow

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
private void waitForWorkflow(String instance, WorkflowJob.Status status) throws Exception {
    ExternalId extId = new ExternalId(processName, Tag.DEFAULT, EntityUtil.parseDateUTC(instance));
    OozieClient ozClient = OozieClientFactory.get(
            (Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, clusterName));
    String jobId = ozClient.getJobId(extId.getId());
    WorkflowJob jobInfo = null;
    for (int i = 0; i < 15; i++) {
        jobInfo = ozClient.getJobInfo(jobId);
        if (jobInfo.getStatus() == status) {
            break;
        }
        System.out.println("Waiting for workflow job " + jobId + " status " + status);
        Thread.sleep((i + 1) * 1000);
    }
    Assert.assertEquals(status, jobInfo.getStatus());
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:17,代码来源:ProcessInstanceManagerTest.java

示例2: submit

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
/**
 * Submit Oozie Job
 *
 * @param app_path
 * @throws OozieClientException
 * @throws IOException
 */
public static String submit(String app_path) throws OozieClientException,
IOException {
	// create a workflow job configuration and set the workflow application path
	Properties conf = wc.createConfiguration();

	conf.setProperty(OozieClient.APP_PATH, app_path);

	// setting workflow parameters
	conf.setProperty("queueName", Constants.QUEUE_NAME);
	conf.setProperty("nameNode", Constants.NAME_NODE);
	conf.setProperty("jobTracker", Constants.JOB_TRACKER);
	conf.setProperty("appPath", app_path);
	String jobId = wc.run(conf);
	logger.info("submit workflow job:" + jobId);

	return jobId;
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:25,代码来源:OozieUtil.java

示例3: start

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
/**
 * Starts the application in Oozie.
 */
private String start(OozieClient oozieClient, Path appPath) {

  Properties props = oozieClient.createConfiguration();

  Path bundlePath = new Path(appPath, "oozie/bundle.xml");

  props.setProperty(OozieClient.BUNDLE_APP_PATH, bundlePath.toString());
  props.setProperty(OozieClient.USE_SYSTEM_LIBPATH, "true");

  try {
    return oozieClient.run(props);

  } catch (OozieClientException e) {
    throw new AppException(e);
  }
}
 
开发者ID:rbrush,项目名称:kite-apps,代码行数:20,代码来源:AppDeployer.java

示例4: waitForBundleStart

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
protected void waitForBundleStart(Status status) throws Exception {
    OozieClient ozClient = OozieClientFactory.get(clusterName);
    List<BundleJob> bundles = getBundles();
    if(bundles.isEmpty())
        return;
    
    String bundleId = bundles.get(0).getId();
    for (int i = 0; i < 15; i++) {
        Thread.sleep(i * 1000);
        BundleJob bundle = ozClient.getBundleJobInfo(bundleId);
        if (bundle.getStatus() == status) {
        	if(status == Status.FAILED)
        		return;
        	
            boolean done = false;
            for (CoordinatorJob coord : bundle.getCoordinators())
                if (coord.getStatus() == status)
                    done = true;
            if (done == true)
                return;
        }
        System.out.println("Waiting for bundle " + bundleId  + " in " + status + " state");
    }
    throw new Exception("Bundle " + bundleId + " is not " + status + " in oozie");
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:26,代码来源:AbstractTestBase.java

示例5: createAppProperties

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
protected Properties createAppProperties(String clusterName, Path bundlePath, String user) throws IvoryException {

        Cluster cluster = EntityUtil.getEntity(EntityType.CLUSTER, clusterName);
        Properties properties = new Properties();
		if (cluster.getProperties() != null) {
			addClusterProperties(properties, cluster.getProperties()
					.getProperties());
		}
        properties.setProperty(OozieWorkflowEngine.NAME_NODE,
                ClusterHelper.getStorageUrl(cluster));
        properties.setProperty(OozieWorkflowEngine.JOB_TRACKER,
                ClusterHelper.getMREndPoint(cluster));
        properties.setProperty(OozieClient.BUNDLE_APP_PATH,
                "${" + OozieWorkflowEngine.NAME_NODE + "}" + bundlePath.toString());
        properties.setProperty("colo.name", cluster.getColo());
        
        properties.setProperty(OozieClient.USER_NAME, user);
        properties.setProperty(OozieClient.USE_SYSTEM_LIBPATH, "true");
        properties.setProperty("ivory.libpath", ClusterHelper.getLocation(cluster, "working") + "/lib");
        LOG.info("Cluster: " + cluster.getName() + ", PROPS: " + properties);
        return properties;
    }
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:23,代码来源:OozieWorkflowBuilder.java

示例6: createAppProperties

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
protected Properties createAppProperties(String clusterName, Path bundlePath, String user) throws FalconException {

        Cluster cluster = EntityUtil.getEntity(EntityType.CLUSTER, clusterName);
        Properties properties = new Properties();
        if (cluster.getProperties() != null) {
            addClusterProperties(properties, cluster.getProperties()
                    .getProperties());
        }
        properties.setProperty(OozieWorkflowEngine.NAME_NODE,
                ClusterHelper.getStorageUrl(cluster));
        properties.setProperty(OozieWorkflowEngine.JOB_TRACKER,
                ClusterHelper.getMREndPoint(cluster));
        properties.setProperty(OozieClient.BUNDLE_APP_PATH,
                "${" + OozieWorkflowEngine.NAME_NODE + "}" + bundlePath.toString());
        properties.setProperty("colo.name", cluster.getColo());

        properties.setProperty(OozieClient.USER_NAME, user);
        properties.setProperty(OozieClient.USE_SYSTEM_LIBPATH, "true");
        properties.setProperty("falcon.libpath", ClusterHelper.getLocation(cluster, "working") + "/lib");
        LOG.info("Cluster: " + cluster.getName() + ", PROPS: " + properties);
        return properties;
    }
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:23,代码来源:OozieWorkflowBuilder.java

示例7: providesDefaultParameters

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
@Provides
@Singleton
@Named("oozie.default_properties")
Map<String,String> providesDefaultParameters(@Named("environment") String environment,
                                             @Named("ws.url") String wsUrl,
                                             @Named("hdfs.namenode") String nameNode,
                                             @Named("user.name") String userName) {
  return new ImmutableMap.Builder<String, String>()
    .put(OozieClient.LIBPATH, String.format(DownloadWorkflowParameters.WORKFLOWS_LIB_PATH_FMT, environment))
    .put(OozieClient.APP_PATH, nameNode + String.format(DownloadWorkflowParameters.DOWNLOAD_WORKFLOW_PATH_FMT,
                                                        environment))
    .put(OozieClient.WORKFLOW_NOTIFICATION_URL,
         DownloadUtils.concatUrlPaths(wsUrl, "occurrence/download/request/callback?job_id=$jobId&status=$status"))
    .put(OozieClient.USER_NAME, userName)
    .putAll(DownloadWorkflowParameters.CONSTANT_PARAMETERS).build();
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:17,代码来源:OccurrenceDownloadServiceModule.java

示例8: DownloadRequestServiceImpl

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
@Inject
public DownloadRequestServiceImpl(OozieClient client,
                                  @Named("oozie.default_properties") Map<String, String> defaultProperties,
                                  @Named("ws.url") String wsUrl,
                                  @Named("ws.mount") String wsMountDir,
                                  OccurrenceDownloadService occurrenceDownloadService,
                                  DownloadEmailUtils downloadEmailUtils,
                                  DownloadLimitsService downloadLimitsService) {

  this.client = client;
  this.wsUrl = wsUrl;
  downloadMount = new File(wsMountDir);
  this.occurrenceDownloadService = occurrenceDownloadService;
  this.downloadEmailUtils = downloadEmailUtils;
  parametersBuilder = new DownloadWorkflowParametersBuilder(defaultProperties);
  this.downloadLimitsService = downloadLimitsService;
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:18,代码来源:DownloadRequestServiceImpl.java

示例9: reRun

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
/**
 * Rerun oozie job
 *
 * @param jobID
 * @throws OozieClientException
 * @throws IOException
 */

public static void reRun(String jobID) throws OozieClientException,
IOException {
	logger.info("rerun job:" + jobID);
	// create a workflow job configuration and set the workflow application path
	Properties conf = wc.createConfiguration();
	String app_path = wc.getJobInfo(jobID).getAppPath();

	// Need to analyze conf_o
	conf.setProperty(OozieClient.APP_PATH, app_path);
	conf.setProperty("queueName", Constants.QUEUE_NAME);
	conf.setProperty("nameNode", Constants.NAME_NODE);
	conf.setProperty("jobTracker", Constants.JOB_TRACKER);
	conf.setProperty("appPath", app_path);
	conf.setProperty("oozie.wf.rerun.failnodes", "false");

	wc.reRun(jobID, conf);
	OozieJob job = new OozieJob();
	job.setId(jobID);
	try {
		OozieJob temp = SecureDao.getObject(job);
		if ( temp != null ) {
			job = temp;
		}
		job.setStatus(getJob(jobID).getStatus());
		job.setCreatedTime(TimeUtils.getTime());

		logger.info("[reRun Status]" + job.getStatus());
		String[] setFields = {"status", "createtime", "endtime"};
		String[] condFields = {"jobid"};
		SecureDao.update(job, setFields, condFields);
	} catch (Exception e) {
		e.printStackTrace();
	}

}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:44,代码来源:OozieUtil.java

示例10: waitForWorkflow

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
private void waitForWorkflow(String instance, WorkflowJob.Status status) throws Exception {
    ExternalId extId = new ExternalId(processName, Tag.DEFAULT, EntityUtil.parseDateUTC(instance));
    OozieClient ozClient = OozieClientFactory.get((Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, clusterName));
    String jobId = ozClient.getJobId(extId.getId());
    WorkflowJob jobInfo = null;
    for (int i = 0; i < 15; i++) {
        jobInfo = ozClient.getJobInfo(jobId);
        if (jobInfo.getStatus() == status)
            break;
        System.out.println("Waiting for workflow job " + jobId + " status " + status);
        Thread.sleep((i + 1) * 1000);
    }
    Assert.assertEquals(status, jobInfo.getStatus());
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:15,代码来源:ProcessInstanceManagerTest.java

示例11: getRunningJobs

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
private List<WorkflowJob> getRunningJobs(String entityName) throws Exception {
    OozieClient ozClient = OozieClientFactory.get((Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, clusterName));
    StringBuilder builder = new StringBuilder();
    builder.append(OozieClient.FILTER_STATUS).append('=').append(Job.Status.RUNNING).append(';');
    builder.append(OozieClient.FILTER_NAME).append('=').append("IVORY_PROCESS_DEFAULT_").append(entityName);
    return ozClient.getJobsInfo(builder.toString());
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:8,代码来源:AbstractTestBase.java

示例12: getBundles

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
protected List<BundleJob> getBundles() throws Exception {
    List<BundleJob> bundles = new ArrayList<BundleJob>();
    if (clusterName == null)
        return bundles;
    
    OozieClient ozClient = OozieClientFactory.get(cluster.getCluster());
    return ozClient.getBundleJobsInfo("name=IVORY_PROCESS_" + processName, 0, 10);
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:9,代码来源:AbstractTestBase.java

示例13: killOozieJobs

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
@AfterMethod
public boolean killOozieJobs() throws Exception {
    if (clusterName == null)
        return true;

    OozieClient ozClient = OozieClientFactory.get(cluster.getCluster());
    List<BundleJob> bundles = getBundles();
    if (bundles != null) {
        for (BundleJob bundle : bundles)
            ozClient.kill(bundle.getId());
    }
    return false;
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:14,代码来源:AbstractTestBase.java

示例14: testLogMover

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
@Test
public void testLogMover() throws Exception {
	CurrentUser.authenticate(System.getProperty("user.name"));
	OozieWorkflowEngine engine = new OozieWorkflowEngine();
	engine.schedule(testProcess);

	OozieClient client = new OozieClient(
			ClusterHelper.getOozieUrl(testCluster.getCluster()));
	List<WorkflowJob> jobs;
	while (true) {
		jobs = client.getJobsInfo(OozieClient.FILTER_NAME + "="
				+ "IVORY_PROCESS_DEFAULT_" + processName);
		if (jobs.size() > 0) {
			break;
		} else {
			Thread.sleep(100);
		}
	}

	WorkflowJob job = jobs.get(0);
	while (true) {
		if (!(job.getStatus() == WorkflowJob.Status.RUNNING || job
				.getStatus() == WorkflowJob.Status.PREP)) {
			break;
		} else {
			Thread.sleep(100);
			job = client.getJobInfo(job.getId());
		}
	}

	Path oozieLogPath = new Path(getLogPath(),
			"job-2010-01-01-01-00/000/oozie.log");
	Assert.assertTrue(fs.exists(oozieLogPath));

	testLogMoverWithNextRunId(job.getId());

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

示例15: newWorkflowSchedule

import org.apache.oozie.client.OozieClient; //导入依赖的package包/类
@Override
public Properties newWorkflowSchedule(Process process, Date startDate, String clusterName, String user) throws IvoryException {
    org.apache.ivory.entity.v0.process.Cluster processCluster = ProcessHelper.getCluster(process, clusterName);
    if (!startDate.before(processCluster.getValidity().getEnd()))
        // start time >= end time
        return null;

    Cluster cluster = configStore.get(EntityType.CLUSTER, processCluster.getName());
    Path bundlePath = new Path(ClusterHelper.getLocation(cluster, "staging"), EntityUtil.getStagingPath(process));
    Process processClone = (Process) process.clone();
    EntityUtil.setStartDate(processClone, clusterName, startDate);

    OozieProcessMapper mapper = new OozieProcessMapper(processClone);
    if(!mapper.map(cluster, bundlePath)){
        return null;
    }
    
    Properties properties = createAppProperties(clusterName, bundlePath, user);
    
    //Add libpath
    String libPath = process.getWorkflow().getLib();
    if (!StringUtils.isEmpty(libPath)) {
        String path = libPath.replace("${nameNode}", "");
        properties.put(OozieClient.LIBPATH, "${nameNode}" + path);
    }
    
    if(process.getInputs() != null) {
        for(Input in:process.getInputs().getInputs())
            if(in.isOptional())
                addOptionalInputProperties(properties, in, clusterName);
    }
    return properties;
}
 
开发者ID:sriksun,项目名称:ivry-security,代码行数:34,代码来源:OozieProcessWorkflowBuilder.java


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