1

I have a Dataflow job written using the Python SDK. But I want to trigger this Dataflow Job using Cloud Functions which should written in Go. I found a thread similar to this which has the function written in Python Trigger Dataflow with Python

My flow would be like below:

  1. PubSub Notification to trigger Cloud Functions
  2. Cloud Functions written in Go to start a DataFlow Job written in Python

I can make the Dataflow SDK as a template. Any pointers on how I can trigger the Python Dataflow templates from Go? Or is there a better way for it?

Many thanks!

1 Answer 1

3

check "google.golang.org/api/dataflow/v1b3" package

I don't have a way to test it, but I think it looks like a code like this

ctx := context.Background()
dataflowService, _ := dataflow.NewService(ctx)
jobService := dataflow.NewProjectsJobsService(dataflowService)
jobService.Get("project ", "job id").Do()
3
  • 1
    This looks good. More specifically for templates though: pkg.go.dev/google.golang.org/api/dataflow/… API Reference: cloud.google.com/dataflow/docs/reference/rest/v1b3/… Commented Feb 9, 2023 at 4:39
  • Thanks for the answer. Can you please let me know how to pass the template to this?
    – Ashok KS
    Commented Feb 9, 2023 at 22:22
  • ` dataflow = build('dataflow', 'v1b3') request = dataflow.projects().templates().launch( projectId=project, gcsPath=template, body={ 'jobName': job, 'parameters': parameters, } ) response = request.execute() ` I could find for Python. Is there something similar using Go?
    – Ashok KS
    Commented Feb 12, 2023 at 23:56

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.