google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

google-cloud-run, ContainerOverride is missing command

Open iuiu34 opened this issue 1 year ago • 9 comments

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 avatar May 30 '24 18:05 iuiu34

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

iuiu34 avatar May 30 '24 18:05 iuiu34

@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 avatar May 30 '24 18:05 mukund-ananthu

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.

mukund-ananthu avatar May 30 '24 18:05 mukund-ananthu

@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?

iuiu34 avatar May 30 '24 18:05 iuiu34

@iuiu34 The issue is in the correct repository now.

parthea avatar May 30 '24 18:05 parthea

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.

mukund-ananthu avatar May 30 '24 18:05 mukund-ananthu

@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.

parthea avatar May 30 '24 18:05 parthea

understood.

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

iuiu34 avatar May 30 '24 18:05 iuiu34

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.

parthea avatar May 30 '24 18:05 parthea

I'm going to close this issue as the feature request is for the API itself rather than the client library. As per https://github.com/googleapis/google-cloud-python/issues/12760#issuecomment-2140682487, please follow up in the API specific issue tracker : https://issuetracker.google.com/issues/343734020

parthea avatar Aug 26 '24 14:08 parthea