Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Task concurrency not being respected #23881

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions cmd/influxd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,20 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
query.QueryServiceBridge{AsyncQueryService: m.queryController},
)

executor, executorMetrics := executor.NewExecutor(
executorInstance, executorMetrics := executor.NewExecutor(
m.log.With(zap.String("service", "task-executor")),
query.QueryServiceBridge{AsyncQueryService: m.queryController},
ts.UserService,
combinedTaskService,
combinedTaskService,
executor.WithFlagger(m.flagger),
)
err = executor.LoadExistingScheduleRuns(ctx)
err = executorInstance.LoadExistingScheduleRuns(ctx)
if err != nil {
m.log.Fatal("could not load existing scheduled runs", zap.Error(err))
}
m.executor = executor
executorInstance.SetLimitFunc(executor.ConcurrencyLimit(executorInstance, fluxlang.DefaultService))
m.executor = executorInstance
m.reg.MustRegister(executorMetrics.PrometheusCollectors()...)
schLogger := m.log.With(zap.String("service", "task-scheduler"))

Expand All @@ -476,7 +477,7 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
err error
)
sch, sm, err = scheduler.NewScheduler(
executor,
executorInstance,
taskbackend.NewSchedulableTaskService(m.kvService),
scheduler.WithOnErrorFn(func(ctx context.Context, taskID scheduler.ID, scheduledAt time.Time, err error) {
schLogger.Info(
Expand Down Expand Up @@ -505,7 +506,7 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
taskCoord := coordinator.NewCoordinator(
coordLogger,
sch,
executor)
executorInstance)

taskSvc = middleware.New(combinedTaskService, taskCoord)
if err := taskbackend.TaskNotifyCoordinatorOfExisting(
Expand All @@ -514,7 +515,7 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
combinedTaskService,
taskCoord,
func(ctx context.Context, taskID platform2.ID, runID platform2.ID) error {
_, err := executor.ResumeCurrentRun(ctx, taskID, runID)
_, err := executorInstance.ResumeCurrentRun(ctx, taskID, runID)
return err
},
coordLogger); err != nil {
Expand Down