kalavai-client 0.5.25__py3-none-any.whl → 0.5.27__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/bridge_api.py +29 -5
- kalavai_client/bridge_models.py +7 -2
- kalavai_client/cli.py +54 -85
- kalavai_client/core.py +87 -13
- kalavai_client/utils.py +18 -2
- {kalavai_client-0.5.25.dist-info → kalavai_client-0.5.27.dist-info}/METADATA +1 -1
- {kalavai_client-0.5.25.dist-info → kalavai_client-0.5.27.dist-info}/RECORD +11 -11
- {kalavai_client-0.5.25.dist-info → kalavai_client-0.5.27.dist-info}/LICENSE +0 -0
- {kalavai_client-0.5.25.dist-info → kalavai_client-0.5.27.dist-info}/WHEEL +0 -0
- {kalavai_client-0.5.25.dist-info → kalavai_client-0.5.27.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.27"
|
kalavai_client/bridge_api.py
CHANGED
@@ -7,17 +7,19 @@ import uvicorn
|
|
7
7
|
|
8
8
|
from kalavai_client.bridge_models import (
|
9
9
|
CreatePoolRequest,
|
10
|
+
InvitesRequest,
|
10
11
|
JoinPoolRequest,
|
11
12
|
StopPoolRequest,
|
12
13
|
DeployJobRequest,
|
13
14
|
DeleteJobRequest,
|
14
15
|
JobDetailsRequest,
|
15
|
-
|
16
|
+
NodesActionRequest
|
16
17
|
)
|
17
18
|
from kalavai_client.core import (
|
18
19
|
create_pool,
|
19
20
|
join_pool,
|
20
21
|
attach_to_pool,
|
22
|
+
send_invites,
|
21
23
|
stop_pool,
|
22
24
|
fetch_devices,
|
23
25
|
fetch_resources,
|
@@ -41,6 +43,8 @@ from kalavai_client.core import (
|
|
41
43
|
get_ip_addresses,
|
42
44
|
get_pool_token,
|
43
45
|
delete_nodes,
|
46
|
+
cordon_nodes,
|
47
|
+
uncordon_nodes,
|
44
48
|
TokenType
|
45
49
|
)
|
46
50
|
|
@@ -55,7 +59,9 @@ def pool_create(request: CreatePoolRequest):
|
|
55
59
|
num_gpus=request.num_gpus,
|
56
60
|
node_name=request.node_name,
|
57
61
|
only_registered_users=request.only_registered_users,
|
58
|
-
location=request.location
|
62
|
+
location=request.location,
|
63
|
+
description=request.description,
|
64
|
+
token_mode=request.token_mode
|
59
65
|
)
|
60
66
|
return result
|
61
67
|
|
@@ -85,21 +91,39 @@ def pool_stop(request: StopPoolRequest):
|
|
85
91
|
return result
|
86
92
|
|
87
93
|
@app.post("/delete_nodes")
|
88
|
-
def device_delete(request:
|
94
|
+
def device_delete(request: NodesActionRequest):
|
89
95
|
result = delete_nodes(
|
90
96
|
nodes=request.nodes
|
91
97
|
)
|
92
98
|
return result
|
93
99
|
|
100
|
+
@app.post("/cordon_nodes")
|
101
|
+
def device_cordon(request: NodesActionRequest):
|
102
|
+
result = cordon_nodes(
|
103
|
+
nodes=request.nodes
|
104
|
+
)
|
105
|
+
return result
|
106
|
+
|
107
|
+
@app.post("/uncordon_nodes")
|
108
|
+
def device_uncordon(request: NodesActionRequest):
|
109
|
+
result = uncordon_nodes(
|
110
|
+
nodes=request.nodes
|
111
|
+
)
|
112
|
+
return result
|
113
|
+
|
94
114
|
@app.get("/get_pool_token")
|
95
|
-
def
|
115
|
+
def get_token(mode: int):
|
96
116
|
|
97
117
|
return get_pool_token(mode=TokenType(mode))
|
98
118
|
|
99
119
|
@app.get("/fetch_devices")
|
100
|
-
def
|
120
|
+
def get_devices():
|
101
121
|
return fetch_devices()
|
102
122
|
|
123
|
+
@app.post("/send_pool_invites")
|
124
|
+
def send_pool_invites(request: InvitesRequest):
|
125
|
+
return send_invites(invitees=request.invitees)
|
126
|
+
|
103
127
|
@app.get("/fetch_resources")
|
104
128
|
def resources():
|
105
129
|
return fetch_resources()
|
kalavai_client/bridge_models.py
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
from pydantic import BaseModel
|
2
2
|
|
3
|
-
from kalavai_client.core import Job
|
3
|
+
from kalavai_client.core import Job, TokenType
|
4
4
|
|
5
5
|
|
6
|
+
class InvitesRequest(BaseModel):
|
7
|
+
invitees: list[str]
|
8
|
+
|
6
9
|
class CreatePoolRequest(BaseModel):
|
7
10
|
cluster_name: str
|
8
11
|
ip_address: str
|
@@ -11,8 +14,10 @@ class CreatePoolRequest(BaseModel):
|
|
11
14
|
node_name: str = None
|
12
15
|
only_registered_users: bool = False
|
13
16
|
location: str = None
|
17
|
+
token_mode: TokenType = TokenType.USER
|
18
|
+
description: str = ""
|
14
19
|
|
15
|
-
class
|
20
|
+
class NodesActionRequest(BaseModel):
|
16
21
|
nodes: list[str]
|
17
22
|
|
18
23
|
class JoinPoolRequest(BaseModel):
|
kalavai_client/cli.py
CHANGED
@@ -51,10 +51,15 @@ from kalavai_client.core import (
|
|
51
51
|
create_pool,
|
52
52
|
get_ip_addresses,
|
53
53
|
pause_agent,
|
54
|
+
register_pool,
|
54
55
|
resume_agent,
|
55
56
|
get_pool_token,
|
56
57
|
delete_nodes,
|
57
|
-
|
58
|
+
cordon_nodes,
|
59
|
+
stop_pool,
|
60
|
+
uncordon_nodes,
|
61
|
+
TokenType,
|
62
|
+
unregister_pool
|
58
63
|
)
|
59
64
|
from kalavai_client.utils import (
|
60
65
|
check_gpu_drivers,
|
@@ -127,27 +132,6 @@ def pre_join_check(node_name, server_url, server_key):
|
|
127
132
|
except Exception as e:
|
128
133
|
console.log(f"[red]Error when connecting to kalavai service: {str(e)}")
|
129
134
|
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
135
|
|
152
136
|
def select_ip_address(subnet=None):
|
153
137
|
ips = get_ip_addresses(subnet=subnet)
|
@@ -223,7 +207,7 @@ def input_gpus():
|
|
223
207
|
##################
|
224
208
|
|
225
209
|
@arguably.command
|
226
|
-
def gui__start(*others, backend_only=False, gui_frontend_port=3000, gui_backend_port=8000, bridge_port=8001):
|
210
|
+
def gui__start(*others, backend_only=False, gui_frontend_port=3000, gui_backend_port=8000, bridge_port=8001, log_level="critical"):
|
227
211
|
"""Run GUI (docker) and kalavai core backend (api)"""
|
228
212
|
|
229
213
|
if not backend_only:
|
@@ -241,7 +225,7 @@ def gui__start(*others, backend_only=False, gui_frontend_port=3000, gui_backend_
|
|
241
225
|
run_cmd(f"docker compose --file {USER_GUI_COMPOSE_FILE} up -d")
|
242
226
|
|
243
227
|
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)
|
228
|
+
run_api(port=bridge_port, log_level=log_level)
|
245
229
|
|
246
230
|
if not backend_only:
|
247
231
|
run_cmd(f"docker compose --file {USER_GUI_COMPOSE_FILE} down")
|
@@ -305,7 +289,7 @@ def location__list(*others):
|
|
305
289
|
console.log(table)
|
306
290
|
|
307
291
|
@arguably.command
|
308
|
-
def pool__publish(*others, description=None):
|
292
|
+
def pool__publish(*others, description=None, is_private=True):
|
309
293
|
"""
|
310
294
|
[AUTH] Publish pool to Kalavai platform, where other users may be able to join
|
311
295
|
"""
|
@@ -319,26 +303,29 @@ def pool__publish(*others, description=None):
|
|
319
303
|
console.log(f"[red]Problems with your pool: {str(e)}")
|
320
304
|
return
|
321
305
|
choices = select_token_type()
|
322
|
-
|
306
|
+
if choices["admin"]:
|
307
|
+
mode = TokenType.ADMIN
|
308
|
+
elif choices["user"]:
|
309
|
+
mode = TokenType.USER
|
310
|
+
else:
|
311
|
+
mode = TokenType.WORKER
|
323
312
|
|
324
313
|
if description is None:
|
325
314
|
console.log("[yellow] [Markdown] In a few words (max 500 chars), describe your goals with this cluster. Remember, this is what other users will see to decide whether to share their resources with you, [blue]so inspire them!")
|
326
|
-
description = input(f"(You can edit this later
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
console.log(f"[green]Your cluster is now
|
340
|
-
except Exception as e:
|
341
|
-
console.log(f"[red]Error when publishing cluster. {str(e)}")
|
315
|
+
description = input(f"(You can edit this later at {KALAVAI_PLATFORM_URL}\n")
|
316
|
+
cluster_name = load_server_info(data_key=CLUSTER_NAME_KEY, file=USER_LOCAL_SERVER_FILE)
|
317
|
+
|
318
|
+
result = register_pool(
|
319
|
+
cluster_name=cluster_name,
|
320
|
+
token_mode=mode,
|
321
|
+
description=description,
|
322
|
+
is_private=is_private
|
323
|
+
)
|
324
|
+
|
325
|
+
if "error" in result:
|
326
|
+
console.log(f"[red]Error when publishing cluster: {result['error']}")
|
327
|
+
else:
|
328
|
+
console.log(f"[green]Your cluster is now registered with {KALAVAI_PLATFORM_URL}")
|
342
329
|
|
343
330
|
@arguably.command
|
344
331
|
def pool__unpublish(cluster_name=None, *others):
|
@@ -354,15 +341,13 @@ def pool__unpublish(cluster_name=None, *others):
|
|
354
341
|
console.log(f"[red]Problems with your pool: {str(e)}")
|
355
342
|
return
|
356
343
|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
344
|
+
result = unregister_pool()
|
345
|
+
if "error" in result:
|
346
|
+
console.log(f"[red]{result['error']}")
|
347
|
+
elif "warning" in result:
|
348
|
+
console.log(f"[yellow]{result['warning']}")
|
349
|
+
else:
|
363
350
|
console.log(f"[green]Your cluster has been removed from {KALAVAI_PLATFORM_URL}")
|
364
|
-
except Exception as e:
|
365
|
-
console.log(f"[red]Error when unpublishing cluster. {str(e)}")
|
366
351
|
|
367
352
|
@arguably.command
|
368
353
|
def pool__list(*others, user_only=False):
|
@@ -430,6 +415,9 @@ def pool__start(cluster_name, *others, only_registered_users: bool=False, ip_ad
|
|
430
415
|
location=location
|
431
416
|
)
|
432
417
|
|
418
|
+
if "warning" in result:
|
419
|
+
console.log(f"[yellow]Warning: {result['warning']}")
|
420
|
+
|
433
421
|
if "error" in result:
|
434
422
|
console.log(f"[red]{result}")
|
435
423
|
|
@@ -539,38 +527,13 @@ def pool__stop(*others, skip_node_deletion=False):
|
|
539
527
|
*others: all the other positional arguments go here
|
540
528
|
"""
|
541
529
|
console.log("[white] Stopping kalavai app...")
|
542
|
-
# delete local node from server
|
543
|
-
if not skip_node_deletion:
|
544
|
-
node__delete(load_server_info(data_key=NODE_NAME_KEY, file=USER_LOCAL_SERVER_FILE))
|
545
|
-
# unpublish event (only if seed node)
|
546
|
-
# TODO: no, this should be done via the platform!!!
|
547
|
-
# try:
|
548
|
-
# if CLUSTER.is_seed_node():
|
549
|
-
# console.log("Unregistering pool...")
|
550
|
-
# unregister_cluster(
|
551
|
-
# name=load_server_info(data_key=CLUSTER_NAME_KEY, file=USER_LOCAL_SERVER_FILE),
|
552
|
-
# user_cookie=USER_COOKIE)
|
553
|
-
# except Exception as e:
|
554
|
-
# console.log(f"[red][WARNING]: (ignore if not a public pool) Error when unpublishing cluster. {str(e)}")
|
555
|
-
# remove local node agent
|
556
|
-
console.log("Removing agent and local cache")
|
557
|
-
|
558
|
-
# disconnect from VPN first, then remove agent, then remove local files
|
559
|
-
console.log("Disconnecting from VPN...")
|
560
|
-
try:
|
561
|
-
vpns = leave_vpn(container_name=DEFAULT_VPN_CONTAINER_NAME)
|
562
|
-
if vpns is not None:
|
563
|
-
for vpn in vpns:
|
564
|
-
console.log(f"You have left {vpn} VPN")
|
565
|
-
except:
|
566
|
-
# no vpn
|
567
|
-
pass
|
568
530
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
531
|
+
result = stop_pool(skip_node_deletion=skip_node_deletion)
|
532
|
+
if "error" in result:
|
533
|
+
console.log(f"[red]{result['error']}")
|
534
|
+
else:
|
535
|
+
console.log(result)
|
536
|
+
console.log("[white] Kalavai has stopped sharing your resources. Use [yellow]kalavai pool start[white] or [yellow]kalavai pool join[white] to start again!")
|
574
537
|
|
575
538
|
@arguably.command
|
576
539
|
def pool__pause(*others):
|
@@ -958,8 +921,11 @@ def node__cordon(node_name, *others):
|
|
958
921
|
except Exception as e:
|
959
922
|
console.log(f"[red]Problems with your pool: {str(e)}")
|
960
923
|
return
|
961
|
-
|
962
|
-
|
924
|
+
result = cordon_nodes(nodes=[node_name])
|
925
|
+
if "error" in result:
|
926
|
+
console.log(f"[red]{result['error']}")
|
927
|
+
else:
|
928
|
+
console.log(result)
|
963
929
|
|
964
930
|
@arguably.command
|
965
931
|
def node__uncordon(node_name, *others):
|
@@ -971,8 +937,11 @@ def node__uncordon(node_name, *others):
|
|
971
937
|
except Exception as e:
|
972
938
|
console.log(f"[red]Problems with your pool: {str(e)}")
|
973
939
|
return
|
974
|
-
|
975
|
-
|
940
|
+
result = uncordon_nodes(nodes=[node_name])
|
941
|
+
if "error" in result:
|
942
|
+
console.log(f"[red]{result['error']}")
|
943
|
+
else:
|
944
|
+
console.log(result)
|
976
945
|
|
977
946
|
@arguably.command
|
978
947
|
def job__templates(*others):
|
kalavai_client/core.py
CHANGED
@@ -9,15 +9,19 @@ import netifaces as ni
|
|
9
9
|
from typing import Optional
|
10
10
|
from pydantic import BaseModel
|
11
11
|
from enum import Enum
|
12
|
+
import re
|
12
13
|
|
13
14
|
from kalavai_client.cluster import CLUSTER
|
14
15
|
from kalavai_client.utils import (
|
15
16
|
check_gpu_drivers,
|
16
17
|
generate_join_token,
|
18
|
+
register_cluster,
|
17
19
|
request_to_server,
|
18
20
|
load_server_info,
|
19
21
|
decode_dict,
|
20
22
|
get_vpn_details,
|
23
|
+
send_pool_invite,
|
24
|
+
unregister_cluster,
|
21
25
|
validate_join_public_seed,
|
22
26
|
generate_compose_config,
|
23
27
|
store_server_info,
|
@@ -98,6 +102,30 @@ class TokenType(Enum):
|
|
98
102
|
WORKER = 2
|
99
103
|
|
100
104
|
|
105
|
+
def set_schedulable(schedulable, node_names):
|
106
|
+
"""
|
107
|
+
Delete job in the cluster
|
108
|
+
"""
|
109
|
+
# deploy template with kube-watcher
|
110
|
+
data = {
|
111
|
+
"schedulable": str(schedulable),
|
112
|
+
"node_names": node_names
|
113
|
+
}
|
114
|
+
try:
|
115
|
+
res = request_to_server(
|
116
|
+
method="post",
|
117
|
+
endpoint="/v1/set_node_schedulable",
|
118
|
+
data=data,
|
119
|
+
server_creds=USER_LOCAL_SERVER_FILE,
|
120
|
+
user_cookie=USER_COOKIE
|
121
|
+
)
|
122
|
+
if res is not None and "detail" in res:
|
123
|
+
return {"error": res["detail"]}
|
124
|
+
else:
|
125
|
+
return {"result": res}
|
126
|
+
except Exception as e:
|
127
|
+
return {"error": f"Error when connecting to kalavai service: {str(e)}"}
|
128
|
+
|
101
129
|
def init_user_workspace(force_namespace=None):
|
102
130
|
|
103
131
|
# load template config and populate with values
|
@@ -495,6 +523,12 @@ def delete_nodes(nodes):
|
|
495
523
|
except Exception as e:
|
496
524
|
return {"error": f"Error when removing nodes {nodes}: {str(e)}"}
|
497
525
|
|
526
|
+
def cordon_nodes(nodes):
|
527
|
+
return set_schedulable(schedulable=False, node_names=nodes)
|
528
|
+
|
529
|
+
def uncordon_nodes(nodes):
|
530
|
+
return set_schedulable(schedulable=True, node_names=nodes)
|
531
|
+
|
498
532
|
def attach_to_pool(token, node_name=None):
|
499
533
|
if node_name is None:
|
500
534
|
node_name = f"{socket.gethostname()}-{uuid.uuid4().hex[:6]}"
|
@@ -673,7 +707,7 @@ def join_pool(token, num_gpus=None, node_name=None, ip_address=None):
|
|
673
707
|
|
674
708
|
return cluster_name
|
675
709
|
|
676
|
-
def create_pool(cluster_name: str, ip_address: str, app_values: str=None, pool_config_values: str=None, num_gpus: int=0, node_name: str=None, only_registered_users: bool=False, location: str=None):
|
710
|
+
def create_pool(cluster_name: str, ip_address: str, description: str="", token_mode: TokenType=TokenType.USER, app_values: str=None, pool_config_values: str=None, num_gpus: int=0, node_name: str=None, only_registered_users: bool=False, location: str=None):
|
677
711
|
|
678
712
|
if not check_seed_compatibility():
|
679
713
|
return {"error": "Requirements failed"}
|
@@ -799,6 +833,18 @@ def create_pool(cluster_name: str, ip_address: str, app_values: str=None, pool_c
|
|
799
833
|
# init user namespace
|
800
834
|
init_user_workspace()
|
801
835
|
|
836
|
+
# register cluster (if user is logged in)
|
837
|
+
result = register_pool(
|
838
|
+
cluster_name=cluster_name,
|
839
|
+
description=description,
|
840
|
+
is_private=True,
|
841
|
+
token_mode=token_mode)
|
842
|
+
|
843
|
+
if "error" in result:
|
844
|
+
return {"warning": result["error"]}
|
845
|
+
if "warning" in result:
|
846
|
+
return {"warning": result["warning"]}
|
847
|
+
|
802
848
|
return {"success"}
|
803
849
|
|
804
850
|
def get_pool_token(mode: TokenType):
|
@@ -857,6 +903,33 @@ def pool_init(pool_config_values_path=None):
|
|
857
903
|
return result
|
858
904
|
except Exception as e:
|
859
905
|
return {"error": f"[red]Error when connecting to kalavai service: {str(e)}"}
|
906
|
+
|
907
|
+
def register_pool(cluster_name, description, is_private=True, token_mode=TokenType.USER):
|
908
|
+
token = get_pool_token(mode=token_mode)["token"]
|
909
|
+
valid = check_token(token=token, public=not is_private)
|
910
|
+
if "error" in valid:
|
911
|
+
return {"error": valid}
|
912
|
+
try:
|
913
|
+
result = register_cluster(
|
914
|
+
name=cluster_name,
|
915
|
+
token=token,
|
916
|
+
description=description,
|
917
|
+
user_cookie=USER_COOKIE,
|
918
|
+
is_private=is_private)
|
919
|
+
|
920
|
+
return {"success": result}
|
921
|
+
except Exception as e:
|
922
|
+
return {"warning": str(e)}
|
923
|
+
|
924
|
+
def unregister_pool():
|
925
|
+
cluster_name = load_server_info(data_key=CLUSTER_NAME_KEY, file=USER_LOCAL_SERVER_FILE)
|
926
|
+
try:
|
927
|
+
unregister_cluster(
|
928
|
+
name=cluster_name,
|
929
|
+
user_cookie=USER_COOKIE)
|
930
|
+
except Exception as e:
|
931
|
+
return {"warning": str(e)}
|
932
|
+
return {"success"}
|
860
933
|
|
861
934
|
def is_connected():
|
862
935
|
if not os.path.isfile(USER_LOCAL_SERVER_FILE):
|
@@ -927,16 +1000,8 @@ def stop_pool(skip_node_deletion=False):
|
|
927
1000
|
delete_node(load_server_info(data_key=NODE_NAME_KEY, file=USER_LOCAL_SERVER_FILE))
|
928
1001
|
)
|
929
1002
|
# unpublish event (only if seed node)
|
930
|
-
|
931
|
-
|
932
|
-
# if CLUSTER.is_seed_node():
|
933
|
-
# console.log("Unregistering pool...")
|
934
|
-
# unregister_cluster(
|
935
|
-
# name=load_server_info(data_key=CLUSTER_NAME_KEY, file=USER_LOCAL_SERVER_FILE),
|
936
|
-
# user_cookie=USER_COOKIE)
|
937
|
-
# except Exception as e:
|
938
|
-
# console.log(f"[red][WARNING]: (ignore if not a public pool) Error when unpublishing cluster. {str(e)}")
|
939
|
-
# remove local node agent
|
1003
|
+
if CLUSTER.is_seed_node():
|
1004
|
+
unregister_pool()
|
940
1005
|
|
941
1006
|
# disconnect from VPN first, then remove agent, then remove local files
|
942
1007
|
try:
|
@@ -948,13 +1013,22 @@ def stop_pool(skip_node_deletion=False):
|
|
948
1013
|
# no vpn
|
949
1014
|
pass
|
950
1015
|
|
1016
|
+
# remove local node agent
|
951
1017
|
CLUSTER.remove_agent()
|
952
1018
|
|
953
1019
|
# clean local files
|
954
1020
|
cleanup_local()
|
955
1021
|
|
956
|
-
return logs
|
1022
|
+
return {"logs": logs}
|
957
1023
|
|
958
1024
|
def list_available_pools(user_only=False):
|
959
1025
|
pools = get_public_seeds(user_only=user_only, user_cookie=USER_COOKIE)
|
960
|
-
return pools
|
1026
|
+
return pools
|
1027
|
+
|
1028
|
+
def send_invites(invitees):
|
1029
|
+
result = send_pool_invite(
|
1030
|
+
cluster_name=load_server_info(data_key=CLUSTER_NAME_KEY, file=USER_LOCAL_SERVER_FILE),
|
1031
|
+
invitee_addresses=invitees,
|
1032
|
+
user_cookie=USER_COOKIE
|
1033
|
+
)
|
1034
|
+
return result
|
kalavai_client/utils.py
CHANGED
@@ -206,7 +206,7 @@ def get_vpn_details(location, user_cookie):
|
|
206
206
|
)
|
207
207
|
return vpn
|
208
208
|
|
209
|
-
def register_cluster(name, token, description, user_cookie):
|
209
|
+
def register_cluster(name, token, description, user_cookie, is_private=True):
|
210
210
|
auth = KalavaiAuthClient(
|
211
211
|
user_cookie_file=user_cookie
|
212
212
|
)
|
@@ -218,7 +218,8 @@ def register_cluster(name, token, description, user_cookie):
|
|
218
218
|
name,
|
219
219
|
user,
|
220
220
|
description,
|
221
|
-
token
|
221
|
+
token,
|
222
|
+
is_private
|
222
223
|
)
|
223
224
|
return seed
|
224
225
|
|
@@ -251,6 +252,21 @@ def validate_join_public_seed(cluster_name, join_key, user_cookie):
|
|
251
252
|
)
|
252
253
|
return seed
|
253
254
|
|
255
|
+
def send_pool_invite(cluster_name, invitee_addresses, user_cookie):
|
256
|
+
auth = KalavaiAuthClient(
|
257
|
+
user_cookie_file=user_cookie
|
258
|
+
)
|
259
|
+
if not auth.is_logged_in():
|
260
|
+
raise ValueError("Cannot notify join cluster, user is not authenticated")
|
261
|
+
user = auth.load_user_session()
|
262
|
+
result = auth.call_function(
|
263
|
+
"send_pool_invite",
|
264
|
+
user,
|
265
|
+
cluster_name,
|
266
|
+
invitee_addresses
|
267
|
+
)
|
268
|
+
return result
|
269
|
+
|
254
270
|
def validate_poolconfig(poolconfig_file):
|
255
271
|
if not Path(poolconfig_file).is_file():
|
256
272
|
return False
|
@@ -1,4 +1,4 @@
|
|
1
|
-
kalavai_client/__init__.py,sha256=
|
1
|
+
kalavai_client/__init__.py,sha256=Wek6gRlCzMJXNHhlUntIAj24wWPV3k64gGvcy5WL7rU,23
|
2
2
|
kalavai_client/__main__.py,sha256=WQUfxvRsBJH5gsCJg8pLz95QnZIj7Ol8psTO77m0QE0,73
|
3
3
|
kalavai_client/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
kalavai_client/assets/apps.yaml,sha256=d13TzkWtqdwpWOxuoG7eG0Jp0UhVUsboS28496H8iH4,5982
|
@@ -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=rXTz6WpzQtsDmBDUUOqPEjWx8vfiIWEfvP1iM4MYDGM,5501
|
15
|
+
kalavai_client/bridge_models.py,sha256=WwGIaWBIk4s32YemgDB2CcrrCWC-KeZjTT3iBi-kaa0,936
|
16
|
+
kalavai_client/cli.py,sha256=zQ205vqPW69oEt9EAO5wC8_yEvWbFEtLUnI90Oqt4t4,46642
|
17
17
|
kalavai_client/cluster.py,sha256=gwjmdsd--YrffT0BmZDOEpbrdm3lPskUuN5jdgcrOR0,12947
|
18
|
-
kalavai_client/core.py,sha256=
|
18
|
+
kalavai_client/core.py,sha256=Trv2DDdlBAsBYUaTKnosWrfboYRrZnRcv-jfvmG7-LU,32288
|
19
19
|
kalavai_client/env.py,sha256=Zg2pP-xGJpQumo56KMBxBLgIsBmcNN0S9R-ZP2-s630,2604
|
20
|
-
kalavai_client/utils.py,sha256=
|
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.
|
20
|
+
kalavai_client/utils.py,sha256=OPmrsycNyrs2ZpTsjAzBuPN8hQNJtsYDLPKU13tnf-U,13862
|
21
|
+
kalavai_client-0.5.27.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
22
|
+
kalavai_client-0.5.27.dist-info/METADATA,sha256=5-vseYyG7Ya57UyFAqdEabXKGoFrzTMRnJgPb6FRZ6Q,14443
|
23
|
+
kalavai_client-0.5.27.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
24
|
+
kalavai_client-0.5.27.dist-info/entry_points.txt,sha256=9T6D45gxwzfVbglMm1r6XPdXuuZdHfy_7fCeu2jUphc,50
|
25
|
+
kalavai_client-0.5.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|