Skip to content

Commit c24e2a3

Browse files
docs: Add documentation for enums (#88)
* docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: googleapis/googleapis@a391fd1 Source-Link: googleapis/googleapis-gen@0080f83 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 4e853ae commit c24e2a3

File tree

8 files changed

+214
-17
lines changed

8 files changed

+214
-17
lines changed

packages/google-cloud-batch/google/cloud/batch_v1/services/batch_service/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ def sample_list_tasks():
11701170
# Done; return the response.
11711171
return response
11721172

1173-
def __enter__(self):
1173+
def __enter__(self) -> "BatchServiceClient":
11741174
return self
11751175

11761176
def __exit__(self, type, value, traceback):

packages/google-cloud-batch/google/cloud/batch_v1/types/job.py

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,16 @@ class LogsPolicy(proto.Message):
148148
"""
149149

150150
class Destination(proto.Enum):
151-
r"""The destination (if any) for logs."""
151+
r"""The destination (if any) for logs.
152+
153+
Values:
154+
DESTINATION_UNSPECIFIED (0):
155+
Logs are not preserved.
156+
CLOUD_LOGGING (1):
157+
Logs are streamed to Cloud Logging.
158+
PATH (2):
159+
Logs are saved to a file path.
160+
"""
152161
DESTINATION_UNSPECIFIED = 0
153162
CLOUD_LOGGING = 1
154163
PATH = 2
@@ -181,7 +190,32 @@ class JobStatus(proto.Message):
181190
"""
182191

183192
class State(proto.Enum):
184-
r"""Valid Job states."""
193+
r"""Valid Job states.
194+
195+
Values:
196+
STATE_UNSPECIFIED (0):
197+
198+
QUEUED (1):
199+
Job is admitted (validated and persisted) and
200+
waiting for resources.
201+
SCHEDULED (2):
202+
Job is scheduled to run as soon as resource
203+
allocation is ready. The resource allocation may
204+
happen at a later time but with a high chance to
205+
succeed.
206+
RUNNING (3):
207+
Resource allocation has been successful. At
208+
least one Task in the Job is RUNNING.
209+
SUCCEEDED (4):
210+
All Tasks in the Job have finished
211+
successfully.
212+
FAILED (5):
213+
At least one Task in the Job has failed.
214+
DELETION_IN_PROGRESS (6):
215+
The Job will be deleted, but has not been
216+
deleted yet. Typically this is because resources
217+
used by the Job are still being cleaned up.
218+
"""
185219
STATE_UNSPECIFIED = 0
186220
QUEUED = 1
187221
SCHEDULED = 2
@@ -280,7 +314,16 @@ class JobNotification(proto.Message):
280314
"""
281315

282316
class Type(proto.Enum):
283-
r"""The message type."""
317+
r"""The message type.
318+
319+
Values:
320+
TYPE_UNSPECIFIED (0):
321+
Unspecified.
322+
JOB_STATE_CHANGED (1):
323+
Notify users that the job state has changed.
324+
TASK_STATE_CHANGED (2):
325+
Notify users that the task state has changed.
326+
"""
284327
TYPE_UNSPECIFIED = 0
285328
JOB_STATE_CHANGED = 1
286329
TASK_STATE_CHANGED = 2
@@ -353,7 +396,24 @@ class AllocationPolicy(proto.Message):
353396
"""
354397

355398
class ProvisioningModel(proto.Enum):
356-
r"""Compute Engine VM instance provisioning model."""
399+
r"""Compute Engine VM instance provisioning model.
400+
401+
Values:
402+
PROVISIONING_MODEL_UNSPECIFIED (0):
403+
Unspecified.
404+
STANDARD (1):
405+
Standard VM.
406+
SPOT (2):
407+
SPOT VM.
408+
PREEMPTIBLE (3):
409+
Preemptible VM (PVM).
410+
Above SPOT VM is the preferable model for
411+
preemptible VM instances: the old preemptible VM
412+
model (indicated by this field) is the older
413+
model, and has been migrated to use the SPOT
414+
model as the underlying technology. This old
415+
model will still be supported.
416+
"""
357417
PROVISIONING_MODEL_UNSPECIFIED = 0
358418
STANDARD = 1
359419
SPOT = 2

packages/google-cloud-batch/google/cloud/batch_v1/types/task.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,23 @@ class TaskStatus(proto.Message):
125125
"""
126126

127127
class State(proto.Enum):
128-
r"""Task states."""
128+
r"""Task states.
129+
130+
Values:
131+
STATE_UNSPECIFIED (0):
132+
unknown state
133+
PENDING (1):
134+
The Task is created and waiting for
135+
resources.
136+
ASSIGNED (2):
137+
The Task is assigned to at least one VM.
138+
RUNNING (3):
139+
The Task is running.
140+
FAILED (4):
141+
The Task has failed.
142+
SUCCEEDED (5):
143+
The Task has succeeded.
144+
"""
129145
STATE_UNSPECIFIED = 0
130146
PENDING = 1
131147
ASSIGNED = 2
@@ -462,7 +478,18 @@ class LifecyclePolicy(proto.Message):
462478
"""
463479

464480
class Action(proto.Enum):
465-
r"""Action on task failures based on different conditions."""
481+
r"""Action on task failures based on different conditions.
482+
483+
Values:
484+
ACTION_UNSPECIFIED (0):
485+
Action unspecified.
486+
RETRY_TASK (1):
487+
Action that tasks in the group will be
488+
scheduled to re-execute.
489+
FAIL_TASK (2):
490+
Action that tasks in the group will be
491+
stopped immediately.
492+
"""
466493
ACTION_UNSPECIFIED = 0
467494
RETRY_TASK = 1
468495
FAIL_TASK = 2

packages/google-cloud-batch/google/cloud/batch_v1alpha/services/batch_service/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ def sample_list_tasks():
11701170
# Done; return the response.
11711171
return response
11721172

1173-
def __enter__(self):
1173+
def __enter__(self) -> "BatchServiceClient":
11741174
return self
11751175

11761176
def __exit__(self, type, value, traceback):

packages/google-cloud-batch/google/cloud/batch_v1alpha/types/job.py

Lines changed: 88 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ class SchedulingPolicy(proto.Enum):
9292
r"""The order that TaskGroups are scheduled relative to each
9393
other.
9494
Not yet implemented.
95+
96+
Values:
97+
SCHEDULING_POLICY_UNSPECIFIED (0):
98+
Unspecified.
99+
AS_SOON_AS_POSSIBLE (1):
100+
Run all TaskGroups as soon as possible.
95101
"""
96102
SCHEDULING_POLICY_UNSPECIFIED = 0
97103
AS_SOON_AS_POSSIBLE = 1
@@ -181,7 +187,16 @@ class LogsPolicy(proto.Message):
181187
"""
182188

183189
class Destination(proto.Enum):
184-
r"""The destination (if any) for logs."""
190+
r"""The destination (if any) for logs.
191+
192+
Values:
193+
DESTINATION_UNSPECIFIED (0):
194+
Logs are not preserved.
195+
CLOUD_LOGGING (1):
196+
Logs are streamed to Cloud Logging.
197+
PATH (2):
198+
Logs are saved to a file path.
199+
"""
185200
DESTINATION_UNSPECIFIED = 0
186201
CLOUD_LOGGING = 1
187202
PATH = 2
@@ -214,7 +229,18 @@ class JobDependency(proto.Message):
214229
"""
215230

216231
class Type(proto.Enum):
217-
r"""Dependency type."""
232+
r"""Dependency type.
233+
234+
Values:
235+
TYPE_UNSPECIFIED (0):
236+
Unspecified.
237+
SUCCEEDED (1):
238+
The dependent Job has succeeded.
239+
FAILED (2):
240+
The dependent Job has failed.
241+
FINISHED (3):
242+
SUCCEEDED or FAILED.
243+
"""
218244
TYPE_UNSPECIFIED = 0
219245
SUCCEEDED = 1
220246
FAILED = 2
@@ -245,7 +271,32 @@ class JobStatus(proto.Message):
245271
"""
246272

247273
class State(proto.Enum):
248-
r"""Valid Job states."""
274+
r"""Valid Job states.
275+
276+
Values:
277+
STATE_UNSPECIFIED (0):
278+
279+
QUEUED (1):
280+
Job is admitted (validated and persisted) and
281+
waiting for resources.
282+
SCHEDULED (2):
283+
Job is scheduled to run as soon as resource
284+
allocation is ready. The resource allocation may
285+
happen at a later time but with a high chance to
286+
succeed.
287+
RUNNING (3):
288+
Resource allocation has been successful. At
289+
least one Task in the Job is RUNNING.
290+
SUCCEEDED (4):
291+
All Tasks in the Job have finished
292+
successfully.
293+
FAILED (5):
294+
At least one Task in the Job has failed.
295+
DELETION_IN_PROGRESS (6):
296+
The Job will be deleted, but has not been
297+
deleted yet. Typically this is because resources
298+
used by the Job are still being cleaned up.
299+
"""
249300
STATE_UNSPECIFIED = 0
250301
QUEUED = 1
251302
SCHEDULED = 2
@@ -344,7 +395,16 @@ class JobNotification(proto.Message):
344395
"""
345396

346397
class Type(proto.Enum):
347-
r"""The message type."""
398+
r"""The message type.
399+
400+
Values:
401+
TYPE_UNSPECIFIED (0):
402+
Unspecified.
403+
JOB_STATE_CHANGED (1):
404+
Notify users that the job state has changed.
405+
TASK_STATE_CHANGED (2):
406+
Notify users that the task state has changed.
407+
"""
348408
TYPE_UNSPECIFIED = 0
349409
JOB_STATE_CHANGED = 1
350410
TASK_STATE_CHANGED = 2
@@ -426,7 +486,24 @@ class AllocationPolicy(proto.Message):
426486
"""
427487

428488
class ProvisioningModel(proto.Enum):
429-
r"""Compute Engine VM instance provisioning model."""
489+
r"""Compute Engine VM instance provisioning model.
490+
491+
Values:
492+
PROVISIONING_MODEL_UNSPECIFIED (0):
493+
Unspecified.
494+
STANDARD (1):
495+
Standard VM.
496+
SPOT (2):
497+
SPOT VM.
498+
PREEMPTIBLE (3):
499+
Preemptible VM (PVM).
500+
Above SPOT VM is the preferable model for
501+
preemptible VM instances: the old preemptible VM
502+
model (indicated by this field) is the older
503+
model, and has been migrated to use the SPOT
504+
model as the underlying technology. This old
505+
model will still be supported.
506+
"""
430507
PROVISIONING_MODEL_UNSPECIFIED = 0
431508
STANDARD = 1
432509
SPOT = 2
@@ -881,6 +958,12 @@ class TaskGroup(proto.Message):
881958
class SchedulingPolicy(proto.Enum):
882959
r"""How Tasks in the TaskGroup should be scheduled relative to
883960
each other.
961+
962+
Values:
963+
SCHEDULING_POLICY_UNSPECIFIED (0):
964+
Unspecified.
965+
AS_SOON_AS_POSSIBLE (1):
966+
Run Tasks as soon as resources are available.
884967
"""
885968
SCHEDULING_POLICY_UNSPECIFIED = 0
886969
AS_SOON_AS_POSSIBLE = 1

packages/google-cloud-batch/google/cloud/batch_v1alpha/types/task.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,23 @@ class TaskStatus(proto.Message):
132132
"""
133133

134134
class State(proto.Enum):
135-
r"""Task states."""
135+
r"""Task states.
136+
137+
Values:
138+
STATE_UNSPECIFIED (0):
139+
unknown state
140+
PENDING (1):
141+
The Task is created and waiting for
142+
resources.
143+
ASSIGNED (2):
144+
The Task is assigned to at least one VM.
145+
RUNNING (3):
146+
The Task is running.
147+
FAILED (4):
148+
The Task has failed.
149+
SUCCEEDED (5):
150+
The Task has succeeded.
151+
"""
136152
STATE_UNSPECIFIED = 0
137153
PENDING = 1
138154
ASSIGNED = 2
@@ -476,7 +492,18 @@ class LifecyclePolicy(proto.Message):
476492
"""
477493

478494
class Action(proto.Enum):
479-
r"""Action on task failures based on different conditions."""
495+
r"""Action on task failures based on different conditions.
496+
497+
Values:
498+
ACTION_UNSPECIFIED (0):
499+
Action unspecified.
500+
RETRY_TASK (1):
501+
Action that tasks in the group will be
502+
scheduled to re-execute.
503+
FAIL_TASK (2):
504+
Action that tasks in the group will be
505+
stopped immediately.
506+
"""
480507
ACTION_UNSPECIFIED = 0
481508
RETRY_TASK = 1
482509
FAIL_TASK = 2

packages/google-cloud-batch/samples/generated_samples/snippet_metadata_google.cloud.batch.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-batch",
11-
"version": "0.8.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-batch/samples/generated_samples/snippet_metadata_google.cloud.batch.v1alpha.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-batch",
11-
"version": "0.8.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)