matrice-compute 0.1.44__py3-none-any.whl → 0.1.46__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.
@@ -1,24 +1,35 @@
1
1
  """Module providing __init__ functionality."""
2
2
 
3
+ import os
3
4
  import subprocess
4
5
  import logging
5
6
 
6
7
  from matrice_common.utils import dependencies_check
7
8
 
8
- dependencies_check(
9
- ["docker", "psutil", "cryptography", "notebook", "aiohttp", "kafka-python"]
10
- )
9
+ # Check execution mode to determine which dependencies to verify
10
+ execution_mode = os.environ.get("EXECUTION_MODE", "vm").lower()
11
11
 
12
- subprocess.run( # Re-upgrade docker to avoid missing DOCKER_HOST connection error
13
- ["pip", "install", "--upgrade", "docker"],
14
- check=True,
15
- stdout=subprocess.DEVNULL, # suppress normal output
16
- stderr=subprocess.DEVNULL # suppress warnings/progress
17
- )
12
+ if execution_mode == "kubernetes":
13
+ # Kubernetes mode - only check K8s-related dependencies
14
+ dependencies_check(
15
+ ["kubernetes", "psutil", "cryptography"]
16
+ )
17
+ else:
18
+ # VM mode - check docker and other VM-specific dependencies
19
+ dependencies_check(
20
+ ["docker", "psutil", "cryptography", "notebook", "aiohttp", "kafka-python"]
21
+ )
22
+
23
+ subprocess.run( # Re-upgrade docker to avoid missing DOCKER_HOST connection error
24
+ ["pip", "install", "--upgrade", "docker"],
25
+ check=True,
26
+ stdout=subprocess.DEVNULL, # suppress normal output
27
+ stderr=subprocess.DEVNULL # suppress warnings/progress
28
+ )
18
29
 
19
30
  from matrice_compute.instance_manager import InstanceManager # noqa: E402
20
31
 
21
32
  logging.getLogger("kafka").setLevel(logging.INFO)
22
33
  logging.getLogger("confluent_kafka").setLevel(logging.INFO)
23
34
 
24
- __all__ = ["InstanceManager"]
35
+ __all__ = ["InstanceManager"]