autoscaling_policies.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. // Copyright 2020 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. syntax = "proto3";
  15. package google.cloud.dataproc.v1beta2;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/protobuf/duration.proto";
  21. import "google/protobuf/empty.proto";
  22. option go_package = "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2;dataproc";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "AutoscalingPoliciesProto";
  25. option java_package = "com.google.cloud.dataproc.v1beta2";
  26. option (google.api.resource_definition) = {
  27. type: "dataproc.googleapis.com/Region"
  28. pattern: "projects/{project}/regions/{region}"
  29. };
  30. // The API interface for managing autoscaling policies in the
  31. // Cloud Dataproc API.
  32. service AutoscalingPolicyService {
  33. option (google.api.default_host) = "dataproc.googleapis.com";
  34. option (google.api.oauth_scopes) =
  35. "https://www.googleapis.com/auth/cloud-platform";
  36. // Creates new autoscaling policy.
  37. rpc CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest)
  38. returns (AutoscalingPolicy) {
  39. option (google.api.http) = {
  40. post: "/v1beta2/{parent=projects/*/locations/*}/autoscalingPolicies"
  41. body: "policy"
  42. additional_bindings {
  43. post: "/v1beta2/{parent=projects/*/regions/*}/autoscalingPolicies"
  44. body: "policy"
  45. }
  46. };
  47. option (google.api.method_signature) = "parent,policy";
  48. }
  49. // Updates (replaces) autoscaling policy.
  50. //
  51. // Disabled check for update_mask, because all updates will be full
  52. // replacements.
  53. rpc UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest)
  54. returns (AutoscalingPolicy) {
  55. option (google.api.http) = {
  56. put: "/v1beta2/{policy.name=projects/*/locations/*/autoscalingPolicies/*}"
  57. body: "policy"
  58. additional_bindings {
  59. put: "/v1beta2/{policy.name=projects/*/regions/*/autoscalingPolicies/*}"
  60. body: "policy"
  61. }
  62. };
  63. option (google.api.method_signature) = "policy";
  64. }
  65. // Retrieves autoscaling policy.
  66. rpc GetAutoscalingPolicy(GetAutoscalingPolicyRequest)
  67. returns (AutoscalingPolicy) {
  68. option (google.api.http) = {
  69. get: "/v1beta2/{name=projects/*/locations/*/autoscalingPolicies/*}"
  70. additional_bindings {
  71. get: "/v1beta2/{name=projects/*/regions/*/autoscalingPolicies/*}"
  72. }
  73. };
  74. option (google.api.method_signature) = "name";
  75. }
  76. // Lists autoscaling policies in the project.
  77. rpc ListAutoscalingPolicies(ListAutoscalingPoliciesRequest)
  78. returns (ListAutoscalingPoliciesResponse) {
  79. option (google.api.http) = {
  80. get: "/v1beta2/{parent=projects/*/locations/*}/autoscalingPolicies"
  81. additional_bindings {
  82. get: "/v1beta2/{parent=projects/*/regions/*}/autoscalingPolicies"
  83. }
  84. };
  85. option (google.api.method_signature) = "parent";
  86. }
  87. // Deletes an autoscaling policy. It is an error to delete an autoscaling
  88. // policy that is in use by one or more clusters.
  89. rpc DeleteAutoscalingPolicy(DeleteAutoscalingPolicyRequest)
  90. returns (google.protobuf.Empty) {
  91. option (google.api.http) = {
  92. delete: "/v1beta2/{name=projects/*/locations/*/autoscalingPolicies/*}"
  93. additional_bindings {
  94. delete: "/v1beta2/{name=projects/*/regions/*/autoscalingPolicies/*}"
  95. }
  96. };
  97. option (google.api.method_signature) = "name";
  98. }
  99. }
  100. // Describes an autoscaling policy for Dataproc cluster autoscaler.
  101. message AutoscalingPolicy {
  102. option (google.api.resource) = {
  103. type: "dataproc.googleapis.com/AutoscalingPolicy"
  104. pattern: "projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}"
  105. pattern: "projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}"
  106. history: ORIGINALLY_SINGLE_PATTERN
  107. };
  108. // Required. The policy id.
  109. //
  110. // The id must contain only letters (a-z, A-Z), numbers (0-9),
  111. // underscores (_), and hyphens (-). Cannot begin or end with underscore
  112. // or hyphen. Must consist of between 3 and 50 characters.
  113. string id = 1 [(google.api.field_behavior) = REQUIRED];
  114. // Output only. The "resource name" of the autoscaling policy, as described
  115. // in https://cloud.google.com/apis/design/resource_names.
  116. //
  117. // * For `projects.regions.autoscalingPolicies`, the resource name of the
  118. // policy has the following format:
  119. // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
  120. //
  121. // * For `projects.locations.autoscalingPolicies`, the resource name of the
  122. // policy has the following format:
  123. // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
  124. string name = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  125. // Required. Autoscaling algorithm for policy.
  126. oneof algorithm {
  127. BasicAutoscalingAlgorithm basic_algorithm = 3;
  128. }
  129. // Required. Describes how the autoscaler will operate for primary workers.
  130. InstanceGroupAutoscalingPolicyConfig worker_config = 4
  131. [(google.api.field_behavior) = REQUIRED];
  132. // Optional. Describes how the autoscaler will operate for secondary workers.
  133. InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5
  134. [(google.api.field_behavior) = OPTIONAL];
  135. }
  136. // Basic algorithm for autoscaling.
  137. message BasicAutoscalingAlgorithm {
  138. // Required. YARN autoscaling configuration.
  139. BasicYarnAutoscalingConfig yarn_config = 1
  140. [(google.api.field_behavior) = REQUIRED];
  141. // Optional. Duration between scaling events. A scaling period starts after
  142. // the update operation from the previous event has completed.
  143. //
  144. // Bounds: [2m, 1d]. Default: 2m.
  145. google.protobuf.Duration cooldown_period = 2
  146. [(google.api.field_behavior) = OPTIONAL];
  147. }
  148. // Basic autoscaling configurations for YARN.
  149. message BasicYarnAutoscalingConfig {
  150. // Required. Timeout for YARN graceful decommissioning of Node Managers.
  151. // Specifies the duration to wait for jobs to complete before forcefully
  152. // removing workers (and potentially interrupting jobs). Only applicable to
  153. // downscaling operations.
  154. //
  155. // Bounds: [0s, 1d].
  156. google.protobuf.Duration graceful_decommission_timeout = 5
  157. [(google.api.field_behavior) = REQUIRED];
  158. // Required. Fraction of average YARN pending memory in the last cooldown
  159. // period for which to add workers. A scale-up factor of 1.0 will result in
  160. // scaling up so that there is no pending memory remaining after the update
  161. // (more aggressive scaling). A scale-up factor closer to 0 will result in a
  162. // smaller magnitude of scaling up (less aggressive scaling). See [How
  163. // autoscaling
  164. // works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
  165. // for more information.
  166. //
  167. // Bounds: [0.0, 1.0].
  168. double scale_up_factor = 1 [(google.api.field_behavior) = REQUIRED];
  169. // Required. Fraction of average YARN pending memory in the last cooldown
  170. // period for which to remove workers. A scale-down factor of 1 will result in
  171. // scaling down so that there is no available memory remaining after the
  172. // update (more aggressive scaling). A scale-down factor of 0 disables
  173. // removing workers, which can be beneficial for autoscaling a single job.
  174. // See [How autoscaling
  175. // works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
  176. // for more information.
  177. //
  178. // Bounds: [0.0, 1.0].
  179. double scale_down_factor = 2 [(google.api.field_behavior) = REQUIRED];
  180. // Optional. Minimum scale-up threshold as a fraction of total cluster size
  181. // before scaling occurs. For example, in a 20-worker cluster, a threshold of
  182. // 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
  183. // the cluster to scale. A threshold of 0 means the autoscaler will scale up
  184. // on any recommended change.
  185. //
  186. // Bounds: [0.0, 1.0]. Default: 0.0.
  187. double scale_up_min_worker_fraction = 3
  188. [(google.api.field_behavior) = OPTIONAL];
  189. // Optional. Minimum scale-down threshold as a fraction of total cluster size
  190. // before scaling occurs. For example, in a 20-worker cluster, a threshold of
  191. // 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
  192. // the cluster to scale. A threshold of 0 means the autoscaler will scale down
  193. // on any recommended change.
  194. //
  195. // Bounds: [0.0, 1.0]. Default: 0.0.
  196. double scale_down_min_worker_fraction = 4
  197. [(google.api.field_behavior) = OPTIONAL];
  198. }
  199. // Configuration for the size bounds of an instance group, including its
  200. // proportional size to other groups.
  201. message InstanceGroupAutoscalingPolicyConfig {
  202. // Optional. Minimum number of instances for this group.
  203. //
  204. // Primary workers - Bounds: [2, max_instances]. Default: 2.
  205. // Secondary workers - Bounds: [0, max_instances]. Default: 0.
  206. int32 min_instances = 1 [(google.api.field_behavior) = OPTIONAL];
  207. // Optional. Maximum number of instances for this group. Required for primary
  208. // workers. Note that by default, clusters will not use secondary workers.
  209. // Required for secondary workers if the minimum secondary instances is set.
  210. //
  211. // Primary workers - Bounds: [min_instances, ). Required.
  212. // Secondary workers - Bounds: [min_instances, ). Default: 0.
  213. int32 max_instances = 2 [(google.api.field_behavior) = OPTIONAL];
  214. // Optional. Weight for the instance group, which is used to determine the
  215. // fraction of total workers in the cluster from this instance group.
  216. // For example, if primary workers have weight 2, and secondary workers have
  217. // weight 1, the cluster will have approximately 2 primary workers for each
  218. // secondary worker.
  219. //
  220. // The cluster may not reach the specified balance if constrained
  221. // by min/max bounds or other autoscaling settings. For example, if
  222. // `max_instances` for secondary workers is 0, then only primary workers will
  223. // be added. The cluster can also be out of balance when created.
  224. //
  225. // If weight is not set on any instance group, the cluster will default to
  226. // equal weight for all groups: the cluster will attempt to maintain an equal
  227. // number of workers in each group within the configured size bounds for each
  228. // group. If weight is set for one group only, the cluster will default to
  229. // zero weight on the unset group. For example if weight is set only on
  230. // primary workers, the cluster will use primary workers only and no
  231. // secondary workers.
  232. int32 weight = 3 [(google.api.field_behavior) = OPTIONAL];
  233. }
  234. // A request to create an autoscaling policy.
  235. message CreateAutoscalingPolicyRequest {
  236. // Required. The "resource name" of the region or location, as described
  237. // in https://cloud.google.com/apis/design/resource_names.
  238. //
  239. // * For `projects.regions.autoscalingPolicies.create`, the resource name
  240. // has the following format:
  241. // `projects/{project_id}/regions/{region}`
  242. //
  243. // * For `projects.locations.autoscalingPolicies.create`, the resource name
  244. // has the following format:
  245. // `projects/{project_id}/locations/{location}`
  246. string parent = 1 [
  247. (google.api.field_behavior) = REQUIRED,
  248. (google.api.resource_reference) = {
  249. child_type: "dataproc.googleapis.com/AutoscalingPolicy"
  250. }
  251. ];
  252. // Required. The autoscaling policy to create.
  253. AutoscalingPolicy policy = 2 [(google.api.field_behavior) = REQUIRED];
  254. }
  255. // A request to fetch an autoscaling policy.
  256. message GetAutoscalingPolicyRequest {
  257. // Required. The "resource name" of the autoscaling policy, as described
  258. // in https://cloud.google.com/apis/design/resource_names.
  259. //
  260. // * For `projects.regions.autoscalingPolicies.get`, the resource name
  261. // of the policy has the following format:
  262. // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
  263. //
  264. // * For `projects.locations.autoscalingPolicies.get`, the resource name
  265. // of the policy has the following format:
  266. // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
  267. string name = 1 [
  268. (google.api.field_behavior) = REQUIRED,
  269. (google.api.resource_reference) = {
  270. type: "dataproc.googleapis.com/AutoscalingPolicy"
  271. }
  272. ];
  273. }
  274. // A request to update an autoscaling policy.
  275. message UpdateAutoscalingPolicyRequest {
  276. // Required. The updated autoscaling policy.
  277. AutoscalingPolicy policy = 1 [(google.api.field_behavior) = REQUIRED];
  278. }
  279. // A request to delete an autoscaling policy.
  280. //
  281. // Autoscaling policies in use by one or more clusters will not be deleted.
  282. message DeleteAutoscalingPolicyRequest {
  283. // Required. The "resource name" of the autoscaling policy, as described
  284. // in https://cloud.google.com/apis/design/resource_names.
  285. //
  286. // * For `projects.regions.autoscalingPolicies.delete`, the resource name
  287. // of the policy has the following format:
  288. // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
  289. //
  290. // * For `projects.locations.autoscalingPolicies.delete`, the resource name
  291. // of the policy has the following format:
  292. // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
  293. string name = 1 [
  294. (google.api.field_behavior) = REQUIRED,
  295. (google.api.resource_reference) = {
  296. type: "dataproc.googleapis.com/AutoscalingPolicy"
  297. }
  298. ];
  299. }
  300. // A request to list autoscaling policies in a project.
  301. message ListAutoscalingPoliciesRequest {
  302. // Required. The "resource name" of the region or location, as described
  303. // in https://cloud.google.com/apis/design/resource_names.
  304. //
  305. // * For `projects.regions.autoscalingPolicies.list`, the resource name
  306. // of the region has the following format:
  307. // `projects/{project_id}/regions/{region}`
  308. //
  309. // * For `projects.locations.autoscalingPolicies.list`, the resource name
  310. // of the location has the following format:
  311. // `projects/{project_id}/locations/{location}`
  312. string parent = 1 [
  313. (google.api.field_behavior) = REQUIRED,
  314. (google.api.resource_reference) = {
  315. child_type: "dataproc.googleapis.com/AutoscalingPolicy"
  316. }
  317. ];
  318. // Optional. The maximum number of results to return in each response.
  319. // Must be less than or equal to 1000. Defaults to 100.
  320. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  321. // Optional. The page token, returned by a previous call, to request the
  322. // next page of results.
  323. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  324. }
  325. // A response to a request to list autoscaling policies in a project.
  326. message ListAutoscalingPoliciesResponse {
  327. // Output only. Autoscaling policies list.
  328. repeated AutoscalingPolicy policies = 1
  329. [(google.api.field_behavior) = OUTPUT_ONLY];
  330. // Output only. This token is included in the response if there are more
  331. // results to fetch.
  332. string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  333. }