Search in sources :

Example 6 with BundleJob

use of org.apache.oozie.client.BundleJob in project oozie by apache.

the class OozieCLI method printBundleJobs.

@VisibleForTesting
void printBundleJobs(List<BundleJob> jobs, String timeZoneId, boolean verbose) throws IOException {
    if (jobs != null && jobs.size() > 0) {
        if (verbose) {
            System.out.println("Job ID" + VERBOSE_DELIMITER + "Bundle Name" + VERBOSE_DELIMITER + "Bundle Path" + VERBOSE_DELIMITER + "User" + VERBOSE_DELIMITER + "Group" + VERBOSE_DELIMITER + "Status" + VERBOSE_DELIMITER + "Kickoff" + VERBOSE_DELIMITER + "Pause" + VERBOSE_DELIMITER + "Created" + VERBOSE_DELIMITER + "Console URL");
            System.out.println(RULER);
            for (BundleJob job : jobs) {
                System.out.println(maskIfNull(job.getId()) + VERBOSE_DELIMITER + maskIfNull(job.getAppName()) + VERBOSE_DELIMITER + maskIfNull(job.getAppPath()) + VERBOSE_DELIMITER + maskIfNull(job.getUser()) + VERBOSE_DELIMITER + maskIfNull(job.getGroup()) + VERBOSE_DELIMITER + job.getStatus() + VERBOSE_DELIMITER + maskDate(job.getKickoffTime(), timeZoneId, verbose) + VERBOSE_DELIMITER + maskDate(job.getPauseTime(), timeZoneId, verbose) + VERBOSE_DELIMITER + maskDate(job.getCreatedTime(), timeZoneId, verbose) + VERBOSE_DELIMITER + maskIfNull(job.getConsoleUrl()));
                System.out.println(RULER);
            }
        } else {
            System.out.println(String.format(BUNDLE_JOBS_FORMATTER, "Job ID", "Bundle Name", "Status", "Kickoff", "Created", "User", "Group"));
            System.out.println(RULER);
            for (BundleJob job : jobs) {
                System.out.println(String.format(BUNDLE_JOBS_FORMATTER, maskIfNull(job.getId()), maskIfNull(job.getAppName()), job.getStatus(), maskDate(job.getKickoffTime(), timeZoneId, verbose), maskDate(job.getCreatedTime(), timeZoneId, verbose), maskIfNull(job.getUser()), maskIfNull(job.getGroup())));
                System.out.println(RULER);
            }
        }
    } else {
        System.out.println("No Jobs match your criteria!");
    }
}
Also used : BundleJob(org.apache.oozie.client.BundleJob) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 7 with BundleJob

use of org.apache.oozie.client.BundleJob in project oozie by apache.

the class TestOozieCLIMethods method createBulkResponse.

private static BulkResponse createBulkResponse(DataObject dtObject) {
    BulkResponse bulkResponse = mock(BulkResponse.class);
    BundleJob bundleJob = createBundleJob(dtObject);
    when(bulkResponse.getBundle()).thenReturn(bundleJob);
    CoordinatorAction coordinatorAction = createCoordinatorAction(dtObject);
    when(bulkResponse.getAction()).thenReturn(coordinatorAction);
    CoordinatorJob coordinatorJob = createCoordinatorJob(dtObject);
    when(bulkResponse.getCoordinator()).thenReturn(coordinatorJob);
    return bulkResponse;
}
Also used : CoordinatorJob(org.apache.oozie.client.CoordinatorJob) CoordinatorAction(org.apache.oozie.client.CoordinatorAction) BulkResponse(org.apache.oozie.client.BulkResponse) BundleJob(org.apache.oozie.client.BundleJob)

Aggregations

BundleJob (org.apache.oozie.client.BundleJob)7 CoordinatorJob (org.apache.oozie.client.CoordinatorJob)5 CoordinatorAction (org.apache.oozie.client.CoordinatorAction)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 BulkResponse (org.apache.oozie.client.BulkResponse)2 File (java.io.File)1 IOException (java.io.IOException)1 Pattern (java.util.regex.Pattern)1 OozieClientException (org.apache.oozie.client.OozieClientException)1 JSONObject (org.json.simple.JSONObject)1 Test (org.junit.Test)1