airflow.providers.google.cloud.hooks.workflows
¶
Module Contents¶
Classes¶
Hook for Google GCP APIs. |
- class airflow.providers.google.cloud.hooks.workflows.WorkflowsHook(gcp_conn_id: str = 'google_cloud_default', delegate_to: Optional[str] = None, impersonation_chain: Optional[Union[str, Sequence[str]]] = None)[source]¶
Bases:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
Hook for Google GCP APIs.
All the methods in the hook where project_id is used must be called with keyword arguments rather than positional.
- get_workflows_client(self) google.cloud.workflows_v1beta.WorkflowsClient [source]¶
Returns WorkflowsClient.
- get_executions_client(self) google.cloud.workflows.executions_v1beta.ExecutionsClient [source]¶
Returns ExecutionsClient.
- create_workflow(self, workflow: Dict, workflow_id: str, location: str, project_id: str = PROVIDE_PROJECT_ID, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation [source]¶
Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
- Parameters
workflow (Dict) -- Required. Workflow to be created.
workflow_id (str) -- Required. The ID of the workflow to be created.
project_id (str) -- Required. The ID of the Google Cloud project the cluster belongs to.
location (str) -- Required. The GCP region in which to handle the request.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.
- get_workflow(self, workflow_id: str, location: str, project_id: str = PROVIDE_PROJECT_ID, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.workflows_v1beta.Workflow [source]¶
Gets details of a single Workflow.
- Parameters
workflow_id (str) -- Required. The ID of the workflow to be created.
project_id (str) -- Required. The ID of the Google Cloud project the cluster belongs to.
location (str) -- Required. The GCP region in which to handle the request.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.
- update_workflow(self, workflow: Union[Dict, google.cloud.workflows_v1beta.Workflow], update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation [source]¶
Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow may be created as a result of a successful update operation. In that case, such revision will be used in new workflow executions.
- Parameters
workflow (Dict) -- Required. Workflow to be created.
update_mask (FieldMask) -- List of fields to be updated. If not present, the entire workflow will be updated.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.
- delete_workflow(self, workflow_id: str, location: str, project_id: str = PROVIDE_PROJECT_ID, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation [source]¶
Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.
- Parameters
workflow_id (str) -- Required. The ID of the workflow to be created.
project_id (str) -- Required. The ID of the Google Cloud project the cluster belongs to.
location (str) -- Required. The GCP region in which to handle the request.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.
- list_workflows(self, location: str, project_id: str = PROVIDE_PROJECT_ID, filter_: Optional[str] = None, order_by: Optional[str] = None, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.workflows_v1beta.services.workflows.pagers.ListWorkflowsPager [source]¶
Lists Workflows in a given project and location. The default order is not specified.
- Parameters
filter (str) -- Filter to restrict results to specific workflows.
order_by (str) -- Comma-separated list of fields that specifies the order of the results. Default sorting order for a field is ascending. To specify descending order for a field, append a "desc" suffix. If not specified, the results will be returned in an unspecified order.
project_id (str) -- Required. The ID of the Google Cloud project the cluster belongs to.
location (str) -- Required. The GCP region in which to handle the request.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.
- create_execution(self, workflow_id: str, location: str, execution: Dict, project_id: str = PROVIDE_PROJECT_ID, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.workflows.executions_v1beta.Execution [source]¶
Creates a new execution using the latest revision of the given workflow.
- Parameters
execution (Dict) -- Required. Input parameters of the execution represented as a dictionary.
workflow_id (str) -- Required. The ID of the workflow.
project_id (str) -- Required. The ID of the Google Cloud project the cluster belongs to.
location (str) -- Required. The GCP region in which to handle the request.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.
- get_execution(self, workflow_id: str, execution_id: str, location: str, project_id: str = PROVIDE_PROJECT_ID, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.workflows.executions_v1beta.Execution [source]¶
Returns an execution for the given
workflow_id
andexecution_id
.- Parameters
workflow_id (str) -- Required. The ID of the workflow.
execution_id (str) -- Required. The ID of the execution.
project_id (str) -- Required. The ID of the Google Cloud project the cluster belongs to.
location (str) -- Required. The GCP region in which to handle the request.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.
- cancel_execution(self, workflow_id: str, execution_id: str, location: str, project_id: str = PROVIDE_PROJECT_ID, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.workflows.executions_v1beta.Execution [source]¶
Cancels an execution using the given
workflow_id
andexecution_id
.- Parameters
workflow_id (str) -- Required. The ID of the workflow.
execution_id (str) -- Required. The ID of the execution.
project_id (str) -- Required. The ID of the Google Cloud project the cluster belongs to.
location (str) -- Required. The GCP region in which to handle the request.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.
- list_executions(self, workflow_id: str, location: str, project_id: str = PROVIDE_PROJECT_ID, retry: Optional[google.api_core.retry.Retry] = None, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsPager [source]¶
Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).
- Parameters
workflow_id (str) -- Required. The ID of the workflow to be created.
project_id (str) -- Required. The ID of the Google Cloud project the cluster belongs to.
location (str) -- Required. The GCP region in which to handle the request.
retry (google.api_core.retry.Retry) -- A retry object used to retry requests. If
None
is specified, requests will not be retried.timeout (float) -- The amount of time, in seconds, to wait for the request to complete. Note that if
retry
is specified, the timeout applies to each individual attempt.metadata (Sequence[Tuple[str, str]]) -- Additional metadata that is provided to the method.