go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/scheduler/appengine/internal/tq.proto (about) 1 // Copyright 2017 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package internal.tq; 18 19 option go_package = "go.chromium.org/luci/scheduler/appengine/internal"; 20 21 import "go.chromium.org/luci/scheduler/appengine/internal/timers.proto"; 22 import "go.chromium.org/luci/scheduler/appengine/internal/triggers.proto"; 23 24 25 // ReadProjectConfigTask is used to import jobs of some project. 26 // 27 // Queue: "read-project-config". 28 message ReadProjectConfigTask { 29 string project_id = 1; 30 } 31 32 33 // LaunchInvocationTask is used to start running (or retry a lunch of) a single 34 // invocation. 35 // 36 // It is enqueued non-transactionally, but with the deduplication key. 37 // 38 // Queue: "launches". 39 message LaunchInvocationTask { 40 string job_id = 1; 41 int64 inv_id = 2; 42 } 43 44 45 // LaunchInvocationsBatchTask is used to kick off several invocations at once. 46 // 47 // It is enqueued transactionally. It fans out into many LaunchInvocationTask. 48 // 49 // Queue: "batches". 50 message LaunchInvocationsBatchTask { 51 repeated LaunchInvocationTask tasks = 1; 52 } 53 54 55 // TriageJobStateTask looks at the state of the job and decided what to do next. 56 // 57 // Enqueued non-transactionally. It is throttled to run approximately once per 58 // second. It looks at pending triggers and recently finished invocations and 59 // launches new invocations (or schedules timers to do it later). 60 // 61 // Queue: "triages". 62 message TriageJobStateTask { 63 string job_id = 1; 64 } 65 66 67 // KickTriageTask can be used to transactionally initiate a new triage. 68 // 69 // We can't transactionally enqueue TriageJobStateTask, since its throttling 70 // mechanism uses memcache and named tasks, which are not available inside 71 // transactions. So instead transactions can enqueue KickTriageTask, which in 72 // turn will enqueue TriageJobStateTask (with throttling). 73 // 74 // Queue: "triages". 75 message KickTriageTask { 76 string job_id = 1; 77 } 78 79 80 // InvocationFinishedTask is emitted by the invocation when it finishes. 81 // 82 // It is enqueued transactionally. 83 // 84 // Queue: "completions". 85 message InvocationFinishedTask { 86 string job_id = 1; 87 int64 inv_id = 2; 88 FanOutTriggersTask triggers = 3; 89 } 90 91 92 // FanOutTriggersTask is a batch task that emits a bunch of triggers. 93 // 94 // It is enqueued transactionally. It fans out into many EnqueueTriggersTask, 95 // one per job ID. 96 // 97 // Queue: "triggers". 98 message FanOutTriggersTask { 99 repeated string job_ids = 1; 100 repeated triggers.Trigger triggers = 2; 101 } 102 103 104 // EnqueueTriggersTask adds given triggers to a job's pending triggers set. 105 // 106 // Enqueued non-transactionally (from FanOutTriggersTask) and transactionally 107 // (when emitting single trigger from a cron). 108 // 109 // Queue: "triggers". 110 message EnqueueTriggersTask { 111 string job_id = 1; 112 repeated triggers.Trigger triggers = 2; 113 } 114 115 116 // ScheduleTimersTask adds a bunch of delayed invocation calls. 117 // 118 // It is enqueued transactionally. Results in a bunch of TimerTask calls. 119 // 120 // Queue: "timers". 121 message ScheduleTimersTask { 122 string job_id = 1; 123 int64 inv_id = 2; 124 repeated timers.Timer timers = 3; 125 } 126 127 128 // TimerTask corresponds to delayed calls added through AddTimer controller API. 129 // 130 // Enqueued either transactionally or not. Deduplicated based on invocation's 131 // PendingTimers set: any timers not in the set are silently skipped. 132 // 133 // Queue: "timers". 134 message TimerTask { 135 string job_id = 1; 136 int64 inv_id = 2; 137 timers.Timer timer = 3; 138 } 139 140 141 // CronTickTask is scheduled based on the job's cron schedule. 142 // 143 // It is enqueued transactionally when the job changes state (e.g. the job 144 // appears for the first time or its schedule changes) or from previous cron 145 // ticks. 146 // 147 // Queue: "crons". 148 message CronTickTask { 149 string job_id = 1; 150 int64 tick_nonce = 2; // used to skip no longer interesting ticks 151 }