Skip to content

Commit

Permalink
Add more docstrings to workflows.proto
Browse files Browse the repository at this point in the history
GitOrigin-RevId: fdc1ec4f7a055caa8ea007263f238b12f5f58b20
  • Loading branch information
maxdubrinsky committed Jul 8, 2024
1 parent 3d9098b commit cb9168f
Show file tree
Hide file tree
Showing 11 changed files with 480 additions and 162 deletions.
386 changes: 288 additions & 98 deletions src/gretel_client/rest_v1/api/workflows_api.py

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions src/gretel_client/rest_v1/models/create_workflow_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,24 @@ class CreateWorkflowRequest(BaseModel):
CreateWorkflowRequest
"""

name: Optional[StrictStr] = None
project_id: StrictStr = Field(...)
config: Optional[Dict[str, Any]] = None
config_text: Optional[StrictStr] = None
runner_mode: Optional[StrictStr] = None
name: Optional[StrictStr] = Field(
None,
description="The name of the workflow. This field has been deprecated in favor of the `config.name` field.",
)
project_id: StrictStr = Field(
..., description="The project ID that this workflow should belong to."
)
config: Optional[Dict[str, Any]] = Field(
None,
description="The workflow config object. See production documentation for more information on the structure of this field.",
)
config_text: Optional[StrictStr] = Field(
None, description="The workflow config as a YAML string."
)
runner_mode: Optional[StrictStr] = Field(
None,
description="The runner mode of the workflow. Can be `cloud` or `hybrid`. Some projects may require workflows to run in a specific mode.",
)
__properties = ["name", "project_id", "config", "config_text", "runner_mode"]

@validator("runner_mode")
Expand Down
14 changes: 11 additions & 3 deletions src/gretel_client/rest_v1/models/create_workflow_run_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ class CreateWorkflowRunRequest(BaseModel):
CreateWorkflowRunRequest
"""

workflow_id: StrictStr = Field(...)
config: Optional[Dict[str, Any]] = None
config_text: Optional[StrictStr] = None
workflow_id: StrictStr = Field(
..., description="The ID of the workflow to create a run for."
)
config: Optional[Dict[str, Any]] = Field(
None,
description="An optional config for the workflow run If provided, this will be used in place of the workflow's config.",
)
config_text: Optional[StrictStr] = Field(
None,
description="An optional config for the workflow run as a YAML string. If provided, this will be used in place of the workflow's config.",
)
__properties = ["workflow_id", "config", "config_text"]

class Config:
Expand Down
6 changes: 4 additions & 2 deletions src/gretel_client/rest_v1/models/get_workflows_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from typing import List, Optional

from pydantic import BaseModel, conlist
from pydantic import BaseModel, conlist, Field

from gretel_client.rest_v1.models.workflow import Workflow

Expand All @@ -30,7 +30,9 @@ class GetWorkflowsResponse(BaseModel):
GetWorkflowsResponse
"""

workflows: Optional[conlist(Workflow)] = None
workflows: Optional[conlist(Workflow)] = Field(
None, description="The list of workflows."
)
__properties = ["workflows"]

class Config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ class SearchWorkflowRunsResponse(BaseModel):
SearchWorkflowRunsResponse
"""

runs: Optional[conlist(WorkflowRun)] = None
total: StrictInt = Field(...)
runs: Optional[conlist(WorkflowRun)] = Field(
None,
description="The list of workflow runs that matched the search query in the requested page.",
)
total: StrictInt = Field(
...,
description="The total number of workflow runs that matched the search query.",
)
__properties = ["runs", "total"]

class Config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ class SearchWorkflowTasksResponse(BaseModel):
SearchWorkflowTasksResponse
"""

tasks: Optional[conlist(WorkflowTask)] = None
total: StrictInt = Field(...)
tasks: Optional[conlist(WorkflowTask)] = Field(
None,
description="The list of workflow tasks that matched the search query in the requested page.",
)
total: StrictInt = Field(
...,
description="The total number of workflow tasks that matched the search query.",
)
__properties = ["tasks", "total"]

class Config:
Expand Down
9 changes: 7 additions & 2 deletions src/gretel_client/rest_v1/models/search_workflows_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ class SearchWorkflowsResponse(BaseModel):
SearchWorkflowsResponse
"""

workflows: Optional[conlist(Workflow)] = None
total: StrictInt = Field(...)
workflows: Optional[conlist(Workflow)] = Field(
None,
description="The list of workflows that matched the search query in the requested page.",
)
total: StrictInt = Field(
..., description="The total number of workflows that matched the search query."
)
__properties = ["workflows", "total"]

class Config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@

from typing import Optional

