-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgcp-workflow-example.yaml
More file actions
44 lines (44 loc) · 2.14 KB
/
gcp-workflow-example.yaml
File metadata and controls
44 lines (44 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
main:
params: [args]
steps:
- read_runtime_args:
assign:
- project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
- location: ${sys.get_env("GOOGLE_CLOUD_LOCATION")}
- repository: "custom-jobs"
- depsImage: "image-caption-gpu-deps"
- flexImage: "image-caption-gpu-flex"
- jobId: "workflow-dataflow-flex-run"
- run_flex_dataflow_job:
call: googleapis.dataflow.v1b3.projects.locations.flexTemplates.launch
# If you use `projects.locations.flexTemplates.launch`, you can directly pass the json template to `containerSpecGcsPath`
# and waive all the parameters and runtime settings.
# I didn't know this^ convenient API when i was writing this GCP workflow.
result: launchResult
args:
location: ${location}
projectId: ${project}
body:
# The following parameters are ordered to align with Google's Official API.
# https://github.com/googleapis/googleapis/blob/1cfcea4fbef317c44cc13d73017a0b0462c4737d/google/dataflow/v1beta3/templates.proto#L118
launchParameter:
jobName: ${jobId + "-" + string(uuid.generate())}
containerSpec:
image: ${ "us-central1-docker.pkg.dev/" + project + "/custom-jobs/" + flexImage }
sdkInfo:
language: PYTHON
parameters:
sdk_location: container
sdk_container_image: ${ "us-central1-docker.pkg.dev/" + project + "/custom-jobs/" + depsImage" } # Put the image where your code logic is saved in.
runner: DataflowRunner
job_name_prefix: "image-caption"
machine_type: n1-highmem-8
experiment: use_runner_v2
disk_size_gb: '50'
## Add your job-specific params below
dry_run: ${args.dry_run}
environment:
numWorkers: 1
maxWorkers: 10
tempLocation: ${ "gs://" + project + "dataflow-temp/image-caption" }
stagingLocation: ${ "gs://" + project + "dataflow-staging/image-caption" }