//AfterTaskCanceled runs the AfterTaskCanceledFn if not nil
776215
func (i *FuncInterceptor) AfterTaskCanceled(activity *swf.PollForActivityTaskOutput, details string) {
	if i.AfterTaskCanceledFn != nil {
		i.AfterTaskCanceledFn(activity, details)
	}
}
658031
func (s *RecordActivityTaskHeartbeatOutput) SetCancelRequested(v bool) *RecordActivityTaskHeartbeatOutput {
	s.CancelRequested = &v
	return s
}
751680
func (s *TasksListService) WaitForCompletion(waitForCompletion bool) *TasksListService {
	s.waitForCompletion = &waitForCompletion
	return s
}
623647
func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput) error {
	return c.WaitUntilStackDeleteCompleteWithContext(aws.BackgroundContext(), input)
}
126695
func (c *ECS) WaitUntilTasksNotPending(input *ecs.DescribeTasksInput) error {
	waiterCfg := awswaiter.Config{
		Operation:   "DescribeTasks",
		Delay:       6,
		MaxAttempts: 100,
		Acceptors: []awswaiter.WaitAcceptor{
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "failures[].reason",
				Expected: "MISSING",
			},
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "tasks[].lastStatus",
				Expected: "RUNNING",
			},
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "tasks[].lastStatus",
				Expected: "STOPPED",
			},
		},
	}

	w := awswaiter.Waiter{
		Client: c.ECS,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
587613
func (c *EC2) WaitUntilConversionTaskCompleted(input *DescribeConversionTasksInput) error {
	return c.WaitUntilConversionTaskCompletedWithContext(aws.BackgroundContext(), input)
}
909808
func (s *ProgressCounters) SetCancelledSteps(v int64) *ProgressCounters {
	s.CancelledSteps = &v
	return s
}
507413
func (d *kubeDockerClient) getCancelableContext() (context.Context, context.CancelFunc) {
	return context.WithCancel(context.Background())
}
195382
func (fc *FakeClock) AfterFunc(d time.Duration, f func()) Timer {
	return fc.FakeAfterFunc(d, f)
}
987549
func (s *Setup) AfterEach(fn func()) {
	if fn != nil {
		s.afterEachFns = append(s.afterEachFns, fn)
	}
}
1362277
func (s *HistoryEvent) SetCancelTimerFailedEventAttributes(v *CancelTimerFailedEventAttributes) *HistoryEvent {
	s.CancelTimerFailedEventAttributes = v
	return s
}
1339285
func (s *Decision) SetCancelWorkflowExecutionDecisionAttributes(v *CancelWorkflowExecutionDecisionAttributes) *Decision {
	s.CancelWorkflowExecutionDecisionAttributes = v
	return s
}
964121
func MarkTaskSucceeded(t *automationpb.Task, output string) {
	t.State = automationpb.TaskState_DONE
	t.Output = output
}
1326452
func (s *ContinueAsNewWorkflowExecutionDecisionAttributes) SetTaskStartToCloseTimeout(v string) *ContinueAsNewWorkflowExecutionDecisionAttributes {
	s.TaskStartToCloseTimeout = &v
	return s
}
370885
func (o *CancelBuildOptions) RunCancelBuild() error {
	var builds []*buildv1.Build
	for _, name := range o.BuildNames {
		build, err := o.BuildClient.Get(name, metav1.GetOptions{})
		if err != nil {
			o.ReportError(fmt.Errorf("build %s/%s not found", o.Namespace, name))
			continue
		}

		stateMatch := false
		for _, state := range o.States {
			if strings.ToLower(string(build.Status.Phase)) == state {
				stateMatch = true
				break
			}
		}

		if stateMatch && !buildutil.IsTerminalPhase(build.Status.Phase) {
			builds = append(builds, build)
		}
	}

	if o.DumpLogs {
		for _, b := range builds {
			// Do not attempt to get logs from build that was not scheduled.
			if b.Status.Phase == buildv1.BuildPhaseNew {
				continue
			}
			logClient := buildclientv1.NewBuildLogClient(o.Client.RESTClient(), o.Namespace)
			opts := buildv1.BuildLogOptions{NoWait: true}
			response, err := logClient.Logs(b.Name, opts).Do().Raw()
			if err != nil {
				o.ReportError(fmt.Errorf("unable to fetch logs for %s/%s: %v", b.Namespace, b.Name, err))
				continue
			}
			fmt.Fprintf(o.Out, "==== Build %s/%s logs ====\n", b.Namespace, b.Name)
			fmt.Fprint(o.Out, string(response))
		}
	}

	var wg sync.WaitGroup
	for _, b := range builds {
		wg.Add(1)
		go func(build *buildv1.Build) {
			defer wg.Done()
			err := wait.Poll(500*time.Millisecond, o.timeout, func() (bool, error) {
				build.Status.Cancelled = true
				_, err := o.BuildClient.Update(build)
				switch {
				case err == nil:
					return true, nil
				case kapierrors.IsConflict(err):
					build, err = o.BuildClient.Get(build.Name, metav1.GetOptions{})
					return false, err
				}
				return true, err
			})
			if err != nil {
				o.ReportError(fmt.Errorf("build %s/%s failed to update: %v", build.Namespace, build.Name, err))
				return
			}

			// ignore exit if error here; the phase verfication below is more important
			o.PrinterCancelInProgress.PrintObj(build, o.Out)

			// Make sure the build phase is really cancelled.
			timeout := o.timeout
			if build.Spec.Strategy.JenkinsPipelineStrategy != nil {
				//bump the timeout in case we have to wait for Jenkins
				//to come up so that the sync plugin can actually change
				//the phase
				timeout = timeout + (3 * time.Minute)
			}
			err = wait.Poll(500*time.Millisecond, timeout, func() (bool, error) {
				updatedBuild, err := o.BuildClient.Get(build.Name, metav1.GetOptions{})
				if err != nil {
					return true, err
				}
				return updatedBuild.Status.Phase == buildv1.BuildPhaseCancelled, nil
			})
			if err != nil {
				o.ReportError(fmt.Errorf("build %s/%s failed to cancel: %v", build.Namespace, build.Name, err))
				return
			}

			if err := o.PrinterCancel.PrintObj(build, o.Out); err != nil {
				o.ReportError(fmt.Errorf("build %s/%s failed to print: %v", build.Namespace, build.Name, err))
				return
			}
		}(b)
	}
	wg.Wait()

	if o.Restart {
		for _, b := range builds {
			request := &buildv1.BuildRequest{ObjectMeta: metav1.ObjectMeta{Namespace: b.Namespace, Name: b.Name}}
			build, err := o.BuildClient.Clone(request.Name, request)
			if err != nil {
				o.ReportError(fmt.Errorf("build %s/%s failed to restart: %v", b.Namespace, b.Name, err))
				continue
			}
			if err := o.PrinterRestart.PrintObj(b, o.Out); err != nil {
				o.ReportError(fmt.Errorf("build %s/%s failed to print: %v", build.Namespace, build.Name, err))
				continue
			}
		}
	}

	if o.HasError {
		return errors.New("failure during the build cancellation")
	}

	return nil
}
117906
func WithCancel(d Doner) (C, func()) {
	var closer sync.Once
	cq := make(chan struct{})
	cancel := func() { closer.Do(func() { close(cq) }) }

	go func() {
		select {
		case <-cq:
		case <-d.Done():
			cancel()
		}
	}()

	return cq, cancel
}
747888
func (this *Promise) OnCancel(callback func()) *Promise {
	this.Future.OnCancel(callback)
	return this
}