Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
docs: Add documentation for enums (#88)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Jan 20, 2023
1 parent 9fc022d commit 695d075
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 17 deletions.
2 changes: 1 addition & 1 deletion google/cloud/batch_v1/services/batch_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ def sample_list_tasks():
# Done; return the response.
return response

def __enter__(self):
def __enter__(self) -> "BatchServiceClient":
return self

def __exit__(self, type, value, traceback):
Expand Down
68 changes: 64 additions & 4 deletions google/cloud/batch_v1/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,16 @@ class LogsPolicy(proto.Message):
"""

class Destination(proto.Enum):
r"""The destination (if any) for logs."""
r"""The destination (if any) for logs.
Values:
DESTINATION_UNSPECIFIED (0):
Logs are not preserved.
CLOUD_LOGGING (1):
Logs are streamed to Cloud Logging.
PATH (2):
Logs are saved to a file path.
"""
DESTINATION_UNSPECIFIED = 0
CLOUD_LOGGING = 1
PATH = 2
Expand Down Expand Up @@ -181,7 +190,32 @@ class JobStatus(proto.Message):
"""

class State(proto.Enum):
r"""Valid Job states."""
r"""Valid Job states.
Values:
STATE_UNSPECIFIED (0):
QUEUED (1):
Job is admitted (validated and persisted) and
waiting for resources.
SCHEDULED (2):
Job is scheduled to run as soon as resource
allocation is ready. The resource allocation may
happen at a later time but with a high chance to
succeed.
RUNNING (3):
Resource allocation has been successful. At
least one Task in the Job is RUNNING.
SUCCEEDED (4):
All Tasks in the Job have finished
successfully.
FAILED (5):
At least one Task in the Job has failed.
DELETION_IN_PROGRESS (6):
The Job will be deleted, but has not been
deleted yet. Typically this is because resources
used by the Job are still being cleaned up.
"""
STATE_UNSPECIFIED = 0
QUEUED = 1
SCHEDULED = 2
Expand Down Expand Up @@ -280,7 +314,16 @@ class JobNotification(proto.Message):
"""

class Type(proto.Enum):
r"""The message type."""
r"""The message type.
Values:
TYPE_UNSPECIFIED (0):
Unspecified.
JOB_STATE_CHANGED (1):
Notify users that the job state has changed.
TASK_STATE_CHANGED (2):
Notify users that the task state has changed.
"""
TYPE_UNSPECIFIED = 0
JOB_STATE_CHANGED = 1
TASK_STATE_CHANGED = 2
Expand Down Expand Up @@ -353,7 +396,24 @@ class AllocationPolicy(proto.Message):
"""

class ProvisioningModel(proto.Enum):
r"""Compute Engine VM instance provisioning model."""
r"""Compute Engine VM instance provisioning model.
Values:
PROVISIONING_MODEL_UNSPECIFIED (0):
Unspecified.
STANDARD (1):
Standard VM.
SPOT (2):
SPOT VM.
PREEMPTIBLE (3):
Preemptible VM (PVM).
Above SPOT VM is the preferable model for
preemptible VM instances: the old preemptible VM
model (indicated by this field) is the older
model, and has been migrated to use the SPOT
model as the underlying technology. This old
model will still be supported.
"""
PROVISIONING_MODEL_UNSPECIFIED = 0
STANDARD = 1
SPOT = 2
Expand Down
31 changes: 29 additions & 2 deletions google/cloud/batch_v1/types/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,23 @@ class TaskStatus(proto.Message):
"""

class State(proto.Enum):
r"""Task states."""
r"""Task states.
Values:
STATE_UNSPECIFIED (0):
unknown state
PENDING (1):
The Task is created and waiting for
resources.
ASSIGNED (2):
The Task is assigned to at least one VM.
RUNNING (3):
The Task is running.
FAILED (4):
The Task has failed.
SUCCEEDED (5):
The Task has succeeded.
"""
STATE_UNSPECIFIED = 0
PENDING = 1
ASSIGNED = 2
Expand Down Expand Up @@ -462,7 +478,18 @@ class LifecyclePolicy(proto.Message):
"""

class Action(proto.Enum):
r"""Action on task failures based on different conditions."""
r"""Action on task failures based on different conditions.
Values:
ACTION_UNSPECIFIED (0):
Action unspecified.
RETRY_TASK (1):
Action that tasks in the group will be
scheduled to re-execute.
FAIL_TASK (2):
Action that tasks in the group will be
stopped immediately.
"""
ACTION_UNSPECIFIED = 0
RETRY_TASK = 1
FAIL_TASK = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ def sample_list_tasks():
# Done; return the response.
return response

def __enter__(self):
def __enter__(self) -> "BatchServiceClient":
return self

def __exit__(self, type, value, traceback):
Expand Down
93 changes: 88 additions & 5 deletions google/cloud/batch_v1alpha/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ class SchedulingPolicy(proto.Enum):
r"""The order that TaskGroups are scheduled relative to each
other.
Not yet implemented.
Values:
SCHEDULING_POLICY_UNSPECIFIED (0):
Unspecified.
AS_SOON_AS_POSSIBLE (1):
Run all TaskGroups as soon as possible.
"""
SCHEDULING_POLICY_UNSPECIFIED = 0
AS_SOON_AS_POSSIBLE = 1
Expand Down Expand Up @@ -181,7 +187,16 @@ class LogsPolicy(proto.Message):
"""

class Destination(proto.Enum):
r"""The destination (if any) for logs."""
r"""The destination (if any) for logs.
Values:
DESTINATION_UNSPECIFIED (0):
Logs are not preserved.
CLOUD_LOGGING (1):
Logs are streamed to Cloud Logging.
PATH (2):
Logs are saved to a file path.
"""
DESTINATION_UNSPECIFIED = 0
CLOUD_LOGGING = 1
PATH = 2
Expand Down Expand Up @@ -214,7 +229,18 @@ class JobDependency(proto.Message):
"""

class Type(proto.Enum):
r"""Dependency type."""
r"""Dependency type.
Values:
TYPE_UNSPECIFIED (0):
Unspecified.
SUCCEEDED (1):
The dependent Job has succeeded.
FAILED (2):
The dependent Job has failed.
FINISHED (3):
SUCCEEDED or FAILED.
"""
TYPE_UNSPECIFIED = 0
SUCCEEDED = 1
FAILED = 2
Expand Down Expand Up @@ -245,7 +271,32 @@ class JobStatus(proto.Message):
"""

class State(proto.Enum):
r"""Valid Job states."""
r"""Valid Job states.
Values:
STATE_UNSPECIFIED (0):
QUEUED (1):
Job is admitted (validated and persisted) and
waiting for resources.
SCHEDULED (2):
Job is scheduled to run as soon as resource
allocation is ready. The resource allocation may
happen at a later time but with a high chance to
succeed.
RUNNING (3):
Resource allocation has been successful. At
least one Task in the Job is RUNNING.
SUCCEEDED (4):
All Tasks in the Job have finished
successfully.
FAILED (5):
At least one Task in the Job has failed.
DELETION_IN_PROGRESS (6):
The Job will be deleted, but has not been
deleted yet. Typically this is because resources
used by the Job are still being cleaned up.
"""
STATE_UNSPECIFIED = 0
QUEUED = 1
SCHEDULED = 2
Expand Down Expand Up @@ -344,7 +395,16 @@ class JobNotification(proto.Message):
"""

class Type(proto.Enum):
r"""The message type."""
r"""The message type.
Values:
TYPE_UNSPECIFIED (0):
Unspecified.
JOB_STATE_CHANGED (1):
Notify users that the job state has changed.
TASK_STATE_CHANGED (2):
Notify users that the task state has changed.
"""
TYPE_UNSPECIFIED = 0
JOB_STATE_CHANGED = 1
TASK_STATE_CHANGED = 2
Expand Down Expand Up @@ -426,7 +486,24 @@ class AllocationPolicy(proto.Message):
"""

class ProvisioningModel(proto.Enum):
r"""Compute Engine VM instance provisioning model."""
r"""Compute Engine VM instance provisioning model.
Values:
PROVISIONING_MODEL_UNSPECIFIED (0):
Unspecified.
STANDARD (1):
Standard VM.
SPOT (2):
SPOT VM.
PREEMPTIBLE (3):
Preemptible VM (PVM).
Above SPOT VM is the preferable model for
preemptible VM instances: the old preemptible VM
model (indicated by this field) is the older
model, and has been migrated to use the SPOT
model as the underlying technology. This old
model will still be supported.
"""
PROVISIONING_MODEL_UNSPECIFIED = 0
STANDARD = 1
SPOT = 2
Expand Down Expand Up @@ -881,6 +958,12 @@ class TaskGroup(proto.Message):
class SchedulingPolicy(proto.Enum):
r"""How Tasks in the TaskGroup should be scheduled relative to
each other.
Values:
SCHEDULING_POLICY_UNSPECIFIED (0):
Unspecified.
AS_SOON_AS_POSSIBLE (1):
Run Tasks as soon as resources are available.
"""
SCHEDULING_POLICY_UNSPECIFIED = 0
AS_SOON_AS_POSSIBLE = 1
Expand Down
31 changes: 29 additions & 2 deletions google/cloud/batch_v1alpha/types/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,23 @@ class TaskStatus(proto.Message):
"""

class State(proto.Enum):
r"""Task states."""
r"""Task states.
Values:
STATE_UNSPECIFIED (0):
unknown state
PENDING (1):
The Task is created and waiting for
resources.
ASSIGNED (2):
The Task is assigned to at least one VM.
RUNNING (3):
The Task is running.
FAILED (4):
The Task has failed.
SUCCEEDED (5):
The Task has succeeded.
"""
STATE_UNSPECIFIED = 0
PENDING = 1
ASSIGNED = 2
Expand Down Expand Up @@ -476,7 +492,18 @@ class LifecyclePolicy(proto.Message):
"""

class Action(proto.Enum):
r"""Action on task failures based on different conditions."""
r"""Action on task failures based on different conditions.
Values:
ACTION_UNSPECIFIED (0):
Action unspecified.
RETRY_TASK (1):
Action that tasks in the group will be
scheduled to re-execute.
FAIL_TASK (2):
Action that tasks in the group will be
stopped immediately.
"""
ACTION_UNSPECIFIED = 0
RETRY_TASK = 1
FAIL_TASK = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-batch",
"version": "0.8.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-batch",
"version": "0.8.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down

0 comments on commit 695d075

Please sign in to comment.