from pydantic import BaseModel, StrictStr, validator
from pydantic import BaseModel, Field, StrictStr, validator


class ValidateWorkflowActionResponse(BaseModel):
"""
ValidateWorkflowActionResponse
"""

status: Optional[StrictStr] = None
message: Optional[StrictStr] = None
status: Optional[StrictStr] = Field(
None, description="The validation status of the action."
)
message: Optional[StrictStr] = Field(
None, description="The error message if the action is invalid."
)
__properties = ["status", "message"]

@validator("status")
Expand Down
44 changes: 31 additions & 13 deletions src/gretel_client/rest_v1/models/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,38 @@ class Workflow(BaseModel):
Workflow
"""

id: StrictStr = Field(...)
name: StrictStr = Field(...)
project_id: StrictStr = Field(...)
id: StrictStr = Field(..., description="The unique ID of the workflow.")
name: StrictStr = Field(..., description="The name of the workflow.")
project_id: StrictStr = Field(
..., description="The project ID that this workflow belongs to."
)
project: Optional[Project] = None
config: Optional[Dict[str, Any]] = None
config_text: Optional[StrictStr] = None
runner_mode: Optional[StrictStr] = None
next_scheduled_run: Optional[datetime] = None
created_by: StrictStr = Field(...)
config: Optional[Dict[str, Any]] = Field(
None, description="The config of the workflow."
)
config_text: Optional[StrictStr] = Field(
None, description="The config of the workflow as a YAML string."
)
runner_mode: Optional[StrictStr] = Field(
None, description="The runner mode of the workflow. Can be `cloud` or `hybrid`."
)
created_by: StrictStr = Field(
..., description="The user ID that created this workflow."
)
created_by_profile: Optional[UserProfile] = None
updated_by: Optional[StrictStr] = None
updated_by: Optional[StrictStr] = Field(
None, description="The user ID that last updated this workflow."
)
updated_by_profile: Optional[UserProfile] = None
created_at: datetime = Field(...)
updated_at: Optional[datetime] = None
created_at: datetime = Field(
..., description="A timestamp indicating when this workflow was created."
)
updated_at: Optional[datetime] = Field(
None, description="A timestamp indicating when this workflow was last updated."
)
next_scheduled_run: Optional[datetime] = Field(
None, description="A timestamp indicating when the next scheduled run is."
)
latest_run: Optional[WorkflowRun] = None
__properties = [
"id",
Expand All @@ -56,13 +74,13 @@ class Workflow(BaseModel):
"config",
"config_text",
"runner_mode",
"next_scheduled_run",
"created_by",
"created_by_profile",
"updated_by",
"updated_by_profile",
"created_at",
"updated_at",
"next_scheduled_run",
"latest_run",
]

Expand Down Expand Up @@ -141,7 +159,6 @@ def from_dict(cls, obj: dict) -> Workflow:
"config": obj.get("config"),
"config_text": obj.get("config_text"),
"runner_mode": obj.get("runner_mode"),
"next_scheduled_run": obj.get("next_scheduled_run"),
"created_by": obj.get("created_by"),
"created_by_profile": (
UserProfile.from_dict(obj.get("created_by_profile"))
Expand All @@ -156,6 +173,7 @@ def from_dict(cls, obj: dict) -> Workflow:
),
"created_at": obj.get("created_at"),
"updated_at": obj.get("updated_at"),
"next_scheduled_run": obj.get("next_scheduled_run"),
"latest_run": (
WorkflowRun.from_dict(obj.get("latest_run"))
if obj.get("latest_run") is not None
Expand Down
75 changes: 57 additions & 18 deletions src/gretel_client/rest_v1/models/workflow_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,67 @@ class WorkflowRun(BaseModel):
WorkflowRun
"""

