kalavai-client 0.5.10__tar.gz → 0.5.12__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) hide show
  1. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/PKG-INFO +1 -1
  2. kalavai_client-0.5.12/kalavai_client/__init__.py +2 -0
  3. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/apps.yaml +1 -1
  4. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/docker-compose-template.yaml +2 -1
  5. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/cli.py +73 -11
  6. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/utils.py +5 -2
  7. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/pyproject.toml +1 -1
  8. kalavai_client-0.5.10/kalavai_client/__init__.py +0 -2
  9. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/LICENSE +0 -0
  10. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/README.md +0 -0
  11. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/__main__.py +0 -0
  12. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/__init__.py +0 -0
  13. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/apps_values.yaml +0 -0
  14. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/nginx.conf +0 -0
  15. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/pool_config_template.yaml +0 -0
  16. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/pool_config_values.yaml +0 -0
  17. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/user_workspace.yaml +0 -0
  18. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/assets/user_workspace_values.yaml +0 -0
  19. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/auth.py +0 -0
  20. {kalavai_client-0.5.10 → kalavai_client-0.5.12}/kalavai_client/cluster.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kalavai-client
3
- Version: 0.5.10
3
+ Version: 0.5.12
4
4
  Summary: Client app for kalavai platform
5
5
  License: Apache-2.0
6
6
  Keywords: LLM,platform
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = "0.5.12"
@@ -139,7 +139,7 @@ releases:
139
139
  - name: replicas
140
140
  value: 2
141
141
  - name: image_tag
142
- value: "v2025.01"
142
+ value: "v2025.01.1"
143
143
  - name: deployment.in_cluster
144
144
  value: "True"
145
145
  - name: deployment.use_auth_key
@@ -1,8 +1,9 @@
1
1
  services:
2
2
  {% if vpn %}
3
3
  {{vpn_name}}:
4
- image: gravitl/netclient:v0.30.0
4
+ image: gravitl/netclient:v0.24.3
5
5
  container_name: {{vpn_name}}
6
+ #privileged: true
6
7
  cap_add:
7
8
  - NET_ADMIN
8
9
  - SYS_MODULE
@@ -337,18 +337,19 @@ def select_token_type():
337
337
  break
338
338
  return {"admin": choice == 0, "user": choice == 1, "worker": choice == 2}
339
339
 
340
- def generate_compose_config(role, node_name, is_public, node_labels=None, pool_ip=None, vpn_token=None, pool_token=None):
340
+ def generate_compose_config(role, node_name, is_public, use_gpus=True, node_labels=None, pool_ip=None, vpn_token=None, pool_token=None):
341
341
  num_gpus = 0
342
- try:
343
- has_gpus = check_gpu_drivers()
344
- if has_gpus:
345
- max_gpus = int(run_cmd("nvidia-smi -L | wc -l").decode())
346
- num_gpus = user_confirm(
347
- question=f"{max_gpus} NVIDIA GPU(s) detected. How many GPUs would you like to include?",
348
- options=range(max_gpus+1)
349
- )
350
- except:
351
- console.log(f"[red]WARNING: error when fetching NVIDIA GPU info. GPUs will not be used on this local machine")
342
+ if use_gpus:
343
+ try:
344
+ has_gpus = check_gpu_drivers()
345
+ if has_gpus:
346
+ max_gpus = int(run_cmd("nvidia-smi -L | wc -l").decode())
347
+ num_gpus = user_confirm(
348
+ question=f"{max_gpus} NVIDIA GPU(s) detected. How many GPUs would you like to include?",
349
+ options=range(max_gpus+1)
350
+ )
351
+ except:
352
+ console.log(f"[red]WARNING: error when fetching NVIDIA GPU info. GPUs will not be used on this local machine")
352
353
  if node_labels is not None:
353
354
  node_labels = " ".join([f"--node-label {key}={value}" for key, value in node_labels.items()])
