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


Java OozieClient.createConfiguration方法代码示例

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


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

示例1: 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

示例2: execute

import org.apache.oozie.client.OozieClient; //导入方法依赖的package包/类
public void execute() throws MojoExecutionException, MojoFailureException {
  OozieClient oozieClient = new OozieClient(oozieUrl);
  Properties conf = oozieClient.createConfiguration();
  if (jobProperties != null) {
    conf.putAll(jobProperties);
  }
  if (hadoopConfiguration != null) {
    conf.putAll(hadoopConfiguration);
    String hadoopFs = hadoopConfiguration.getProperty("fs.default.name");
    if (hadoopFs == null) {
      throw new MojoExecutionException("Missing property 'fs.default.name' in " +
          "hadoopConfiguration");
    }
    String hadoopJobTracker = hadoopConfiguration.getProperty("mapred.job.tracker");
    if (hadoopJobTracker == null) {
      throw new MojoExecutionException("Missing property 'mapred.job.tracker' in " +
          "hadoopConfiguration");
    }
    conf.put(NAMENODE_PROPERTY, hadoopFs);
    conf.put(JOBTRACKER_PROPERTY, hadoopJobTracker);
  }

  String appPath = getAppPath().toString();
  conf.setProperty(getAppPathPropertyName(), appPath);
  conf.setProperty(APP_PATH_PROPERTY, appPath); // used in coordinator.xml
  getLog().info("App path: " + appPath);
  try {
    String jobId = oozieClient.run(conf);
    getLog().info("Running Oozie job " + jobId);
  } catch (OozieClientException e) {
    throw new MojoExecutionException("Error running Oozie job", e);
  }
}
 
开发者ID:cloudera,项目名称:cdk,代码行数:34,代码来源:RunAppMojo.java

示例3: testSubmitCoordinator

import org.apache.oozie.client.OozieClient; //导入方法依赖的package包/类
@Test
public void testSubmitCoordinator() throws Exception {

    LOG.info("OOZIE: Test Submit Coordinator Start");

    FileSystem hdfsFs = hdfsLocalCluster.getHdfsFileSystemHandle();
    OozieClient oozie = oozieLocalServer.getOozieCoordClient();

    Path appPath = new Path(hdfsFs.getHomeDirectory(), "testApp");
    hdfsFs.mkdirs(new Path(appPath, "lib"));
    Path workflow = new Path(appPath, "workflow.xml");
    Path coordinator = new Path(appPath, "coordinator.xml");

    //write workflow.xml
    String wfApp =
            "<workflow-app xmlns='uri:oozie:workflow:0.1' name='test-wf'>" +
                    "    <start to='end'/>" +
                    "    <end name='end'/>" +
                    "</workflow-app>";

    String coordApp =
            "<coordinator-app timezone='UTC' end='2016-07-26T02:26Z' start='2016-07-26T01:26Z' frequency='${coord:hours(1)}' name='test-coordinator' xmlns='uri:oozie:coordinator:0.4'>" +
                    "    <action>" +
                    "        <workflow>" +
                    "            <app-path>" + workflow.toString() + "</app-path>" +
                    "        </workflow>" +
                    "    </action>" +
                    "</coordinator-app>";

    Writer writer = new OutputStreamWriter(hdfsFs.create(workflow));
    writer.write(wfApp);
    writer.close();

    Writer coordWriter = new OutputStreamWriter(hdfsFs.create(coordinator));
    coordWriter.write(coordApp);
    coordWriter.close();

    //write job.properties
    Properties conf = oozie.createConfiguration();
    conf.setProperty(OozieClient.COORDINATOR_APP_PATH, coordinator.toString());
    conf.setProperty(OozieClient.USER_NAME, UserGroupInformation.getCurrentUser().getUserName());

    //submit and check
    final String jobId = oozie.submit(conf);
    CoordinatorJob coord  = oozie.getCoordJobInfo(jobId);
    assertNotNull(coord);
    assertEquals(Job.Status.PREP, coord.getStatus());

    LOG.info("OOZIE: Coordinator: {}", coord.toString());
    hdfsFs.close();
}
 
