Skip to content

Commit 58bad28

Browse files
authored
Add task to faasmtools to flush planner (#117)
* planner: add task to faasmtools to flush planner * fix: add default values
1 parent dbf2541 commit 58bad28

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

faasmtools/endpoints.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
DEFAULT_KNATIVE_HEADERS = {"Host": "faasm-worker.faasm.example.com"}
77

88
DEFAULT_INVOKE_HOST = "worker"
9+
DEFAULT_PLANNER_HOST = "planner"
910
DEFAULT_UPLOAD_HOST = "upload"
1011
DEFAULT_INVOKE_PORT = 8080
12+
DEFAULT_PLANNER_PORT = 8081
1113
DEFAULT_UPLOAD_PORT = 8002
1214

1315

@@ -45,6 +47,16 @@ def get_faasm_invoke_host_port():
4547
return host, port
4648

4749

50+
def get_faasm_planner_host_port():
51+
if not faasm_config_exists():
52+
return DEFAULT_PLANNER_HOST, DEFAULT_PLANNER_PORT
53+
54+
host = get_faasm_ini_value("Faasm", "planner_host")
55+
port = get_faasm_ini_value("Faasm", "planner_port")
56+
57+
return host, port
58+
59+
4860
def get_knative_headers():
4961
if not faasm_config_exists():
5062
return DEFAULT_KNATIVE_HEADERS

tasks/func.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from faasmtools.env import PROJ_ROOT
1010
from faasmtools.endpoints import (
1111
get_faasm_invoke_host_port,
12+
get_faasm_planner_host_port,
1213
get_faasm_upload_host_port,
1314
get_knative_headers,
1415
)
@@ -151,7 +152,7 @@ def flush(ctx):
151152
Flush the Faasm cluster
152153
"""
153154
headers = get_knative_headers()
154-
host, port = get_faasm_invoke_host_port()
155+
host, port = get_faasm_planner_host_port()
155156

156157
url = "http://{}:{}".format(host, port)
157158
data = {"type": FAABRIC_MSG_TYPE_FLUSH}

0 commit comments

Comments
 (0)