autoscaling_policies.proto 15 KB

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