Search in sources :

Example 1 with BulkCoordXCommand

use of org.apache.oozie.command.coord.BulkCoordXCommand in project oozie by apache.

the class CoordinatorEngine method killJobs.

/**
 * return a list of killed Coordinator job
 *
 * @param filter the filter string for which the coordinator jobs are killed
 * @param start the starting index for coordinator jobs
 * @param length maximum number of jobs to be killed
 * @return coordinatorJobInfo the list of jobs being killed
 * @throws CoordinatorEngineException thrown if one or more of the jobs cannot be killed
 */
public CoordinatorJobInfo killJobs(String filter, int start, int length) throws CoordinatorEngineException {
    try {
        Map<String, List<String>> filterMap = parseJobsFilter(filter);
        CoordinatorJobInfo coordinatorJobInfo = new BulkCoordXCommand(filterMap, start, length, OperationType.Kill).call();
        if (coordinatorJobInfo == null) {
            return new CoordinatorJobInfo(new ArrayList<CoordinatorJobBean>(), 0, 0, 0);
        }
        return coordinatorJobInfo;
    } catch (CommandException ex) {
        throw new CoordinatorEngineException(ex);
    }
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) CommandException(org.apache.oozie.command.CommandException) BulkCoordXCommand(org.apache.oozie.command.coord.BulkCoordXCommand)

Example 2 with BulkCoordXCommand

use of org.apache.oozie.command.coord.BulkCoordXCommand in project oozie by apache.

the class CoordinatorEngine method resumeJobs.

/**
 * return the jobs that've been resumed
 * @param filter Filter for jobs that will be resumed, can be name, user, group, status, id or combination of any
 * @param start Offset for the jobs that will be resumed
 * @param length maximum number of jobs that will be resumed
 * @return coordinatorJobInfo returns resumed jobs
 * @throws CoordinatorEngineException if the jobs could not be resumed
 */
public CoordinatorJobInfo resumeJobs(String filter, int start, int length) throws CoordinatorEngineException {
    try {
        Map<String, List<String>> filterMap = parseJobsFilter(filter);
        CoordinatorJobInfo coordinatorJobInfo = new BulkCoordXCommand(filterMap, start, length, OperationType.Resume).call();
        if (coordinatorJobInfo == null) {
            return new CoordinatorJobInfo(new ArrayList<CoordinatorJobBean>(), 0, 0, 0);
        }
        return coordinatorJobInfo;
    } catch (CommandException ex) {
        throw new CoordinatorEngineException(ex);
    }
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) CommandException(org.apache.oozie.command.CommandException) BulkCoordXCommand(org.apache.oozie.command.coord.BulkCoordXCommand)

Example 3 with BulkCoordXCommand

use of org.apache.oozie.command.coord.BulkCoordXCommand in project oozie by apache.

the class CoordinatorEngine method suspendJobs.

/**
 * return the jobs that've been suspended
 * @param filter Filter for jobs that will be suspended, can be name, user, group, status, id or combination of any
 * @param start Offset for the jobs that will be suspended
 * @param length maximum number of jobs that will be suspended
 * @return coordinatorJobInfo
 * @throws CoordinatorEngineException if the jobs could not be suspended
 */
public CoordinatorJobInfo suspendJobs(String filter, int start, int length) throws CoordinatorEngineException {
    try {
        Map<String, List<String>> filterMap = parseJobsFilter(filter);
        CoordinatorJobInfo coordinatorJobInfo = new BulkCoordXCommand(filterMap, start, length, OperationType.Suspend).call();
        if (coordinatorJobInfo == null) {
            return new CoordinatorJobInfo(new ArrayList<CoordinatorJobBean>(), 0, 0, 0);
        }
        return coordinatorJobInfo;
    } catch (CommandException ex) {
        throw new CoordinatorEngineException(ex);
    }
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) CommandException(org.apache.oozie.command.CommandException) BulkCoordXCommand(org.apache.oozie.command.coord.BulkCoordXCommand)

Aggregations

ArrayList (java.util.ArrayList)3 List (java.util.List)3 CommandException (org.apache.oozie.command.CommandException)3 BulkCoordXCommand (org.apache.oozie.command.coord.BulkCoordXCommand)3