kaisun2000 commented on issue #1289:
URL: https://github.com/apache/helix/issues/1289#issuecomment-675148772


   ```
    public TaskState pollForWorkflowState(String workflowName, long timeout,
         TaskState... targetStates) throws InterruptedException {
       // Wait for completion.
       long st = System.currentTimeMillis();
       WorkflowContext ctx;
       Set<TaskState> allowedStates = new 
HashSet<>(Arrays.asList(targetStates));
   
       long timeToSleep = timeout > 100L ? 100L : timeout;
       do {
         Thread.sleep(timeToSleep);
         ctx = getWorkflowContext(workflowName);
       } while ((ctx == null || ctx.getWorkflowState() == null
           || !allowedStates.contains(ctx.getWorkflowState()))
           && System.currentTimeMillis() < st + timeout);
   
       if (ctx == null || !allowedStates.contains(ctx.getWorkflowState())) {
         throw new HelixException(String.format(
             "Workflow \"%s\" context is empty or not in states: \"%s\", 
current state: \"%s\"",
             workflowName, Arrays.asList(targetStates),
             ctx == null ? "null" : ctx.getWorkflowState().toString()));
       }
   
       return ctx.getWorkflowState();
     }
   
   
   ```
   
   Is it possible that only one job failing would cause workflow failure? 
`!allowedStates.contains(ctx.getWorkflowState()))`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to