-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnested_subflow.json
More file actions
109 lines (109 loc) · 2.7 KB
/
Copy pathnested_subflow.json
File metadata and controls
109 lines (109 loc) · 2.7 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
"name": "nested SubFlow pipeline",
"config": {
"_PINEAPPLE_VERSION": "0.10.14",
"pipeline_config": {
"operators": {
"copy_tag": {
"type_name": "transform_copy",
"direction": "common_to_item",
"$metadata": {
"common_input": ["tag"],
"common_output": [],
"item_input": [],
"item_output": ["tag"]
}
},
"compute_score": {
"type_name": "transform_by_lua",
"lua_script": "function calc()\n return item_base * 2\nend",
"function_for_item": "calc",
"function_for_common": "",
"$metadata": {
"common_input": [],
"common_output": [],
"item_input": ["item_base"],
"item_output": ["item_score"]
}
},
"sort_desc": {
"type_name": "reorder_sort",
"order": "desc",
"$metadata": {
"common_input": [],
"common_output": [],
"item_input": ["item_score"],
"item_output": []
}
},
"keep_top2": {
"type_name": "filter_truncate",
"top_n": 2,
"$metadata": {
"common_input": [],
"common_output": [],
"item_input": [],
"item_output": []
}
}
},
"pipeline_map": {
"enrich": {
"pipeline": ["copy_tag", "compute_score"]
},
"rank_and_cut": {
"pipeline": ["sort_desc", "keep_top2"]
},
"full_pipeline": {
"pipeline": ["enrich", "rank_and_cut"]
}
}
},
"pipeline_group": {
"main": {
"pipeline": ["full_pipeline"]
}
},
"flow_contract": {
"common_input": ["tag"],
"item_input": ["item_base"],
"common_output": [],
"item_output": ["item_base", "tag", "item_score"]
}
},
"cases": [
{
"name": "nested sub-flows: enrich → rank → truncate",
"request": {
"common": {"tag": "promo"},
"items": [
{"item_base": 10.0},
{"item_base": 50.0},
{"item_base": 30.0}
]
},
"expected": {
"common": {},
"items": [
{"item_base": 50.0, "tag": "promo", "item_score": 100},
{"item_base": 30.0, "tag": "promo", "item_score": 60}
]
}
},
{
"name": "fewer items than top_n — all kept",
"request": {
"common": {"tag": "test"},
"items": [
{"item_base": 5.0}
]
},
"expected": {
"common": {},
"items": [
{"item_base": 5.0, "tag": "test", "item_score": 10}
]
}
}
]
}