开发者ID:sakserv,项目名称:hadoop-mini-clusters,代码行数:52,代码来源:OozieLocalServerIntegrationTest.java

示例4: submitCoordJob

import org.apache.oozie.client.OozieClient; //导入方法依赖的package包/类
private void submitCoordJob(String workFlowRoot)
		throws OozieClientException, InterruptedException {
	// OozieClient client = LocalOozie.getCoordClient();
	String oozieURL = System.getProperty("oozie.base.url");
	LOG.debug("Oozie BaseURL is: {} ", oozieURL);
	OozieClient client = new OozieClient(oozieURL);
	Properties conf = client.createConfiguration();
	conf.setProperty(OozieClient.COORDINATOR_APP_PATH, workFlowRoot
			+ "/coord-app-hive-add-partition.xml");
	conf.setProperty("nameNode", hadoopClusterService.getHDFSUri());
	conf.setProperty("jobTracker", hadoopClusterService.getJobTRackerUri());
	conf.setProperty("workflowRoot", workFlowRoot);
	Date nowMinusOneMin = new DateTime().minusMinutes(1).toDate();
	Date now = new DateTime().toDate();
	conf.setProperty("jobStart",
			DateUtils.formatDateOozieTZ(nowMinusOneMin));
	conf.setProperty("jobEnd", DateUtils.formatDateOozieTZ(new DateTime()
			.plusHours(2).toDate()));
	conf.setProperty("initialDataset", DateUtils.formatDateOozieTZ(now));
	conf.setProperty("tzOffset", "2");

	// submit and start the workflow job
	String jobId = client.submit(conf);

	LOG.debug("Workflow job submitted");
	// wait until the workflow job finishes printing the status every 10
	// seconds
	int retries = 2;
	for (int i = 1; i <= retries; i++) {
		// Sleep 60 sec./ 3 mins
		Thread.sleep(60 * 1000);

		CoordinatorJob coordJobInfo = client.getCoordJobInfo(jobId);
		LOG.debug("Workflow job running ...");
		LOG.debug("coordJobInfo Try: {}", i);
		LOG.debug("coordJobInfo StartTime: {}", coordJobInfo.getStartTime());
		LOG.debug("coordJobInfo NextMaterizedTime: {}",
				coordJobInfo.getNextMaterializedTime());
		LOG.debug("coordJobInfo EndTime: {}", coordJobInfo.getEndTime());
		LOG.debug("coordJobInfo Frequency: {}", coordJobInfo.getFrequency());
		LOG.debug("coordJobInfo ConsoleURL: {}",
				coordJobInfo.getConsoleUrl());
		LOG.debug("coordJobInfo Status: {}", coordJobInfo.getStatus());
		for (CoordinatorAction action : coordJobInfo.getActions()) {
			LOG.debug("coordJobInfo Action Id: {}", action.getId());
			LOG.debug("coordJobInfo Action NominalTimeL: {}",
					action.getNominalTime());
			LOG.debug("coordJobInfo Action Runconf: {}",
					action.getRunConf());
			LOG.debug("coordJobInfo Action Status: {}", action.getStatus());
			LOG.debug("coordJobInfo ActionConsoleURL: {}",
					action.getConsoleUrl());
			LOG.debug("coordJobInfo ActionErrorMessage: {}",
					action.getErrorMessage());
		}
		if (coordJobInfo.getStatus() == Job.Status.RUNNING) {
			// Wait three times to see the running state is stable..then it
			// is fine.
			// Job will keep running even if hive action fails.
			if (i == retries) {
				LOG.info("Coord Job in running state!");
				break;
			} else {
				continue;
			}
		} else if (coordJobInfo.getStatus() == Job.Status.PREMATER
				|| coordJobInfo.getStatus() == Job.Status.PREP) {
			// still preparing.
			continue;
		} else {
			throw new RuntimeException(
					"Error occured while running coord job!");
		}
	}
}
 
开发者ID:jaibeermalik,项目名称:searchanalytics-bigdata,代码行数:76,代码来源:OozieJobsServiceImpl.java


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