job.proto 10 KB

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