Search in sources :

Example 6 with CoordInputDependency

use of org.apache.oozie.coord.input.dependency.CoordInputDependency in project oozie by apache.

the class CoordActionUpdatePushMissingDependency method execute.

@Override
protected Void execute() throws CommandException {
    CoordInputDependency coordPushInputDependency = coordAction.getPushInputDependencies();
    CoordInputDependency coordPullInputDependency = coordAction.getPullInputDependencies();
    LOG.info("STARTED for Action id [{0}]", actionId);
    if (coordPushInputDependency.isDependencyMet()) {
        LOG.info("Nothing to check. Empty push missing dependency");
    } else {
        PartitionDependencyManagerService pdms = Services.get().get(PartitionDependencyManagerService.class);
        Collection<String> availDepList = pdms.getAvailableDependencyURIs(actionId);
        if (availDepList == null || availDepList.size() == 0) {
            LOG.info("There are no available dependencies");
            if (isTimeout()) {
                // Poll and check as one last try
                queue(new CoordPushDependencyCheckXCommand(coordAction.getId()), 100);
            }
        } else {
            String pushMissingDependencies = coordPushInputDependency.getMissingDependencies().toString();
            LOG.debug("Updating with available uris = [{0}] where missing uris = [{1}]", pushMissingDependencies);
            String[] missingDependenciesArray = DependencyChecker.dependenciesAsArray(pushMissingDependencies);
            coordPushInputDependency.addToAvailableDependencies(availDepList);
            boolean isChangeInDependency = true;
            if (coordPushInputDependency.isDependencyMet()) {
                // All push-based dependencies are available
                onAllPushDependenciesAvailable(coordPullInputDependency.isDependencyMet());
            } else {
                if (coordPushInputDependency.getMissingDependenciesAsList().size() == missingDependenciesArray.length) {
                    isChangeInDependency = false;
                }
                if (isTimeout()) {
                    // Poll and check as one last try
                    queue(new CoordPushDependencyCheckXCommand(coordAction.getId()), 100);
                }
            }
            updateCoordAction(coordAction, isChangeInDependency);
            removeAvailableDependencies(pdms, availDepList);
            LOG.info("ENDED for Action id [{0}]", actionId);
        }
    }
    return null;
}
Also used : PartitionDependencyManagerService(org.apache.oozie.service.PartitionDependencyManagerService) CoordInputDependency(org.apache.oozie.coord.input.dependency.CoordInputDependency)

Aggregations

CoordInputDependency (org.apache.oozie.coord.input.dependency.CoordInputDependency)6 CommandException (org.apache.oozie.command.CommandException)3 PreconditionException (org.apache.oozie.command.PreconditionException)3 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)3 IOException (java.io.IOException)2 StringReader (java.io.StringReader)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Configuration (org.apache.hadoop.conf.Configuration)2 ElException (org.apache.oozie.coord.ElException)2 ActionDependency (org.apache.oozie.dependency.ActionDependency)2 Pair (org.apache.oozie.util.Pair)2 XConfiguration (org.apache.oozie.util.XConfiguration)2 URI (java.net.URI)1 Calendar (java.util.Calendar)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AccessControlException (org.apache.hadoop.security.AccessControlException)1 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)1 CoordELEvaluator (org.apache.oozie.coord.CoordELEvaluator)1