コード例 #1
0
 @Override
 public void reRun(String cluster, String jobId, Properties props, boolean isForced)
     throws FalconException {
   InstanceState instanceState = STATE_STORE.getExecutionInstance(jobId);
   ExecutionInstance instance = instanceState.getInstance();
   EntityExecutor executor = EXECUTION_SERVICE.getEntityExecutor(instance.getEntity(), cluster);
   executor.rerun(instance, props, isForced);
 }
コード例 #2
0
 private InstancesResult.Instance performAction(
     String cluster,
     Entity entity,
     JobAction action,
     ExecutionInstance instance,
     Properties userProps,
     boolean isForced)
     throws FalconException {
   EntityExecutor executor = EXECUTION_SERVICE.getEntityExecutor(entity, cluster);
   InstancesResult.Instance instanceInfo = null;
   LOG.debug("Retrieving information for {} for action {}", instance.getId(), action);
   if (StringUtils.isNotEmpty(instance.getExternalID())) {
     instanceInfo = DAGEngineFactory.getDAGEngine(cluster).info(instance.getExternalID());
   } else {
     instanceInfo = new InstancesResult.Instance();
   }
   switch (action) {
     case KILL:
       executor.kill(instance);
       populateInstanceInfo(instanceInfo, instance);
       break;
     case SUSPEND:
       executor.suspend(instance);
       populateInstanceInfo(instanceInfo, instance);
       break;
     case RESUME:
       executor.resume(instance);
       populateInstanceInfo(instanceInfo, instance);
       break;
     case RERUN:
       executor.rerun(instance, userProps, isForced);
       populateInstanceInfo(instanceInfo, instance);
       break;
     case STATUS:
       // Mask wfParams
       instanceInfo.wfParams = null;
       if (StringUtils.isNotEmpty(instance.getExternalID())) {
         List<InstancesResult.InstanceAction> instanceActions =
             DAGEngineFactory.getDAGEngine(cluster).getJobDetails(instance.getExternalID());
         instanceInfo.actions =
             instanceActions.toArray(new InstancesResult.InstanceAction[instanceActions.size()]);
         // If not scheduled externally yet, get details from state
       } else {
         populateInstanceInfo(instanceInfo, instance);
       }
       break;
     case PARAMS:
       // Mask details, log
       instanceInfo.details = null;
       instanceInfo.logFile = null;
       Properties props =
           DAGEngineFactory.getDAGEngine(cluster).getConfiguration(instance.getExternalID());
       InstancesResult.KeyValuePair[] keyValuePairs =
           new InstancesResult.KeyValuePair[props.size()];
       int i = 0;
       for (String name : props.stringPropertyNames()) {
         keyValuePairs[i++] = new InstancesResult.KeyValuePair(name, props.getProperty(name));
       }
       instanceInfo.wfParams = keyValuePairs;
       break;
     default:
       throw new IllegalArgumentException("Unhandled action " + action);
   }
   return instanceInfo;
 }