Skip to content

Commit 234b5a8

Browse files
committed
Get ILP Optimizer host and port from configuration
1 parent 07b9b1c commit 234b5a8

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

internal/config/keys.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,9 @@ const TRACING_OUTFILE = "tracing.outfile"
8484
// Offloading policy to use
8585
// Possible values: "disable", "ilp"
8686
const OFFLOADING_POLICY = "offloading.policy"
87+
88+
// Port used by ILP Offloading Policy for solving the ILP formulation
89+
const OFFLOADING_POLICY_ILP_OPTIMIZER_PORT = "offloading.policy.ilp.port"
90+
91+
// IP address / hostname used by ILP Offloading Policy for solving the ILP formulation
92+
const OFFLOADING_POLICY_ILP_OPTIMIZER_HOST = "offloading.policy.ilp.host"

internal/workflow/ilp_offloading_policy.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strconv"
99
"time"
1010

11+
"github.com/serverledge-faas/serverledge/internal/config"
1112
"github.com/serverledge-faas/serverledge/internal/function"
1213
"github.com/serverledge-faas/serverledge/internal/metrics"
1314
"github.com/serverledge-faas/serverledge/internal/node"
@@ -278,7 +279,9 @@ func (policy *IlpOffloadingPolicy) Evaluate(r *Request, p *Progress) (Offloading
278279
}
279280

280281
// Create POST request
281-
url := "http://localhost:8080/" // TODO: configurable
282+
ilpOptimizerHost := config.GetString(config.OFFLOADING_POLICY_ILP_OPTIMIZER_HOST, "localhost")
283+
ilpOptimizerPort := config.GetInt(config.OFFLOADING_POLICY_ILP_OPTIMIZER_PORT, 8080)
284+
url := fmt.Sprintf("http://%s:%d", ilpOptimizerHost, ilpOptimizerPort)
282285
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
283286
if err != nil {
284287
panic(err)

0 commit comments

Comments
 (0)