orgo 0.0.21__tar.gz → 0.0.22__tar.gz
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.
- {orgo-0.0.21 → orgo-0.0.22}/PKG-INFO +1 -1
- {orgo-0.0.21 → orgo-0.0.22}/pyproject.toml +1 -1
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo/computer.py +12 -4
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo.egg-info/PKG-INFO +1 -1
- {orgo-0.0.21 → orgo-0.0.22}/README.md +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/setup.cfg +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo/__init__.py +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo/api/__init__.py +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo/api/client.py +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo/project.py +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo/prompt.py +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo/utils/__init__.py +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo/utils/auth.py +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo.egg-info/SOURCES.txt +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo.egg-info/dependency_links.txt +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo.egg-info/requires.txt +0 -0
- {orgo-0.0.21 → orgo-0.0.22}/src/orgo.egg-info/top_level.txt +0 -0
|
@@ -21,6 +21,7 @@ class Computer:
|
|
|
21
21
|
config: Optional[Dict[str, Any]] = None,
|
|
22
22
|
base_api_url: Optional[str] = None,
|
|
23
23
|
ram: Optional[Literal[2, 4]] = None,
|
|
24
|
+
memory: Optional[Literal[2, 4]] = None,
|
|
24
25
|
cpu: Optional[Literal[2, 4]] = None):
|
|
25
26
|
"""
|
|
26
27
|
Initialize an Orgo virtual computer.
|
|
@@ -31,12 +32,19 @@ class Computer:
|
|
|
31
32
|
config: Configuration for new computer (optional)
|
|
32
33
|
base_api_url: Custom API URL (optional)
|
|
33
34
|
ram: RAM in GB for new computer (2 or 4) - only used when creating
|
|
35
|
+
memory: Alternative parameter for RAM in GB (2 or 4) - only used when creating
|
|
34
36
|
cpu: CPU cores for new computer (2 or 4) - only used when creating
|
|
37
|
+
|
|
38
|
+
Note: If both ram and memory are provided, ram takes precedence.
|
|
35
39
|
"""
|
|
36
40
|
self.api_key = api_key or os.environ.get("ORGO_API_KEY")
|
|
37
41
|
self.base_api_url = base_api_url
|
|
38
42
|
self.api = ApiClient(self.api_key, self.base_api_url)
|
|
39
43
|
|
|
44
|
+
# Handle memory parameter as an alias for ram
|
|
45
|
+
if ram is None and memory is not None:
|
|
46
|
+
ram = memory
|
|
47
|
+
|
|
40
48
|
# Look for a saved project ID if none was provided
|
|
41
49
|
if project_id is None:
|
|
42
50
|
project_id = ProjectManager.load_project_id()
|
|
@@ -45,9 +53,9 @@ class Computer:
|
|
|
45
53
|
try:
|
|
46
54
|
self.project_id = project_id
|
|
47
55
|
self._info = self.api.connect_computer(project_id)
|
|
48
|
-
# Log if ram/cpu were provided but ignored
|
|
49
|
-
if ram is not None or cpu is not None:
|
|
50
|
-
logger.info("Note: ram and cpu parameters are ignored when connecting to existing computer")
|
|
56
|
+
# Log if ram/memory/cpu were provided but ignored
|
|
57
|
+
if ram is not None or memory is not None or cpu is not None:
|
|
58
|
+
logger.info("Note: ram, memory, and cpu parameters are ignored when connecting to existing computer")
|
|
51
59
|
except (RequestException, ValueError) as e:
|
|
52
60
|
logger.warning(f"Could not connect to saved project {project_id}: {e}")
|
|
53
61
|
self._create_new_computer(config, ram, cpu)
|
|
@@ -60,7 +68,7 @@ class Computer:
|
|
|
60
68
|
"""Create a new computer instance and save its ID"""
|
|
61
69
|
# Validate ram and cpu values if provided
|
|
62
70
|
if ram is not None and ram not in [2, 4]:
|
|
63
|
-
raise ValueError("ram must be either 2 or 4 GB")
|
|
71
|
+
raise ValueError("ram/memory must be either 2 or 4 GB")
|
|
64
72
|
if cpu is not None and cpu not in [2, 4]:
|
|
65
73
|
raise ValueError("cpu must be either 2 or 4 cores")
|
|
66
74
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|