VinceLegendre commented on code in PR #28525: URL: https://github.com/apache/airflow/pull/28525#discussion_r1112695587
########## airflow/providers/google/cloud/operators/cloud_run.py: ########## @@ -0,0 +1,115 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""This module contains Google Cloud Run Jobs operators.""" +from __future__ import annotations + +from typing import TYPE_CHECKING, Sequence + +from airflow.models import BaseOperator +from airflow.providers.google.cloud.hooks.cloud_run import CloudRunJobHook +from airflow.providers.google.cloud.links.cloud_run import CloudRunJobExecutionLink + +if TYPE_CHECKING: + from airflow.utils.context import Context + + +class CloudRunExecuteJobOperator(BaseOperator): + """ + Executes an existing Cloud Run job. + + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:CloudRunExecuteJobOperator` + + :param job_name: The name of the cloud run job to execute + :param region: The region of the Cloud Run job (for example europe-west1) + :param project_id: The ID of the GCP project that owns the job. + If set to ``None`` or missing, the default project_id + from the GCP connection is used. + :param gcp_conn_id: The connection ID to use to connect to Google Cloud. + :param delegate_to: The account to impersonate, if any. + For this to work, the service account making the request + must have domain-wide delegation enabled. + :param wait_until_finished: If True, wait for the end of job execution + before exiting. If False (default), only submits job. + :param impersonation_chain: Optional service account to impersonate + using short-term credentials, or chained list of accounts required + to get the access_token of the last account in the list, + which will be impersonated in the request. If set as a string, the + account must grant the originating account the Service Account Token + Creator IAM role. If set as a sequence, the identities from the list + must grant Service Account Token Creator IAM role to the directly + preceding identity, with first account from the list granting this + role to the originating account (templated). + """ + + template_fields: Sequence[str] = ("job_name", "region", "project_id", "gcp_conn_id") + operator_extra_links = (CloudRunJobExecutionLink(),) + + def __init__( + self, + job_name: str, Review Comment: This hook is currently dedicated to running existing Cloud Run jobs. It does not intend to implement CRUD operations on jobs until https://github.com/apache/airflow/issues/29643 is resolved. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
