github.com/matrixorigin/matrixone@v0.7.0/proto/task.proto (about) 1 /* 2 * Copyright 2021 Matrix Origin 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 syntax = "proto3"; 18 package task; 19 option go_package = "github.com/matrixorigin/matrixone/pkg/pb/task"; 20 21 import "github.com/gogo/protobuf/gogoproto/gogo.proto"; 22 23 option (gogoproto.goproto_enum_prefix_all) = true; 24 25 // TaskStatus task status 26 enum TaskStatus { 27 // Create is the state of waiting to be scheduled. 28 Created = 0; 29 // Running is running state. Task is assigned to a CN node and is running 30 Running = 1; 31 // Completed the task has been completed. 32 Completed = 2; 33 } 34 35 // TaskCode task code 36 enum TaskCode { 37 // TestOnly reserved for testing. 38 TestOnly = 0; 39 // SystemInit system init task 40 SystemInit = 1; 41 // MetricLogMerge handle metric/log exported data merge task 42 MetricLogMerge = 2; 43 // MetricStorageUsage handle metric server_storage_usage collection 44 MetricStorageUsage = 3; 45 } 46 47 // TaskMetadata is a task metadata abstraction that can be scheduled for execution at any CN node. 48 message TaskMetadata { 49 // ID task id, global unique 50 string ID = 1; 51 // Executor used to select a particular task executor to run a task 52 TaskCode Executor = 2; 53 // Context context needed to run the task 54 bytes Context = 3; 55 // Options options for execute task 56 TaskOptions Options = 4 [(gogoproto.nullable) = false]; 57 } 58 59 // TaskOptions task options 60 message TaskOptions { 61 // MaxRetryTimes 0 means disable retry 62 uint32 MaxRetryTimes = 1; 63 // RetryInterval retry interval 64 int64 RetryInterval = 2; 65 // DelayDuration delay duration. Controls how long a task is delayed before it is scheduled for 66 // execution. 67 int64 DelayDuration = 3; 68 // Concurrency is the max number of a task running at the same time. 0 means no limits. 69 uint32 Concurrency = 4; 70 } 71 72 // ResultCode result code 73 enum ResultCode { 74 // Success success 75 Success = 0; 76 // Failed failed 77 Failed = 1; 78 } 79 80 // ExecuteResult task execute result 81 message ExecuteResult { 82 // Code result code 83 ResultCode Code = 1; 84 // Error error message 85 string Error = 2; 86 } 87 88 // Task task execute info. 89 message Task { 90 uint64 ID = 1; 91 // TaskMetadata task metadata 92 TaskMetadata Metadata = 2 [(gogoproto.nullable) = false]; 93 // ParentTaskID used to record the parent task of the current task 94 string ParentTaskID = 3; 95 // TaskStatus task status 96 TaskStatus Status = 4; 97 // TaskRunner is the UUID of the CN node which the task run is assigned to 98 string TaskRunner = 5; 99 // Epoch indicates how many times the current task is scheduled, the first time it is scheduled 100 // is 1. Each time it is scheduled, Epoch++. 101 uint32 Epoch = 6; 102 // LastHeartbeat time of the last heartbeat reported by TaskRunner. Unix timestamp in ms 103 int64 LastHeartbeat = 7; 104 // CreateAt time of the task created. Unix timestamp in ms 105 int64 CreateAt = 8; 106 // CompletedAt time of the task completed. Unix timestamp in ms 107 int64 CompletedAt = 9; 108 // ExecuteResult execute result 109 ExecuteResult ExecuteResult = 10; 110 } 111 112 // CronTask task execute info. 113 message CronTask { 114 uint64 ID = 1; 115 // TaskMetadata task metadata 116 TaskMetadata Metadata = 2 [(gogoproto.nullable) = false]; 117 // CronExpr cron expr 118 string CronExpr = 3; 119 // NextTime the next time it should be scheduled for execution. Unix timestamp in ms 120 int64 NextTime = 4; 121 // TriggerTimes the number of times it was triggered 122 uint64 TriggerTimes = 5; 123 // CreateAt time of the cron task created. Unix timestamp in ms 124 int64 CreateAt = 6; 125 // CreateAt time of the cron task created. Unix timestamp in ms 126 int64 UpdateAt = 7; 127 }