func (js *JobScheduler) Cancel() error {
	ctx := js.withBaseContext(js.Background())

	if js.Current() == nil {
		logger.MaybeDebugfContext(ctx, js.Log, "cannot cancel; job is not runnning")
		return nil
	}
	gracePeriod := js.Config().ShutdownGracePeriodOrDefault()
	if gracePeriod > 0 {
		ctx, cancel := js.withTimeoutOrCancel(ctx, gracePeriod)
		defer cancel()
		js.waitCurrentComplete(ctx)
	}
	if current := js.Current(); current != nil && current.Status == JobInvocationStatusRunning {
		current.Cancel()
	} else {
		logger.MaybeDebugfContext(ctx, js.Log, "cannot cancel; job is not runnning")
	}
	return nil
}
// Cancel stops all running invocations.
Cancel stops all running invocations.
// Cancel stops all running invocations .
func (js *JobScheduler) Cancel() error {
	ctx := js.withBaseContext(js.Background())
	if js.Current() == nil {
		logger.MaybeDebugfContext(ctx, js.Log, "cannot cancel; job is not runnning")
		return nil
	}
	gracePeriod := js.Config().ShutdownGracePeriodOrDefault()
	if gracePeriod > 0 {
		ctx, cancel := js.withTimeoutOrCancel(ctx, gracePeriod)
		defer cancel()
		js.waitCurrentComplete(ctx)
	}
	if current := js.Current(); current != nil && current.Status == JobInvocationStatusRunning {
		current.Cancel()
	} else {
		logger.MaybeDebugfContext(ctx, js.Log, "cannot cancel; job is not runnning")
	}
	return nil
}
func ( js * JobScheduler ) Cancel ( ) error { ctx := js . withBaseContext ( js . Background ( ) ) if js . Current ( ) == nil { logger . MaybeDebugfContext ( ctx , js . Log , " " ) return nil } gracePeriod := js . Config ( ) . ShutdownGracePeriodOrDefault ( ) if gracePeriod > 0 { ctx , cancel := js . withTimeoutOrCancel ( ctx , gracePeriod ) defer cancel ( ) js . waitCurrentComplete ( ctx ) } if current := js . Current ( ) ; current != nil && current . Status == JobInvocationStatusRunning { current . Cancel ( ) } else { logger . MaybeDebugfContext ( ctx , js . Log , " " ) } return nil }
Cancel stops all running invocations.
Cancel stops all running invocations .