try{ OozieClient wc = new OozieClient("http://host.com:11000/oozie"); Properties conf = wc.createConfiguration(); conf.setProperty(....) ... String jobId = wc.run(conf); System.out.println("Workflow job submitted"); while (wc.getJobInfo(jobId).getStatus() == WorkflowJob.Status.RUNNING) { System.out.println("Workflow job running ..."); Thread.sleep(10 * 1000); } System.out.println("Workflow job completed ..."); System.out.println(wc.getJobInfo(jobId)); }catch(OozieClientException oozieClientException){ oozieClientException.printStackTrace(); }
/** * Get the info of a workflow job. * * @param jobId job Id. * @return the job info. * @throws OozieClientException thrown if the job info could not be retrieved. */ public WorkflowJob getJobInfo(String jobId) throws OozieClientException { return getJobInfo(jobId, 0, 0); }
public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); wc.validateWSVersion(); return null; } });
public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); Properties conf = wc.createConfiguration(); conf.setProperty(OozieClient.USER_NAME, "x"); wc.resume(MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END); assertEquals(RestConstants.JOB_ACTION_RESUME, MockDagEngineService.did); return null; } });
Properties conf = wfClient.createConfiguration(); conf.setProperty(OozieClient.APP_PATH, getTestCaseFileUri("workflow.xml")); conf.setProperty(OozieClient.USER_NAME, getTestUser()); conf.setProperty("dstDir", "${base}/p2"); final String jobId1 = wfClient.submit(conf); wfClient.start(jobId1); wfClient.kill(jobId1); assertEquals(WorkflowJob.Status.KILLED, wfClient.getJobInfo(jobId1).getStatus()); conf.setProperty(OozieClient.RERUN_FAIL_NODES, "false"); wfClient.reRun(jobId1, conf); waitFor(15 * 1000, new Predicate() { public boolean evaluate() throws Exception { assertEquals(WorkflowJob.Status.SUCCEEDED, wfClient.getJobInfo(jobId1).getStatus());
String oozieURL = System.getProperty("oozie.base.url"); LOG.debug("Oozie BaseURL is: {} ", oozieURL); OozieClient client = new OozieClient(oozieURL); .valueOf(hourOfDay); Properties conf = client.createConfiguration(); conf.setProperty(OozieClient.APP_PATH, workFlowRoot + "/hive-action-add-partition.xml"); client.setDebugMode(1); String jobId = client.run(conf);// submit(conf); WorkflowJob jobInfo = client.getJobInfo(jobId); Status jobStatus = jobInfo.getStatus(); LOG.debug("Workflow job running ..."); workflowAction.getEndTime()); LOG.debug("HiveActionWorkflowJob Oozie Url: {}", client.getOozieUrl());
params = params.replaceAll("\\.", "_"); OozieClient wc = new OozieClient( "http://hadoop-master.vls.icm.edu.pl:11000/oozie"); Properties conf = wc.createConfiguration(); conf.setProperty("oozie.use.system.libpath","true"); conf.setProperty("oozie.action.sharelib.for.pig","/user/oozie/share/lib/pig"); String jobId = wc.run(conf); System.out.println("Workflow job, " + jobId + " submitted"); while (wc.getJobInfo(jobId).getStatus() == WorkflowJob.Status.RUNNING) { System.out.println("Workflow job running ..."); System.out.println(wc.getJobInfo(jobId)); } catch (Exception r) { System.out.println("Errors " + r.getLocalizedMessage());
public void execute() throws MojoExecutionException, MojoFailureException { OozieClient oozieClient = new OozieClient(oozieUrl); Properties conf = oozieClient.createConfiguration(); if (jobProperties != null) { conf.putAll(jobProperties); String jobId = oozieClient.run(conf); getLog().info("Running Oozie job " + jobId); } catch (OozieClientException e) {
Properties conf = wc.createConfiguration(); conf.setProperty(OozieClient.APP_PATH, new Path(appUri, "workflow.xml").toString()); String jobId = wc.run(conf); Thread.sleep(1000); System.out.println("Workflow job submitted"); while (wc.getJobInfo(jobId).getStatus() == WorkflowJob.Status.RUNNING) { System.out.println("Workflow job running ..."); printWorkflowInfo(wc.getJobInfo(jobId)); Thread.sleep(10 * 1000); printWorkflowInfo(wc.getJobInfo(jobId)); return (wc.getJobInfo(jobId).getStatus() == WorkflowJob.Status.SUCCEEDED) ? 0 : -1;
oozieClient = new OozieClient(job.getJobConfigurationProperties().get(OozieJobConstants.OOZIE_CLIENT_PROP)); oozieConf = oozieClient.createConfiguration(); job.initializeOozieConfiguration(id, oozieConf, queryParameters); job.validateWorkflowParameter(oozieConf, mapReduceConfiguration); String jobID = null; try { jobID = oozieClient.run(oozieConf); } catch (Exception e) { throw new QueryException(DatawaveErrorCode.OOZIE_JOB_START_ERROR, e); response.addException(qe.getBottomQueryException()); try { oozieClient.kill(jobID);
List<CoordinatorJob> list0 = client.getCoordJobsInfo("", 1, 100); assertEquals(0, list0.size()); Properties conf = client.createConfiguration(); String jobId0 = client.submit(conf); client.kill(jobId0); String jobId = client.run(conf); client.suspend(jobId); client.resume(jobId); client.kill(jobId); CoordinatorJob job = client.getCoordJobInfo(jobId); String appName = job.getAppName(); assertEquals("NAME", appName); List<CoordinatorJob> list = client.getCoordJobsInfo("", 1, 5); assertEquals(2, list.size());
oozieClient.reRun(action.getExternalId(), subWorkflowConf.toProperties()); subWorkflowId = action.getExternalId(); } else { subWorkflowId = oozieClient.run(subWorkflowConf.toProperties()); WorkflowJob workflow = oozieClient.getJobInfo(subWorkflowId); String consoleUrl = workflow.getConsoleUrl(); context.setStartData(subWorkflowId, oozieUri, consoleUrl);
public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); Properties conf = wc.createConfiguration(); conf.setProperty(OozieClient.USER_NAME, "x"); wc.kill(MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END); assertEquals(RestConstants.JOB_ACTION_KILL, MockDagEngineService.did); return null; } });
public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); WorkflowJob wf = wc.getJobInfo(MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END); assertEquals(RestConstants.JOB_SHOW_INFO, MockDagEngineService.did); assertEquals(MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END, wf.getId()); return null; } });
public File run() throws IOException { OozieRunnerIO hdfsHelper = new OozieRunnerIO(wfProperties, userName); hdfsHelper.copyInputFiles(); for (String propertyKey : wfProperties.stringPropertyNames()) { System.out.println(propertyKey + "=" + wfProperties.getProperty(propertyKey)); } Status status; try { String jobId = oozie.run(wfProperties); // wait until the workflow job finishes printing the status every 10 seconds while (oozie.getJobInfo(jobId).getStatus() == WorkflowJob.Status.RUNNING) { Thread.sleep(10 * 1000); } // print the final status o the workflow job logger.info("Workflow job completed ..."); logger.info(oozie.getJobInfo(jobId).toString()); status = oozie.getJobInfo(jobId).getStatus(); } catch (OozieClientException ex) { throw new OozieRunnerException(ex); } catch (InterruptedException ex) { throw new OozieRunnerException(ex); } if (status != WorkflowJob.Status.SUCCEEDED) { throw new OozieRunnerException("Workflow finished with status " + status); } return hdfsHelper.getOutputFiles(); }
List<CoordinatorJob> list0 = client.getCoordJobsInfo("", 1, 100); assertEquals(0, list0.size()); Properties conf = client.createConfiguration(); String appPath = storedCoordAppPath(); final String jobId0 = client.run(conf); final String jobId1 = client.run(conf); final String jobId2 = client.run(conf); waitFor(client, jobId0); waitFor(client, jobId1); waitFor(client, jobId2); list0 = client.getCoordJobsInfo("name=NAME", 1, 10); assertEquals(3, list0.size()); JSONObject jsonObject = client.suspendJobs("name=NAME", "coord", 1, 3); assertEquals(3, jsonObject.get("total")); assertEquals(3, ((JSONArray) jsonObject.get("coordinatorjobs")).size()); assertEquals(Job.Status.SUSPENDED, client.getCoordJobInfo(jobId0).getStatus()); assertEquals(Job.Status.SUSPENDED, client.getCoordJobInfo(jobId1).getStatus()); assertEquals(Job.Status.SUSPENDED, client.getCoordJobInfo(jobId2).getStatus()); jsonObject = client.resumeJobs("name=NAME", "coord", 1, 3); assertEquals(3, jsonObject.get("total")); assertEquals(3, ((JSONArray) jsonObject.get("coordinatorjobs")).size()); assertEquals(Job.Status.RUNNING, client.getCoordJobInfo(jobId0).getStatus()); assertEquals(Job.Status.RUNNING, client.getCoordJobInfo(jobId1).getStatus()); assertEquals(Job.Status.RUNNING, client.getCoordJobInfo(jobId2).getStatus()); jsonObject = client.killJobs("name=NAME", "coord", 1, 3);
public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); Properties conf = wc.createConfiguration(); conf.setProperty(OozieClient.USER_NAME, "x"); wc.suspend(MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END); assertEquals(RestConstants.JOB_ACTION_SUSPEND, MockDagEngineService.did); return null; } });
public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); Properties conf = wc.createConfiguration(); conf.setProperty(OozieClient.USER_NAME, "x"); wc.start(MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END); assertEquals(RestConstants.JOB_ACTION_START, MockDagEngineService.did); return null; } });
public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); Properties conf = wc.createConfiguration(); conf.setProperty(OozieClient.USER_NAME, getTestUser()); Path appPath = new Path(getFsTestCaseDir(), "app"); getFileSystem().mkdirs(appPath); getFileSystem().create(new Path(appPath, "workflow.xml")).close(); conf.setProperty(OozieClient.APP_PATH, appPath.toString()); wc.reRun(MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END, conf); assertEquals(RestConstants.JOB_ACTION_RERUN, MockDagEngineService.did); assertTrue(MockDagEngineService.started.get(1)); return null; } });
public Void call() throws Exception { HeaderTestingVersionServlet.OOZIE_HEADERS.clear(); String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); wc.setHeader("header", "test"); assertEquals("test", wc.getHeader("header")); assertEquals("test", wc.getHeaders().get("header")); boolean found = false; for (Iterator<String> headers = wc.getHeaderNames(); headers.hasNext();) { if ("header".equals(headers.next())) { found = true; } } assertTrue("headers does not contain header!", found); wc.validateWSVersion(); assertTrue(HeaderTestingVersionServlet.OOZIE_HEADERS.containsKey("header")); assertTrue(HeaderTestingVersionServlet.OOZIE_HEADERS.containsValue("test")); wc.removeHeader("header"); assertNull(wc.getHeader("header")); return null; } });