googleapis / google-cloud-python

Google Cloud Client Library for Python
https://googleapis.github.io/google-cloud-python/
Apache License 2.0
4.73k stars 1.51k forks source link

google-cloud-run, ContainerOverride is missing command #12760

Open iuiu34 opened 1 month ago

iuiu34 commented 1 month ago

Hi, in cloudRun. Given a job, you can override args but not command. Why? I'm reporting this as bug, instead of feature requests, cause seems inconsistent to me

from google.cloud import run_v2

def run_job(command: str ,
            args: dict ,
            job_name: str ,
            location: str ,
            project: str 

            ):
    if type(args) is dict:
        args = [f'--{k}={v}' for k, v in args.items()]

    client = run_v2.JobsClient()
    args =['get_circ_mrna', '--args', 'args']
    container_overrides = run_v2.RunJobRequest.Overrides.ContainerOverride(
        args=args,
        # command=command # why this is not allowed?
    )

    overrides = run_v2.RunJobRequest.Overrides(
        container_overrides=[container_overrides]
    )
    job_name_ = f"projects/{project}/locations/{location}/jobs/{job_name}"

    request = run_v2.RunJobRequest(
        name=job_name_,
        overrides=overrides,
    )

    request = client.run_job(request=request)
    name = request.metadata.name.split('/')[-1]

    print(f"executed job: {name}")
    # response = operation.result()
    link = f"https://console.cloud.google.com/run/jobs/executions/details/{location}/{name}/tasks?project={project}"
    print(f"job link: {link}")
iuiu34 commented 1 month ago

https://issuetracker.google.com/issues/343734020

mukund-ananthu commented 1 month ago

@iuiu34

The issue created looks related to Cloud Run. This repository deals with issues related to Cloud Pub/Sub. Could you please let me know if there was a reason for creating the issue in this repository?

mukund-ananthu commented 1 month ago

I could find this repository that is related to Google Cloud Run: https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-run . Please feel free to create the issues there if you find it more relevant. I am also closing this issue, please feel free to reopen if you think it is related to Cloud Pub/Sub.

iuiu34 commented 1 month ago

@mukund-ananthu i don't follow

cloud run is in https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-run. Which is this current repo, where i'm opening the issue, no?

parthea commented 1 month ago

@iuiu34 The issue is in the correct repository now.

mukund-ananthu commented 1 month ago

cloud run is in https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-run. Which is this current repo, where i'm opening the issue, no?

@iuiu34

  1. The issue was created in https://github.com/googleapis/python-pubsub/tree/main
  2. It was then transferred to the correct repository after the comment. Refer to [parthea](https://github.com/parthea) transferred this issue from googleapis/python-pubsub [5 minutes ago](https://github.com/googleapis/google-cloud-python/issues/12760#event-12990340805) in the issue history.
parthea commented 1 month ago

@iuiu34, Regrettably, the feature doesn't exist in the Cloud Run API as per the API documentation. Thank you for filing an issue in the API specific issue tracker. Please follow up via the API specific bug https://issuetracker.google.com/issues/343734020.

iuiu34 commented 1 month ago

understood.

For me is inconsistent also that the functionality of overwriting command is in the cmd but not in the python api

parthea commented 1 month ago

The Python Client Library for Cloud Run supports all of the published API interfaces. As this issue is specific to the API itself, please follow up on https://issuetracker.google.com/issues/343734020.