-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresource_operators.json
More file actions
113 lines (113 loc) · 3.03 KB
/
Copy pathresource_operators.json
File metadata and controls
113 lines (113 loc) · 3.03 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
110
111
112
113
{
"name": "resource operators (recall_resource + transform_resource_lookup)",
"static_resources": {
"user_tags": {
"u1": "vip",
"u2": "normal",
"u3": "vip"
},
"hot_items": [
{"item_id": "h1", "item_score": 95.0},
{"item_id": "h2", "item_score": 88.0},
{"item_id": "h3", "item_score": 72.0}
]
},
"config": {
"_PINEAPPLE_VERSION": "0.10.12",
"pipeline_config": {
"operators": {
"recall_hot": {
"type_name": "recall_resource",
"resource_name": "hot_items",
"$metadata": {
"common_input": [],
"common_output": [],
"item_input": [],
"item_output": ["item_id", "item_score"]
}
},
"dispatch_uid": {
"type_name": "transform_dispatch",
"consumes_row_set": true,
"$metadata": {
"common_input": ["user_id"],
"common_output": [],
"item_input": [],
"item_output": ["item_user_id"]
}
},
"enrich_tag": {
"type_name": "transform_resource_lookup",
"resource_name": "user_tags",
"lookup_key": "item_user_id",
"output_field": "user_tag",
"default_value": "unknown",
"$metadata": {
"common_input": [],
"common_output": [],
"item_input": ["item_user_id"],
"item_output": ["user_tag"]
}
},
"sort_score": {
"type_name": "reorder_sort",
"order": "desc",
"$metadata": {
"common_input": [],
"common_output": [],
"item_input": ["item_score"],
"item_output": []
}
}
},
"pipeline_map": {
"main_stage": {
"pipeline": ["recall_hot", "dispatch_uid", "enrich_tag", "sort_score"]
}
}
},
"pipeline_group": {
"main": {
"pipeline": ["main_stage"]
}
},
"flow_contract": {
"common_input": ["user_id"],
"item_input": [],
"common_output": [],
"item_output": ["item_id", "item_score", "user_tag"]
}
},
"cases": [
{
"name": "recall from resource, dispatch uid, lookup tag (vip user)",
"request": {
"common": {"user_id": "u1"},
"items": []
},
"expected": {
"common": {},
"items": [
{"item_id": "h1", "item_score": 95.0, "user_tag": "vip"},
{"item_id": "h2", "item_score": 88.0, "user_tag": "vip"},
{"item_id": "h3", "item_score": 72.0, "user_tag": "vip"}
]
}
},
{
"name": "unknown user gets default tag",
"request": {
"common": {"user_id": "u999"},
"items": []
},
"expected": {
"common": {},
"items": [
{"item_id": "h1", "item_score": 95.0, "user_tag": "unknown"},
{"item_id": "h2", "item_score": 88.0, "user_tag": "unknown"},
{"item_id": "h3", "item_score": 72.0, "user_tag": "unknown"}
]
}
}
]
}