@@ -18,19 +18,20 @@ import (
1818)
1919
2020type remotePolicyParams struct {
21- CloudNodes []string `json:"cloud_nodes"` // Set of Cloud nodes
22- EdgeNodes []string `json:"edge_nodes"` // Set of Edge nodes
23- NodeMemory map [string ]float64 `json:"node_memory"` // Memory per node
24- DSLatency map [string ]float64 `json:"ds_latency"` // Latency per node
25- DSBandwidth map [string ]float64 `json:"ds_bandwidth"` // Bandwidth per node
26- NodeLatency map [string ]float64 `json:"node_latency"` // map[json.dumps((src_node, dst_node))] = latency
27- HandlingNode string `json:"handling_node"`
28- T []string `json:"T"` // Set of tasks
29- Adj map [string ][]string `json:"adj"` // Task adjacency list
30- TaskMemory map [string ]float64 `json:"task_memory"` // Memory per task
31- Deadline float64 `json:"deadline"` // Global deadline
32- OutputSize map [string ]float64 `json:"output_size"` // Output size per task
33- InputSize float64 `json:"input_size"` // Input data size
21+ CloudNodes []string `json:"cloud_nodes"` // Set of Cloud nodes
22+ EdgeNodes []string `json:"edge_nodes"` // Set of Edge nodes
23+ NodeAvailableMemory map [string ]float64 `json:"node_available_memory"` // Available memory per node
24+ NodeFreeMemory map [string ]float64 `json:"node_free_memory"` // Free memory per node
25+ DSLatency map [string ]float64 `json:"ds_latency"` // Latency per node
26+ DSBandwidth map [string ]float64 `json:"ds_bandwidth"` // Bandwidth per node
27+ NodeLatency map [string ]float64 `json:"node_latency"` // map[json.dumps((src_node, dst_node))] = latency
28+ HandlingNode string `json:"handling_node"`
29+ T []string `json:"T"` // Set of tasks
30+ Adj map [string ][]string `json:"adj"` // Task adjacency list
31+ TaskMemory map [string ]float64 `json:"task_memory"` // Memory per task
32+ Deadline float64 `json:"deadline"` // Global deadline
33+ OutputSize map [string ]float64 `json:"output_size"` // Output size per task
34+ InputSize float64 `json:"input_size"` // Input data size
3435
3536 ObjWeights []float64 `json:"obj_weights"` // Objective terms weights
3637 Cost map [string ]float64 `json:"cost"` // Computation cost
@@ -45,19 +46,20 @@ type taskPlacement map[TaskId]string
4546
4647func initParams () remotePolicyParams {
4748 return remotePolicyParams {
48- Adj : make (map [string ][]string ),
49- ExecTime : make (map [string ]float64 ),
50- InitTime : make (map [string ]float64 ),
51- OutputSize : make (map [string ]float64 ),
52- NodeMemory : make (map [string ]float64 ),
53- Cost : make (map [string ]float64 ),
54- TaskMemory : make (map [string ]float64 ),
55- NodeLabels : make (map [string ][]string ),
56- TaskLabels : make (map [string ][]string ),
57- DSBandwidth : make (map [string ]float64 ),
58- DSLatency : make (map [string ]float64 ),
59- NodeLatency : make (map [string ]float64 ),
60- ObjWeights : []float64 {0.33 , 0.33 , 0.33 },
49+ Adj : make (map [string ][]string ),
50+ ExecTime : make (map [string ]float64 ),
51+ InitTime : make (map [string ]float64 ),
52+ OutputSize : make (map [string ]float64 ),
53+ NodeAvailableMemory : make (map [string ]float64 ),
54+ NodeFreeMemory : make (map [string ]float64 ),
55+ Cost : make (map [string ]float64 ),
56+ TaskMemory : make (map [string ]float64 ),
57+ NodeLabels : make (map [string ][]string ),
58+ TaskLabels : make (map [string ][]string ),
59+ DSBandwidth : make (map [string ]float64 ),
60+ DSLatency : make (map [string ]float64 ),
61+ NodeLatency : make (map [string ]float64 ),
62+ ObjWeights : []float64 {0.33 , 0.33 , 0.33 },
6163 }
6264}
6365
@@ -180,12 +182,14 @@ func prepareParameters(r *Request, p *Progress) *remotePolicyParams {
180182 params .EdgeNodes = []string {LOCAL }
181183 params .Deadline = r .QoS .MaxRespT - time .Now ().Sub (r .Arrival ).Seconds ()
182184 params .HandlingNode = LOCAL
183- params .NodeMemory [LOCAL ] = (float64 )(node .LocalResources .AvailableMemory ())
185+ params .NodeAvailableMemory [LOCAL ] = (float64 )(node .LocalResources .AvailableMemory ())
186+ params .NodeFreeMemory [LOCAL ] = (float64 )(node .LocalResources .FreeMemory ())
184187
185- wViolations := config .GetFloat (config .WORKFLOW_OFFLOADING_POLICY_ILP_OBJ_WEIGHT_VIOLATIONS , 0.33 )
186- wDataTransfers := config .GetFloat (config .WORKFLOW_OFFLOADING_POLICY_ILP_OBJ_WEIGHT_DATA_TRANSFERS , 0.33 )
187- wCost := config .GetFloat (config .WORKFLOW_OFFLOADING_POLICY_ILP_OBJ_WEIGHT_COST , 0.33 )
188- params .ObjWeights = []float64 {wViolations , wDataTransfers , wCost }
188+ wViolations := config .GetFloat (config .WORKFLOW_OFFLOADING_POLICY_ILP_OBJ_WEIGHT_VIOLATIONS , 0.3 )
189+ wDataTransfers := config .GetFloat (config .WORKFLOW_OFFLOADING_POLICY_ILP_OBJ_WEIGHT_DATA_TRANSFERS , 0.3 )
190+ wCost := config .GetFloat (config .WORKFLOW_OFFLOADING_POLICY_ILP_OBJ_WEIGHT_COST , 0.3 )
191+ wReclaimedMemory := config .GetFloat (config .WORKFLOW_OFFLOADING_POLICY_ILP_OBJ_WEIGHT_RECLAIMED_MEMORY , 0.1 )
192+ params .ObjWeights = []float64 {wViolations , wDataTransfers , wCost , wReclaimedMemory }
189193
190194 regionCost := config .GetStringMapFloat64 (config .WORKFLOW_OFFLOADING_POLICY_REGION_COST )
191195 // TODO: ToLower() is needed because viper (used to parse configuration files) is not case sensitive
@@ -201,9 +205,10 @@ func prepareParameters(r *Request, p *Progress) *remotePolicyParams {
201205 nearbyServers := registration .GetFullNeighborInfo ()
202206 if nearbyServers != nil {
203207 for k , v := range nearbyServers {
204- if ( v . TotalMemory - v . UsedMemory ) > 0 && (v .TotalCPU - v .UsedCPU ) > 0 {
208+ if v . AvailableMemory > 0 && (v .TotalCPU - v .UsedCPU ) > 0 {
205209 params .EdgeNodes = append (params .EdgeNodes , k )
206- params .NodeMemory [k ] = float64 (v .TotalMemory - v .UsedMemory )
210+ params .NodeAvailableMemory [k ] = float64 (v .AvailableMemory )
211+ params .NodeFreeMemory [k ] = float64 (v .FreeMemory )
207212
208213 // Cost (assuming that Edge nodes are all in the same area)
209214 params .Cost [k ] = localCost
0 commit comments