Skip to content

Instantly share code, notes, and snippets.

@antoniocachuan
Created April 30, 2021 02:48
Show Gist options
  • Select an option

  • Save antoniocachuan/119f265538dd15ca9faae847aa053efd to your computer and use it in GitHub Desktop.

Select an option

Save antoniocachuan/119f265538dd15ca9faae847aa053efd to your computer and use it in GitHub Desktop.
Launch Dataflow and write in Pub/Sub
main:
steps:
- init:
assign:
- project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
- region: "us-central1"
- zone: "us-central1-a"
- topic: "TOPIC_NAME"
- job_name: "covid_job"
- input_script: "gs://BUCKET_NAME/dataflow/template/templatefile"
- temp_location: "gs://BUCKET_NAME/dataflow/tmp"
- launchDataflow:
call: googleapis.dataflow.v1b3.projects.locations.templates.create
args:
location: ${region}
projectId: ${project}
body:
gcsPath: ${input_script}
jobName: ${job_name}
result: createResult
- successTopic:
call: googleapis.pubsub.v1.projects.topics.publish
args:
topic: ${"projects/" + project + "/topics/" + topic}
body:
messages:
- data: ${base64.encode(text.encode("{\"message\":\"pipeline done\"}"))}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment