python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

WorkflowTemplatePlacement Code Snippet

Open datasherlock opened this issue 2 years ago • 5 comments

As on 13-Jun-2022, the WorkflowTemplatePlacement documentation seems to be providing incorrect key names that can be misleading. A code snippet showcasing the right way to leverage these APIs can be helpful for many. I have a ready snippet that I wrote to demonstrate the usage that I would like to contribute back to the repo.

datasherlock avatar Jun 13 '22 17:06 datasherlock

Hi Jerome, please send a pull request and our team will review it.

atulep avatar Jun 15 '22 20:06 atulep

Hey @datasherlock, can you help provide more information?

  1. What documentation are you referring to? Can you provide any links?
  2. Is the issue you're having, from any of the files in this repository? If so, could you provide the links to those files?

dandhlee avatar Jun 19 '22 03:06 dandhlee

Hi Dan, I'm referring to the sample at https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.locations.workflowTemplates#workflowtemplateplacement. The JSON templates provided on this page seem to be incorrect. What actually worked was


"cluster_selector": {
   "zone": "us-central1-a",
   "cluster_labels": {string: string}
 }

datasherlock avatar Aug 16 '22 04:08 datasherlock

And this is the PR I submitted - https://github.com/googleapis/python-dataproc/pull/440

datasherlock avatar Aug 16 '22 04:08 datasherlock

It's a proto documentation which is not this repository's purview. If there is an issue with it, please file a bug with the dataproc proto team responsible.

With regards to cluster_selector: it seems to me it's working as intended; the client library expects cluster_selector as shown here in the Python docs: https://cloud.google.com/python/docs/reference/dataproc/latest/google.cloud.dataproc_v1.types.WorkflowTemplatePlacement. The link to your doc is for the REST API, which may not work as intended.

Your sample seems to overlap the content from https://github.com/googleapis/python-dataproc/blob/main/samples/generated_samples/dataproc_v1_generated_workflow_template_service_instantiate_inline_workflow_template_sync.py. But, if the repo maintainer is happy to accept the sample after a bit more work has been put into it, that should be a good addition :)

dandhlee avatar Aug 16 '22 14:08 dandhlee