-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmulti_input_output.yaml
More file actions
60 lines (51 loc) · 1.9 KB
/
multi_input_output.yaml
File metadata and controls
60 lines (51 loc) · 1.9 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
pipeline:
type: composite
transforms:
# Create some input.
- type: Create
name: Weather
config:
elements:
- {date: '2024-12-01', city: 'Seattle', temperature: 51}
- {date: '2024-12-02', city: 'Seattle', temperature: 51}
- {date: '2024-12-03', city: 'Seattle', temperature: 45}
- {date: '2024-12-03', city: 'Kirkland', temperature: 52}
- {date: '2024-12-01', city: 'New York City', temperature: 41}
- {date: '2024-12-02', city: 'New York City', temperature: 43}
- type: Create
name: CityToState
config:
elements:
- {city: 'Seattle', state: 'WA'}
- {city: 'Kirkland', state: 'WA'}
- {city: 'New York City', state: 'NY'}
- type: MultiInputMultiOutput
input:
# Specify multiple inputs as a mapping that will get passed as a dict
# to the transform's expand function.
city_measurements: Weather
city_to_state: CityToState
# Multiple outputs are returned from the expand function as a dictionary
# mapping string keys to PCollections. Those string keys are referenced
# here.
- type: LogForTesting
input: MultiInputMultiOutput.avg_per_city
- type: LogForTesting
input: MultiInputMultiOutput.max_per_state
# Ensure that the pipeline ran correctly.
- type: AssertEqual
input: MultiInputMultiOutput.avg_per_city
config:
elements:
- {city: 'Seattle', temperature: 49}
- {city: 'Kirkland', temperature: 52}
- {city: 'New York City', temperature: 42}
# Ensure that the pipeline ran correctly.
- type: AssertEqual
input: MultiInputMultiOutput.max_per_state
config:
elements:
- {state: 'WA', temperature: 52}
- {state: 'NY', temperature: 43}
providers:
- include: "./provider_listing.yaml"