forked from UCY-LINC-LAB/edge-computing-query-model
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.ins
More file actions
182 lines (182 loc) · 3.85 KB
/
examples.ins
File metadata and controls
182 lines (182 loc) · 3.85 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/**
2b
**/
top_10_taxis_most_profit_areas =
COMPUTE TOP_K[10] (
(
SUM (total_amount, 1 MINUTES) BY city
/
COUNT(taxi_passenger, 1 MINUTES) BY city
)
)
EVERY 1 HOURS
;
/**
2a
**/
top_10_taxis_most_profit_areas =
COMPUTE TOP_K[10] (
(
SUM (total_amount, 1 MINUTES) BY city
-
COUNT(taxi_passenger, 1 MINUTES, 2 SECONDS) BY city
)
)
EVERY 1 HOURS
;
/**
3a
**/
city_segment_min_num_of_vehicles =
COMPUTE
MIN (
SUM (
(
COUNT (x) BY city_segment
+
(
COUNT (y) BY city_segemnt
+
COUNT (t) BY city_segment
)
)
)
)
EVERY 10 SECONDS
;
/** 4 **/
filtered_forecasting_delay =
COMPUTE FORECAST[3](
ARITHMETIC_MEAN(bus_delay WHEN > 0, 1 HOURS)
) BY stopID EVERY 1 MINUTES
;
/** 5 **/
closest_taxis_car_sharing_vehicles =
COMPUTE vehicleID FROM( taxis, car_sharing )
WHEN GEOHASH[10](cusLoc) == GEOHASH[10](vehLoc)
EVERY 30 MINUTES
;
/** 6 **/
insight = COMPUTE rackID
WHEN temp > (RUNNING_MEAN(temp)+ ( 3 * RUNNING_SDEV(temp)))
EVERY 5 SECONDS
;
/** 7 **/
datacenter_energy_consumption_histogram =
COMPUTE
HISTOGRAM[5](
daily_energy_consumption)
BY rackID
EVERY 1 DAY AT 23:59 GMT
WITH SALIENCE 2
;
/** 8a **/
cost =
COMPUTE (
PRICE_PER_KWh
*
(
ARITHMETIC_MEAN(consumption, 1 HOURS ) BY datacenterID
-
ARITHMETIC_MEAN(generated_solar_energy, 1 HOURS ) BY datacenterID
)
) EVERY 15 MINUTES
;
/** 8b **/
query = COMPUTE
ARITHMETIC_MEAN(consumption, 5 MINUTES)
EVERY 1 MINUTES
WITH ALLOW WHEN dc_cost == MIN(cost)
;
/**9**/
sample_energy_generation =
COMPUTE ARITHMETIC_MEAN(energy, 30 MINUTES) BY region EVERY 1 MINUTES
WITH SAMPLE 0.4
;
/**10**/
sampling_computation_awareness =
COMPUTE PEWMA[0.5](energy) BY region
EVERY 1 MINUTES
WITH CONFIDENCE 0.95 AND MAX_ERROR 0.05
AND AWARENESS ON COMPUTATIONS
;
/**11**/
smoke_mean =COMPUTE
ARITHMETIC_MEAN(smoke) BY region
EVERY 1 SECONDS
WITH SALIENCE 5 AND ALLOW WHEN node_id IN (node_1,node_6)
;
/**12**/
extreme_heart_beat =
COMPUTE ARITHMETIC_MEAN(heart_beat, 1 MINUTES) BY patient
WHEN >= 120 EVERY 5 MINUTES
WITH SIGNATURE 'authority_signature'
;
/**13**/
insightID =
COMPUTE patient_stream EVERY 5 MINUTES
WITH
ALLOW WHEN
ARITHMETIC_MEAN ( heart_beat, 1 MINUTES ) >= 120
AND doctor_id IN (doctor_ids)
AND region == doctor_region
;
/**14a**/
prevalent_last_12_hours =
COMPUTE ( COUNT (disease WHEN == malaria, 12 HOURS) / COUNT(disease,12 HOURS) )
BY region EVERY 12 HOURS
;
/**14b**/
prevalent =
COMPUTE
(
RUNNING_COUNT(disease WHEN == malaria)
/
RUNNING_COUNT(disease)
) BY region EVERY 12 HOURS
;
/**14c**/
prevalent_alert =
COMPUTE
(INSIGHT prevalent_last_12_hours - INSIGHT prevalent ) WHEN >= 0.02
EVERY 5 MINUTES
;
/**15**/
correlation =
COMPUTE
CORRELATION ( COUNT(disease WHEN == heart_attack ),
ARITHMETIC_MEAN(patient_age)
)
BY patient_sex EVERY 1 M
;
/**16**/
mean_latency =
COMPUTE ARITHMETIC_MEAN(latency)
EVERY 5 SECONDS
;
scale_out = COMPUTE INSIGHT mean_latency WHEN >= 500 EVERY 5 MINUTES
;
scale_in = COMPUTE INSIGHT mean_latency WHEN< 50 EVERY 5 MINUTES
;
/**17**/
scale_out =
COMPUTE instance_id
WHEN INSIGHT avg_cpu >= 80 AND INSIGHT avg_ram >= 70
EVERY 5 MINUTES
;
/**18**/
insight = COMPUTE
(
(500 - ARITHMETIC_MEAN(latency) )
/
( cost_provider * COUNT(instances) )
) BY region
EVERY 5 MINUTES
;
/**19**/
FUNCTION ipToCountry(ip) { ... }
;
FUNCTION legalCountries(movie) { ... }
;
new_requests = COMPUTE
request WHEN ipToCountry(ip) IN legalCountries(request_movie) EVERY 60 SECONDS