blob: f5131c8ca58872ff887f7f3a1752f64030bcb8aa [file] [log] [blame]
// Copyright 2017 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package internal.tq;
option go_package = "go.chromium.org/luci/scheduler/appengine/internal";
import "go.chromium.org/luci/scheduler/appengine/internal/timers.proto";
import "go.chromium.org/luci/scheduler/appengine/internal/triggers.proto";
// ReadProjectConfigTask is used to import jobs of some project.
//
// Queue: "read-project-config".
message ReadProjectConfigTask {
string project_id = 1;
}
// LaunchInvocationTask is used to start running (or retry a lunch of) a single
// invocation.
//
// It is enqueued non-transactionally, but with the deduplication key.
//
// Queue: "launches".
message LaunchInvocationTask {
string job_id = 1;
int64 inv_id = 2;
}
// LaunchInvocationsBatchTask is used to kick off several invocations at once.
//
// It is enqueued transactionally. It fans out into many LaunchInvocationTask.
//
// Queue: "batches".
message LaunchInvocationsBatchTask {
repeated LaunchInvocationTask tasks = 1;
}
// TriageJobStateTask looks at the state of the job and decided what to do next.
//
// Enqueued non-transactionally. It is throttled to run approximately once per
// second. It looks at pending triggers and recently finished invocations and
// launches new invocations (or schedules timers to do it later).
//
// Queue: "triages".
message TriageJobStateTask {
string job_id = 1;
}
// KickTriageTask can be used to transactionally initiate a new triage.
//
// We can't transactionally enqueue TriageJobStateTask, since its throttling
// mechanism uses memcache and named tasks, which are not available inside
// transactions. So instead transactions can enqueue KickTriageTask, which in
// turn will enqueue TriageJobStateTask (with throttling).
//
// Queue: "triages".
message KickTriageTask {
string job_id = 1;
}
// InvocationFinishedTask is emitted by the invocation when it finishes.
//
// It is enqueued transactionally.
//
// Queue: "completions".
message InvocationFinishedTask {
string job_id = 1;
int64 inv_id = 2;
FanOutTriggersTask triggers = 3;
}
// FanOutTriggersTask is a batch task that emits a bunch of triggers.
//
// It is enqueued transactionally. It fans out into many EnqueueTriggersTask,
// one per job ID.
//
// Queue: "triggers".
message FanOutTriggersTask {
repeated string job_ids = 1;
repeated triggers.Trigger triggers = 2;
}
// EnqueueTriggersTask adds given triggers to a job's pending triggers set.
//
// Enqueued non-transactionally (from FanOutTriggersTask) and transactionally
// (when emitting single trigger from a cron).
//
// Queue: "triggers".
message EnqueueTriggersTask {
string job_id = 1;
repeated triggers.Trigger triggers = 2;
}
// ScheduleTimersTask adds a bunch of delayed invocation calls.
//
// It is enqueued transactionally. Results in a bunch of TimerTask calls.
//
// Queue: "timers".
message ScheduleTimersTask {
string job_id = 1;
int64 inv_id = 2;
repeated timers.Timer timers = 3;
}
// TimerTask corresponds to delayed calls added through AddTimer controller API.
//
// Enqueued either transactionally or not. Deduplicated based on invocation's
// PendingTimers set: any timers not in the set are silently skipped.
//
// Queue: "timers".
message TimerTask {
string job_id = 1;
int64 inv_id = 2;
timers.Timer timer = 3;
}
// CronTickTask is scheduled based on the job's cron schedule.
//
// It is enqueued transactionally when the job changes state (e.g. the job
// appears for the first time or its schedule changes) or from previous cron
// ticks.
//
// Queue: "crons".
message CronTickTask {
string job_id = 1;
int64 tick_nonce = 2; // used to skip no longer interesting ticks
}