Search in sources :

Example 1 with BulkWorkflowXCommand

use of org.apache.oozie.command.wf.BulkWorkflowXCommand in project oozie by apache.

the class DagEngine method killJobs.

/**
 * return the jobs that've been killed
 * @param filter Jobs that satisfy the filter will be killed
 * @param start start index in the database of jobs
 * @param len maximum number of jobs that will be killed
 * @return workflowsInfo return the jobs that've been killed
 * @throws DagEngineException if the jobs could not be killed
 */
public WorkflowsInfo killJobs(String filter, int start, int len) throws DagEngineException {
    try {
        Map<String, List<String>> filterList = parseFilter(filter);
        WorkflowsInfo workflowsInfo = new BulkWorkflowXCommand(filterList, start, len, OperationType.Kill).call();
        if (workflowsInfo == null) {
            return new WorkflowsInfo(new ArrayList<WorkflowJobBean>(), 0, 0, 0);
        }
        return workflowsInfo;
    } catch (CommandException ex) {
        throw new DagEngineException(ex);
    }
}
Also used : BulkWorkflowXCommand(org.apache.oozie.command.wf.BulkWorkflowXCommand) List(java.util.List) ArrayList(java.util.ArrayList) CommandException(org.apache.oozie.command.CommandException)

Example 2 with BulkWorkflowXCommand

use of org.apache.oozie.command.wf.BulkWorkflowXCommand in project oozie by apache.

the class DagEngine 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 len maximum number of jobs that will be resumed
 * @return workflowsInfo returns the jobs that've been resumed
 * @throws DagEngineException if the jobs cloud not be resumed
 */
public WorkflowsInfo resumeJobs(String filter, int start, int len) throws DagEngineException {
    try {
        Map<String, List<String>> filterList = parseFilter(filter);
        WorkflowsInfo workflowsInfo = new BulkWorkflowXCommand(filterList, start, len, OperationType.Resume).call();
        if (workflowsInfo == null) {
            return new WorkflowsInfo(new ArrayList<WorkflowJobBean>(), 0, 0, 0);
        }
        return workflowsInfo;
    } catch (CommandException ex) {
        throw new DagEngineException(ex);
    }
}
Also used : BulkWorkflowXCommand(org.apache.oozie.command.wf.BulkWorkflowXCommand) List(java.util.List) ArrayList(java.util.ArrayList) CommandException(org.apache.oozie.command.CommandException)

Example 3 with BulkWorkflowXCommand

use of org.apache.oozie.command.wf.BulkWorkflowXCommand in project oozie by apache.

the class DagEngine 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 len maximum number of jobs that will be suspended
 * @return workflowsInfo return the jobs that've been suspended
 * @throws DagEngineException if the jobs cloud not be suspended
 */
public WorkflowsInfo suspendJobs(String filter, int start, int len) throws DagEngineException {
    try {
        Map<String, List<String>> filterList = parseFilter(filter);
        WorkflowsInfo workflowsInfo = new BulkWorkflowXCommand(filterList, start, len, OperationType.Suspend).call();
        if (workflowsInfo == null) {
            return new WorkflowsInfo(new ArrayList<WorkflowJobBean>(), 0, 0, 0);
        }
        return workflowsInfo;
    } catch (CommandException ex) {
        throw new DagEngineException(ex);
    }
}
Also used : BulkWorkflowXCommand(org.apache.oozie.command.wf.BulkWorkflowXCommand) List(java.util.List) ArrayList(java.util.ArrayList) CommandException(org.apache.oozie.command.CommandException)

Aggregations

ArrayList (java.util.ArrayList)3 List (java.util.List)3 CommandException (org.apache.oozie.command.CommandException)3 BulkWorkflowXCommand (org.apache.oozie.command.wf.BulkWorkflowXCommand)3