job.proto 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. // Copyright 2019 Google LLC.
  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. package google.cloud.scheduler.v1;
  17. import "google/api/resource.proto";
  18. import "google/cloud/scheduler/v1/target.proto";
  19. import "google/protobuf/duration.proto";
  20. import "google/protobuf/timestamp.proto";
  21. import "google/rpc/status.proto";
  22. import "google/api/annotations.proto";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "JobProto";
  26. option java_package = "com.google.cloud.scheduler.v1";
  27. // Configuration for a job.
  28. // The maximum allowed size for a job is 100KB.
  29. message Job {
  30. option (google.api.resource) = {
  31. type: "cloudscheduler.googleapis.com/Job"
  32. pattern: "projects/{project}/locations/{location}/jobs/{job}"
  33. };
  34. // State of the job.
  35. enum State {
  36. // Unspecified state.
  37. STATE_UNSPECIFIED = 0;
  38. // The job is executing normally.
  39. ENABLED = 1;
  40. // The job is paused by the user. It will not execute. A user can
  41. // intentionally pause the job using
  42. // [PauseJobRequest][google.cloud.scheduler.v1.PauseJobRequest].
  43. PAUSED = 2;
  44. // The job is disabled by the system due to error. The user
  45. // cannot directly set a job to be disabled.
  46. DISABLED = 3;
  47. // The job state resulting from a failed [CloudScheduler.UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]
  48. // operation. To recover a job from this state, retry
  49. // [CloudScheduler.UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob] until a successful response is received.
  50. UPDATE_FAILED = 4;
  51. }
  52. // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob], after
  53. // which it becomes output only.
  54. //
  55. // The job name. For example:
  56. // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
  57. //
  58. // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
  59. // hyphens (-), colons (:), or periods (.).
  60. // For more information, see
  61. // [Identifying
  62. // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
  63. // * `LOCATION_ID` is the canonical ID for the job's location.
  64. // The list of available locations can be obtained by calling
  65. // [ListLocations][google.cloud.location.Locations.ListLocations].
  66. // For more information, see https://cloud.google.com/about/locations/.
  67. // * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
  68. // hyphens (-), or underscores (_). The maximum length is 500 characters.
  69. string name = 1;
  70. // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob] or
  71. // [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
  72. //
  73. // A human-readable description for the job. This string must not contain
  74. // more than 500 characters.
  75. string description = 2;
  76. // Required.
  77. //
  78. // Delivery settings containing destination and parameters.
  79. oneof target {
  80. // Pub/Sub target.
  81. PubsubTarget pubsub_target = 4;
  82. // App Engine HTTP target.
  83. AppEngineHttpTarget app_engine_http_target = 5;
  84. // HTTP target.
  85. HttpTarget http_target = 6;
  86. }
  87. // Required, except when used with [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
  88. //
  89. // Describes the schedule on which the job will be executed.
  90. //
  91. // The schedule can be either of the following types:
  92. //
  93. // * [Crontab](http://en.wikipedia.org/wiki/Cron#Overview)
  94. // * English-like
  95. // [schedule](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules)
  96. //
  97. // As a general rule, execution `n + 1` of a job will not begin
  98. // until execution `n` has finished. Cloud Scheduler will never
  99. // allow two simultaneously outstanding executions. For example,
  100. // this implies that if the `n+1`th execution is scheduled to run at
  101. // 16:00 but the `n`th execution takes until 16:15, the `n+1`th
  102. // execution will not start until `16:15`.
  103. // A scheduled start time will be delayed if the previous
  104. // execution has not ended when its scheduled time occurs.
  105. //
  106. // If [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] > 0 and a job attempt fails,
  107. // the job will be tried a total of [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count]
  108. // times, with exponential backoff, until the next scheduled start
  109. // time.
  110. string schedule = 20;
  111. // Specifies the time zone to be used in interpreting
  112. // [schedule][google.cloud.scheduler.v1.Job.schedule]. The value of this field must be a time
  113. // zone name from the [tz database](http://en.wikipedia.org/wiki/Tz_database).
  114. //
  115. // Note that some time zones include a provision for
  116. // daylight savings time. The rules for daylight saving time are
  117. // determined by the chosen tz. For UTC use the string "utc". If a
  118. // time zone is not specified, the default will be in UTC (also known
  119. // as GMT).
  120. string time_zone = 21;
  121. // Output only. The creation time of the job.
  122. google.protobuf.Timestamp user_update_time = 9;
  123. // Output only. State of the job.
  124. State state = 10;
  125. // Output only. The response from the target for the last attempted execution.
  126. google.rpc.Status status = 11;
  127. // Output only. The next time the job is scheduled. Note that this may be a
  128. // retry of a previously failed attempt or the next execution time
  129. // according to the schedule.
  130. google.protobuf.Timestamp schedule_time = 17;
  131. // Output only. The time the last job attempt started.
  132. google.protobuf.Timestamp last_attempt_time = 18;
  133. // Settings that determine the retry behavior.
  134. RetryConfig retry_config = 19;
  135. // The deadline for job attempts. If the request handler does not respond by
  136. // this deadline then the request is cancelled and the attempt is marked as a
  137. // `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in
  138. // execution logs. Cloud Scheduler will retry the job according
  139. // to the [RetryConfig][google.cloud.scheduler.v1.RetryConfig].
  140. //
  141. // The allowed duration for this deadline is:
  142. // * For [HTTP targets][google.cloud.scheduler.v1.Job.http_target], between 15 seconds and 30 minutes.
  143. // * For [App Engine HTTP targets][google.cloud.scheduler.v1.Job.app_engine_http_target], between 15
  144. // seconds and 24 hours.
  145. google.protobuf.Duration attempt_deadline = 22;
  146. }
  147. // Settings that determine the retry behavior.
  148. //
  149. // By default, if a job does not complete successfully (meaning that
  150. // an acknowledgement is not received from the handler, then it will be retried
  151. // with exponential backoff according to the settings in [RetryConfig][google.cloud.scheduler.v1.RetryConfig].
  152. message RetryConfig {
  153. // The number of attempts that the system will make to run a job using the
  154. // exponential backoff procedure described by
  155. // [max_doublings][google.cloud.scheduler.v1.RetryConfig.max_doublings].
  156. //
  157. // The default value of retry_count is zero.
  158. //
  159. // If retry_count is zero, a job attempt will *not* be retried if
  160. // it fails. Instead the Cloud Scheduler system will wait for the
  161. // next scheduled execution time.
  162. //
  163. // If retry_count is set to a non-zero number then Cloud Scheduler
  164. // will retry failed attempts, using exponential backoff,
  165. // retry_count times, or until the next scheduled execution time,
  166. // whichever comes first.
  167. //
  168. // Values greater than 5 and negative values are not allowed.
  169. int32 retry_count = 1;
  170. // The time limit for retrying a failed job, measured from time when an
  171. // execution was first attempted. If specified with
  172. // [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count], the job will be retried until both
  173. // limits are reached.
  174. //
  175. // The default value for max_retry_duration is zero, which means retry
  176. // duration is unlimited.
  177. google.protobuf.Duration max_retry_duration = 2;
  178. // The minimum amount of time to wait before retrying a job after
  179. // it fails.
  180. //
  181. // The default value of this field is 5 seconds.
  182. google.protobuf.Duration min_backoff_duration = 3;
  183. // The maximum amount of time to wait before retrying a job after
  184. // it fails.
  185. //
  186. // The default value of this field is 1 hour.
  187. google.protobuf.Duration max_backoff_duration = 4;
  188. // The time between retries will double `max_doublings` times.
  189. //
  190. // A job's retry interval starts at
  191. // [min_backoff_duration][google.cloud.scheduler.v1.RetryConfig.min_backoff_duration], then doubles
  192. // `max_doublings` times, then increases linearly, and finally
  193. // retries retries at intervals of
  194. // [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] up to
  195. // [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] times.
  196. //
  197. // For example, if [min_backoff_duration][google.cloud.scheduler.v1.RetryConfig.min_backoff_duration] is
  198. // 10s, [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] is 300s, and
  199. // `max_doublings` is 3, then the a job will first be retried in 10s. The
  200. // retry interval will double three times, and then increase linearly by
  201. // 2^3 * 10s. Finally, the job will retry at intervals of
  202. // [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] until the job has
  203. // been attempted [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] times. Thus, the
  204. // requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ....
  205. //
  206. // The default value of this field is 5.
  207. int32 max_doublings = 5;
  208. }