354
355
  compose_values = {
@@ -1102,6 +1103,10 @@ def pool__attach(token, *others, node_name=None):
1102
1103
  """
1103
1104
  Set creds in token on the local instance
1104
1105
  """
1106
+
1107
+ if node_name is None:
1108
+ node_name = socket.gethostname()
1109
+
1105
1110
  # check that is not attached to another instance
1106
1111
  if os.path.exists(USER_LOCAL_SERVER_FILE):
1107
1112
  option = user_confirm(
@@ -1160,6 +1165,7 @@ def pool__attach(token, *others, node_name=None):
1160
1165
 
1161
1166
  # Generate docker compose recipe
1162
1167
  generate_compose_config(
1168
+ use_gpus=False,
1163
1169
  role="",
1164
1170
  vpn_token=vpn["key"],
1165
1171
  node_name=node_name,
@@ -1510,6 +1516,62 @@ def job__run(template_name, *others, values: str=None, force_namespace: str=None
1510
1516
  console.log(f"[red]Error when connecting to kalavai service: {str(e)}")
1511
1517
  return
1512
1518
 
1519
+ @arguably.command
1520
+ def job__test(local_template_dir, *others, values, defaults, force_namespace: str=None):
1521
+ """
1522
+ Helper to test local templates, useful for development
1523
+ """
1524
+ try:
1525
+ CLUSTER.validate_cluster()
1526
+ except Exception as e:
1527
+ console.log(f"[red]Problems with your pool: {str(e)}")
1528
+ return
1529
+
1530
+ if not os.path.isdir(local_template_dir):
1531
+ console.log(f"[red]--local_template_dir ({local_template_dir}) is not a directory")
1532
+ return
1533
+
1534
+ # load template
1535
+ with open(os.path.join(local_template_dir, "template.yaml"), "r") as f:
1536
+ template_str = f.read()
1537
+
1538
+ # load values
1539
+ if not os.path.isfile(values):
1540
+ console.log(f"[red]--values ({values}) is not a valid local file")
1541
+ return
1542
+ with open(values, "r") as f:
1543
+ values_dict = yaml.safe_load(f)
1544
+ # load defaults
1545
+ if not os.path.isfile(defaults):
1546
+ console.log(f"[red]--defaults ({defaults}) is not a valid local file")
1547
+ return
1548
+ with open(defaults, "r") as f:
1549
+ defaults = f.read()
1550
+
1551
+ # submit custom deployment
1552
+ data = {
1553
+ "template": template_str,
1554
+ "template_values": values_dict,
1555
+ "default_values": defaults
1556
+ }
1557
+ if force_namespace is not None:
1558
+ data["force_namespace"] = force_namespace
1559
+
1560
+ try:
1561
+ result = request_to_server(
1562
+ method="post",
1563
+ endpoint="/v1/deploy_custom_job",
1564
+ data=data,
1565
+ server_creds=USER_LOCAL_SERVER_FILE,
1566
+ user_cookie=USER_COOKIE
1567
+ )
1568
+ console.log("Deployment result:")
1569
+ print(
1570
+ json.dumps(result,indent=3)
1571
+ )
1572
+ except Exception as e:
1573
+ console.log(f"[red]Error when connecting to kalavai service: {str(e)}")
1574
+
1513
1575
 
1514
1576
  @arguably.command
1515
1577
  def job__defaults(template_name, *others):
@@ -284,8 +284,11 @@ def request_to_server(
284
284
  json=data,
285
285
  headers=headers
286
286
  )
287
- result = response.json()
288
- return result
287
+ try:
288
+ result = response.json()
289
+ return result
290
+ except Exception as e:
291
+ raise ValueError(f"Error with HTTP request: {response.text}\n{str(e)}")
289
292
 
290
293
 
291
294
  def generate_table(columns, rows, end_sections=None):
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "kalavai-client"
3
- version = "0.5.10"
3
+ version = "0.5.12"
4
4
  authors = [
5
5
  {name = "Carlos Fernandez Musoles", email = "carlos@kalavai.net"}
6
6
  ]
@@ -1,2 +0,0 @@
1
-
2
- __version__ = "0.5.10"
File without changes