kalavai-client 0.5.24__py3-none-any.whl → 0.5.26__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kalavai_client/__init__.py +1 -1
- kalavai_client/assets/apps.yaml +1 -1
- kalavai_client/bridge_api.py +18 -2
- kalavai_client/bridge_models.py +1 -1
- kalavai_client/cli.py +14 -27
- kalavai_client/core.py +30 -0
- {kalavai_client-0.5.24.dist-info → kalavai_client-0.5.26.dist-info}/METADATA +1 -1
- {kalavai_client-0.5.24.dist-info → kalavai_client-0.5.26.dist-info}/RECORD +11 -11
- {kalavai_client-0.5.24.dist-info → kalavai_client-0.5.26.dist-info}/LICENSE +0 -0
- {kalavai_client-0.5.24.dist-info → kalavai_client-0.5.26.dist-info}/WHEEL +0 -0
- {kalavai_client-0.5.24.dist-info → kalavai_client-0.5.26.dist-info}/entry_points.txt +0 -0
kalavai_client/__init__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
__version__ = "0.5.
|
2
|
+
__version__ = "0.5.26"
|
kalavai_client/assets/apps.yaml
CHANGED
kalavai_client/bridge_api.py
CHANGED
@@ -12,7 +12,7 @@ from kalavai_client.bridge_models import (
|
|
12
12
|
DeployJobRequest,
|
13
13
|
DeleteJobRequest,
|
14
14
|
JobDetailsRequest,
|
15
|
-
|
15
|
+
NodesActionRequest
|
16
16
|
)
|
17
17
|
from kalavai_client.core import (
|
18
18
|
create_pool,
|
@@ -41,6 +41,8 @@ from kalavai_client.core import (
|
|
41
41
|
get_ip_addresses,
|
42
42
|
get_pool_token,
|
43
43
|
delete_nodes,
|
44
|
+
cordon_nodes,
|
45
|
+
uncordon_nodes,
|
44
46
|
TokenType
|
45
47
|
)
|
46
48
|
|
@@ -85,12 +87,26 @@ def pool_stop(request: StopPoolRequest):
|
|
85
87
|
return result
|
86
88
|
|
87
89
|
@app.post("/delete_nodes")
|
88
|
-
def device_delete(request:
|
90
|
+
def device_delete(request: NodesActionRequest):
|
89
91
|
result = delete_nodes(
|
90
92
|
nodes=request.nodes
|
91
93
|
)
|
92
94
|
return result
|
93
95
|
|
96
|
+
@app.post("/cordon_nodes")
|
97
|
+
def device_cordon(request: NodesActionRequest):
|
98
|
+
result = cordon_nodes(
|
99
|
+
nodes=request.nodes
|
100
|
+
)
|
101
|
+
return result
|
102
|
+
|
103
|
+
@app.post("/uncordon_nodes")
|
104
|
+
def device_uncordon(request: NodesActionRequest):
|
105
|
+
result = uncordon_nodes(
|
106
|
+
nodes=request.nodes
|
107
|
+
)
|
108
|
+
return result
|
109
|
+
|
94
110
|
@app.get("/get_pool_token")
|
95
111
|
def devices(mode: int):
|
96
112
|
|
kalavai_client/bridge_models.py
CHANGED
kalavai_client/cli.py
CHANGED
@@ -54,6 +54,8 @@ from kalavai_client.core import (
|
|
54
54
|
resume_agent,
|
55
55
|
get_pool_token,
|
56
56
|
delete_nodes,
|
57
|
+
cordon_nodes,
|
58
|
+
uncordon_nodes,
|
57
59
|
TokenType
|
58
60
|
)
|
59
61
|
from kalavai_client.utils import (
|
@@ -127,27 +129,6 @@ def pre_join_check(node_name, server_url, server_key):
|
|
127
129
|
except Exception as e:
|
128
130
|
console.log(f"[red]Error when connecting to kalavai service: {str(e)}")
|
129
131
|
return False
|
130
|
-
|
131
|
-
def set_schedulable(schedulable, node_name=load_server_info(data_key=NODE_NAME_KEY, file=USER_LOCAL_SERVER_FILE)):
|
132
|
-
"""
|
133
|
-
Delete job in the cluster
|
134
|
-
"""
|
135
|
-
# deploy template with kube-watcher
|
136
|
-
data = {
|
137
|
-
"schedulable": str(schedulable),
|
138
|
-
"node_names": [node_name]
|
139
|
-
}
|
140
|
-
try:
|
141
|
-
res = request_to_server(
|
142
|
-
method="post",
|
143
|
-
endpoint="/v1/set_node_schedulable",
|
144
|
-
data=data,
|
145
|
-
server_creds=USER_LOCAL_SERVER_FILE,
|
146
|
-
user_cookie=USER_COOKIE
|
147
|
-
)
|
148
|
-
console.log(f"{res}")
|
149
|
-
except Exception as e:
|
150
|
-
console.log(f"[red]Error when connecting to kalavai service: {str(e)}")
|
151
132
|
|
152
133
|
def select_ip_address(subnet=None):
|
153
134
|
ips = get_ip_addresses(subnet=subnet)
|
@@ -223,7 +204,7 @@ def input_gpus():
|
|
223
204
|
##################
|
224
205
|
|
225
206
|
@arguably.command
|
226
|
-
def gui__start(*others, backend_only=False, gui_frontend_port=3000, gui_backend_port=8000, bridge_port=8001):
|
207
|
+
def gui__start(*others, backend_only=False, gui_frontend_port=3000, gui_backend_port=8000, bridge_port=8001, log_level="critical"):
|
227
208
|
"""Run GUI (docker) and kalavai core backend (api)"""
|
228
209
|
|
229
210
|
if not backend_only:
|
@@ -241,7 +222,7 @@ def gui__start(*others, backend_only=False, gui_frontend_port=3000, gui_backend_
|
|
241
222
|
run_cmd(f"docker compose --file {USER_GUI_COMPOSE_FILE} up -d")
|
242
223
|
|
243
224
|
console.log(f"[green]Loading GUI, may take a few minutes. It will be available at http://localhost:{gui_frontend_port}")
|
244
|
-
run_api(port=bridge_port)
|
225
|
+
run_api(port=bridge_port, log_level=log_level)
|
245
226
|
|
246
227
|
if not backend_only:
|
247
228
|
run_cmd(f"docker compose --file {USER_GUI_COMPOSE_FILE} down")
|
@@ -958,8 +939,11 @@ def node__cordon(node_name, *others):
|
|
958
939
|
except Exception as e:
|
959
940
|
console.log(f"[red]Problems with your pool: {str(e)}")
|
960
941
|
return
|
961
|
-
|
962
|
-
|
942
|
+
result = cordon_nodes(nodes=[node_name])
|
943
|
+
if "error" in result:
|
944
|
+
console.log(f"[red]{result['error']}")
|
945
|
+
else:
|
946
|
+
console.log(result)
|
963
947
|
|
964
948
|
@arguably.command
|
965
949
|
def node__uncordon(node_name, *others):
|
@@ -971,8 +955,11 @@ def node__uncordon(node_name, *others):
|
|
971
955
|
except Exception as e:
|
972
956
|
console.log(f"[red]Problems with your pool: {str(e)}")
|
973
957
|
return
|
974
|
-
|
975
|
-
|
958
|
+
result = uncordon_nodes(nodes=[node_name])
|
959
|
+
if "error" in result:
|
960
|
+
console.log(f"[red]{result['error']}")
|
961
|
+
else:
|
962
|
+
console.log(result)
|
976
963
|
|
977
964
|
@arguably.command
|
978
965
|
def job__templates(*others):
|
kalavai_client/core.py
CHANGED
@@ -98,6 +98,30 @@ class TokenType(Enum):
|
|
98
98
|
WORKER = 2
|
99
99
|
|
100
100
|
|
101
|
+
def set_schedulable(schedulable, node_names):
|
102
|
+
"""
|
103
|
+
Delete job in the cluster
|
104
|
+
"""
|
105
|
+
# deploy template with kube-watcher
|
106
|
+
data = {
|
107
|
+
"schedulable": str(schedulable),
|
108
|
+
"node_names": node_names
|
109
|
+
}
|
110
|
+
try:
|
111
|
+
res = request_to_server(
|
112
|
+
method="post",
|
113
|
+
endpoint="/v1/set_node_schedulable",
|
114
|
+
data=data,
|
115
|
+
server_creds=USER_LOCAL_SERVER_FILE,
|
116
|
+
user_cookie=USER_COOKIE
|
117
|
+
)
|
118
|
+
if res is not None and "detail" in res:
|
119
|
+
return {"error": res["detail"]}
|
120
|
+
else:
|
121
|
+
return {"result": res}
|
122
|
+
except Exception as e:
|
123
|
+
return {"error": f"Error when connecting to kalavai service: {str(e)}"}
|
124
|
+
|
101
125
|
def init_user_workspace(force_namespace=None):
|
102
126
|
|
103
127
|
# load template config and populate with values
|
@@ -495,6 +519,12 @@ def delete_nodes(nodes):
|
|
495
519
|
except Exception as e:
|
496
520
|
return {"error": f"Error when removing nodes {nodes}: {str(e)}"}
|
497
521
|
|
522
|
+
def cordon_nodes(nodes):
|
523
|
+
return set_schedulable(schedulable=False, node_names=nodes)
|
524
|
+
|
525
|
+
def uncordon_nodes(nodes):
|
526
|
+
return set_schedulable(schedulable=True, node_names=nodes)
|
527
|
+
|
498
528
|
def attach_to_pool(token, node_name=None):
|
499
529
|
if node_name is None:
|
500
530
|
node_name = f"{socket.gethostname()}-{uuid.uuid4().hex[:6]}"
|
@@ -1,7 +1,7 @@
|
|
1
|
-
kalavai_client/__init__.py,sha256=
|
1
|
+
kalavai_client/__init__.py,sha256=yEQn5h7HJ9p7TIniys_VwtONGK1a_jUSpvxigYZe4PI,23
|
2
2
|
kalavai_client/__main__.py,sha256=WQUfxvRsBJH5gsCJg8pLz95QnZIj7Ol8psTO77m0QE0,73
|
3
3
|
kalavai_client/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
kalavai_client/assets/apps.yaml,sha256=
|
4
|
+
kalavai_client/assets/apps.yaml,sha256=d13TzkWtqdwpWOxuoG7eG0Jp0UhVUsboS28496H8iH4,5982
|
5
5
|
kalavai_client/assets/apps_values.yaml,sha256=CjKVelPQHd-hm-DTMEuya92feKiphU9mh3HrosLYYPE,1676
|
6
6
|
kalavai_client/assets/docker-compose-gui.yaml,sha256=oE-neG3HC2PhdH-mIxrZdQlhqnycrSP_p8fRxjaxDFE,192
|
7
7
|
kalavai_client/assets/docker-compose-template.yaml,sha256=ii24Nn-dM5cZk9lxFgrzxnmK7yv_6kIIw7KUlWhvYeI,2831
|
@@ -11,15 +11,15 @@ kalavai_client/assets/pool_config_values.yaml,sha256=VrM3XHQfQo6QLZ68qvagooUptaY
|
|
11
11
|
kalavai_client/assets/user_workspace.yaml,sha256=wDvlMYknOPABAEo0dsQwU7bac8iubjAG9tdkFbJZ5Go,476
|
12
12
|
kalavai_client/assets/user_workspace_values.yaml,sha256=G0HOzQUxrDMCwuW9kbWUZaKMzDDPVwDwzBHCL2Xi2ZM,542
|
13
13
|
kalavai_client/auth.py,sha256=QsBh28L2LwjBBK6pTUE4Xu36lLDTyetyU1YfS1Hbb6g,1717
|
14
|
-
kalavai_client/bridge_api.py,sha256=
|
15
|
-
kalavai_client/bridge_models.py,sha256=
|
16
|
-
kalavai_client/cli.py,sha256=
|
14
|
+
kalavai_client/bridge_api.py,sha256=vhkwgVOm0ZoKVz1dr-SGPQ7uMp-XPdhyzLJfKI2nsuc,5245
|
15
|
+
kalavai_client/bridge_models.py,sha256=mEDdqUcK9BtijLpNo20HXuYdVccn4895hPzejSv666A,798
|
16
|
+
kalavai_client/cli.py,sha256=U6Z4ESwV0L2jnKmpzEC4fKTcmrlYo4K0k9kSwUeiWL4,47700
|
17
17
|
kalavai_client/cluster.py,sha256=gwjmdsd--YrffT0BmZDOEpbrdm3lPskUuN5jdgcrOR0,12947
|
18
|
-
kalavai_client/core.py,sha256=
|
18
|
+
kalavai_client/core.py,sha256=fhKRW5EAFwKUFdswgcuEzbSpyHAfIOrGkyghq04ckj8,31078
|
19
19
|
kalavai_client/env.py,sha256=Zg2pP-xGJpQumo56KMBxBLgIsBmcNN0S9R-ZP2-s630,2604
|
20
20
|
kalavai_client/utils.py,sha256=rz5W9PRZrTpgdmOs6yeqUi4f_q_L-3BJ5g1o7Asgnyo,13386
|
21
|
-
kalavai_client-0.5.
|
22
|
-
kalavai_client-0.5.
|
23
|
-
kalavai_client-0.5.
|
24
|
-
kalavai_client-0.5.
|
25
|
-
kalavai_client-0.5.
|
21
|
+
kalavai_client-0.5.26.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
22
|
+
kalavai_client-0.5.26.dist-info/METADATA,sha256=XlK_eljvXmKS6L2-XtvPzAuwCG6bVHZGPFEBifAOjlE,14443
|
23
|
+
kalavai_client-0.5.26.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
24
|
+
kalavai_client-0.5.26.dist-info/entry_points.txt,sha256=9T6D45gxwzfVbglMm1r6XPdXuuZdHfy_7fCeu2jUphc,50
|
25
|
+
kalavai_client-0.5.26.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|