id: StrictStr = Field(...)
workflow_id: StrictStr = Field(...)
project_id: StrictStr = Field(...)
id: StrictStr = Field(..., description="The unique ID of the workflow run.")
workflow_id: StrictStr = Field(
..., description="The ID of the workflow that this run belongs to."
)
project_id: StrictStr = Field(
...,
description="The project ID that this workflow run belongs to. This will be the same as the project ID of the workflow.",
)
project: Optional[Project] = None
cluster_guid: Optional[StrictStr] = None
config: Optional[Dict[str, Any]] = None
config_text: Optional[StrictStr] = None
runner_mode: StrictStr = Field(...)
status: StrictStr = Field(...)
cluster_guid: Optional[StrictStr] = Field(
None, description="The GUID of the cluster where the workflow run is executed."
)
config: Optional[Dict[str, Any]] = Field(
None, description="The config of the workflow run."
)
config_text: Optional[StrictStr] = Field(
None, description="The config of the workflow run as a YAML string."
)
runner_mode: StrictStr = Field(
...,
description="The runner mode of the workflow run. Can be `cloud` or `hybrid`.",
)
status: StrictStr = Field(..., description="The status of the workflow run.")
status_details: Optional[StatusDetails] = None
created_by: StrictStr = Field(...)
created_at: datetime = Field(...)
updated_at: Optional[datetime] = None
pending_at: Optional[datetime] = None
active_at: Optional[datetime] = None
error_at: Optional[datetime] = None
lost_at: Optional[datetime] = None
cancelled_at: Optional[datetime] = None
lease_expires_at: Optional[datetime] = None
created_by: StrictStr = Field(
..., description="The user ID that created this workflow run."
)
created_at: datetime = Field(
..., description="A timestamp indicating when this workflow run was created."
)
updated_at: Optional[datetime] = Field(
None,
description="A timestamp indicating when this workflow run was last updated.",
)
pending_at: Optional[datetime] = Field(
None,
description="A timestamp indicating when this workflow run entered the pending state.",
)
active_at: Optional[datetime] = Field(
None,
description="A timestamp indicating when this workflow run entered the active state.",
)
error_at: Optional[datetime] = Field(
None,
description="A timestamp indicating when an error occurred in this workflow run.",
)
lost_at: Optional[datetime] = Field(
None, description="A timestamp indicating when this workflow run was lost."
)
cancelled_at: Optional[datetime] = Field(
None, description="A timestamp indicating when this workflow run was cancelled."
)
lease_expires_at: Optional[datetime] = Field(
None,
description="A timestamp indicating when the lease for this workflow run expires.",
)
cancellation_request: Optional[WorkflowRunCancellationRequest] = None
created_by_profile: Optional[UserProfile] = None
total_compute_time_sconds: Optional[StrictInt] = None
total_compute_time_sconds: Optional[StrictInt] = Field(
None, description="The total compute time in seconds for this workflow run."
)
__properties = [
"id",
"workflow_id",
Expand Down
55 changes: 41 additions & 14 deletions src/gretel_client/rest_v1/models/workflow_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ class WorkflowTask(BaseModel):
Next Tag: 24
"""

id: StrictStr = Field(...)
workflow_run_id: StrictStr = Field(...)
project_id: StrictStr = Field(...)
id: StrictStr = Field(..., description="The unique ID of the workflow task.")
workflow_run_id: StrictStr = Field(
..., description="The ID of the workflow run that this task belongs to."
)
project_id: StrictStr = Field(
..., description="The project ID that this workflow task belongs to."
)
project: Optional[Project] = None
log_location: StrictStr = Field(...)
status: StrictStr = Field(...)
log_location: StrictStr = Field(
..., description="The location of the log for this workflow task."
)
status: StrictStr = Field(..., description="The status of the workflow task.")
action_name: StrictStr = Field(
...,
description="The user supplied name of the workflow action that produced this task. The name can be mapped back to the original workflow config.",
Expand All @@ -58,16 +64,37 @@ class WorkflowTask(BaseModel):
None,
description="A more detailed stack trace that can be used for root cause analysis. This stack trace generally shouldn't be shown in the UI and will span many lines.",
)
created_by: StrictStr = Field(...)
created_by: StrictStr = Field(
..., description="The user ID that created this workflow."
)
created_by_profile: Optional[UserProfile] = None
created_at: datetime = Field(...)
updated_at: Optional[datetime] = None
pending_at: Optional[datetime] = None
active_at: Optional[datetime] = None
error_at: Optional[datetime] = None
lost_at: Optional[datetime] = None
completed_at: Optional[datetime] = None
total_compute_time_sconds: Optional[StrictInt] = None
created_at: datetime = Field(
..., description="A timestamp indicating when this workflow was created."
)
updated_at: Optional[datetime] = Field(
None, description="A timestamp indicating when this workflow was last updated."
)
pending_at: Optional[datetime] = Field(
None,
description="A timestamp indicating when this workflow entered the pending state.",
)
active_at: Optional[datetime] = Field(
None,
description="A timestamp indicating when this workflow entered the active state.",
)
error_at: Optional[datetime] = Field(
None,
description="A timestamp indicating when an error occurred in this workflow.",
)
lost_at: Optional[datetime] = Field(
None, description="A timestamp indicating when this workflow was lost."
)
completed_at: Optional[datetime] = Field(
None, description="A timestamp indicating when this workflow was completed."
)
total_compute_time_sconds: Optional[StrictInt] = Field(
None, description="The total compute time in seconds for this workflow."
)
__properties = [
"id",
"workflow_run_id",
Expand Down

0 comments on commit cb9168f

Please sign in to comment.