kaio 0.1.0__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.
kaio-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Kaio Platform
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
kaio-0.1.0/MANIFEST.in ADDED
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ include DOCUMENTATION.md
4
+ include DEPLOYMENT_README.md
5
+ recursive-exclude * __pycache__
6
+ recursive-exclude * *.py[co]
kaio-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,251 @@
1
+ Metadata-Version: 2.4
2
+ Name: kaio
3
+ Version: 0.1.0
4
+ Summary: Python client for the Kaio multi-tenant machine learning platform
5
+ Home-page: https://github.com/Kaion5-Compute/kaio
6
+ Author: Kaio Platform
7
+ Author-email: Kaio Platform <danielb@kaion5.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/Kaion5-Compute/kaio
10
+ Project-URL: Repository, https://github.com/Kaion5-Compute/kaio
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: requests>=2.25.0
25
+ Requires-Dist: packaging>=21.0
26
+ Dynamic: author
27
+ Dynamic: home-page
28
+ Dynamic: license-file
29
+ Dynamic: requires-python
30
+
31
+ # Kaio Python Client
32
+
33
+ A Python client for the Kaio multi-tenant machine learning platform that enables developers to run SageMaker jobs through simple APIs with automatic image resolution and secure file uploads.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install kaio
39
+ ```
40
+
41
+ ## Quick Start
42
+
43
+ ```python
44
+ from kaio import Client
45
+
46
+ # Initialize client
47
+ client = Client("https://api.kaion5.com")
48
+
49
+ # Login with your API key
50
+ client.login("your-api-key")
51
+
52
+ # Submit a job
53
+ result = client.submit_job(
54
+ directory="./my_code",
55
+ job_name="training-job",
56
+ instance_type="ml.g4dn.xlarge",
57
+ entrypoint="train.py"
58
+ )
59
+ ```
60
+
61
+ ## Features
62
+
63
+ - **Automatic Image Resolution**: Detects your local ML framework and selects appropriate Docker images
64
+ - **Secure File Uploads**: Handles code packaging and S3 uploads automatically
65
+ - **Job Management**: Submit, monitor, and download results from SageMaker jobs
66
+ - **Multi-Framework Support**: Works with PyTorch, TensorFlow, and Scikit-learn
67
+ - **GPU/CPU Instance Matching**: Automatically selects GPU or CPU optimized containers
68
+ - **Automatic Dependencies**: Adds required packages (nbconvert, psutil, GPUtil) to requirements.txt
69
+ - **JWT Token Management**: Handles authentication token refresh automatically
70
+
71
+ ## API Reference
72
+
73
+ ### Client
74
+
75
+ #### `Client(api_base, verbose=False)`
76
+
77
+ Initialize the Kaio client.
78
+
79
+ **Parameters:**
80
+ - `api_base` (str): Base URL of the Kaio API endpoint
81
+ - `verbose` (bool): Enable verbose logging for debugging. Defaults to False.
82
+
83
+ **Example:**
84
+ ```python
85
+ client = Client("https://api.kaion5.com", verbose=True)
86
+ ```
87
+
88
+ #### `login(api_key)`
89
+
90
+ Authenticate with API key and obtain JWT token.
91
+
92
+ **Parameters:**
93
+ - `api_key` (str): Your Kaio platform API key
94
+
95
+ **Returns:**
96
+ - `Client`: Self for method chaining
97
+
98
+ **Raises:**
99
+ - `requests.HTTPError`: If authentication fails
100
+
101
+ #### `submit_job(**kwargs)`
102
+
103
+ Submit a SageMaker job with automatic image resolution.
104
+
105
+ **Parameters:**
106
+ - `directory` (str): Path to code directory. Defaults to current directory.
107
+ - `job_name` (str): Unique name for the job. Defaults to "job".
108
+ - `instance_type` (str): SageMaker instance type. Defaults to "ml.m5.large".
109
+ - `instance_count` (int): Number of instances. Defaults to 1.
110
+ - `volume_size_gb` (int): EBS volume size in GB. Defaults to 5.
111
+ - `entrypoint` (str): Main script to execute (.py or .ipynb). Defaults to "train.py".
112
+ - `input_data` (str, optional): S3 URI for input data (not implemented yet).
113
+ - `framework` (str, optional): ML framework ("pytorch", "tensorflow", "sklearn").
114
+ - `framework_version` (str, optional): Framework version.
115
+
116
+ **Returns:**
117
+ - `dict`: Job submission result with status, job_name, and entrypoint
118
+
119
+ **Raises:**
120
+ - `requests.HTTPError`: If API calls fail
121
+ - `FileNotFoundError`: If directory or entrypoint doesn't exist
122
+ - `ValueError`: If code package exceeds volume capacity
123
+
124
+ #### `get_job(job_id)`
125
+
126
+ Get job status and details.
127
+
128
+ **Parameters:**
129
+ - `job_id` (str): Job identifier
130
+
131
+ **Returns:**
132
+ - `dict`: Job details including status, logs, and output URLs
133
+
134
+ **Raises:**
135
+ - `requests.HTTPError`: If job not found or API error
136
+
137
+ #### `download_output(job_id, output_dir=".")`
138
+
139
+ Download completed job output files.
140
+
141
+ **Parameters:**
142
+ - `job_id` (str): Job identifier
143
+ - `output_dir` (str): Local directory to save output. Defaults to current directory.
144
+
145
+ **Returns:**
146
+ - `Path`: Path to downloaded output tar.gz file
147
+
148
+ **Raises:**
149
+ - `RuntimeError`: If job is not completed
150
+ - `requests.HTTPError`: If download fails
151
+
152
+ ## Supported Instance Types
153
+
154
+ ### CPU Instances
155
+ - `ml.m5.large`, `ml.m5.xlarge`, `ml.m5.2xlarge`, `ml.m5.4xlarge`
156
+ - `ml.c5.large`, `ml.c5.xlarge`, `ml.c5.2xlarge`, `ml.c5.4xlarge`
157
+
158
+ ### GPU Instances
159
+ - `ml.g4dn.xlarge`, `ml.g4dn.2xlarge`, `ml.g4dn.4xlarge`, `ml.g4dn.8xlarge`
160
+ - `ml.p3.2xlarge`, `ml.p3.8xlarge`, `ml.p3.16xlarge`
161
+ - `ml.g5.xlarge`, `ml.g5.2xlarge`, `ml.g5.4xlarge`, `ml.g5.8xlarge`
162
+
163
+ ## Framework Auto-Detection
164
+
165
+ The SDK automatically detects your local ML framework and selects appropriate Docker images:
166
+
167
+ - **PyTorch**: Detects version and selects matching SageMaker PyTorch container
168
+ - **TensorFlow**: Detects version and selects matching SageMaker TensorFlow container
169
+ - **Scikit-learn**: Falls back to scikit-learn container for general ML workloads
170
+
171
+ ## Code Requirements
172
+
173
+ ### File Size Limits
174
+ Code packages must not exceed half your volume size:
175
+ - 5GB volume → 2.5GB max code package
176
+ - 10GB volume → 5GB max code package
177
+
178
+ ### Automatic Dependencies
179
+ The SDK automatically adds these packages to your requirements.txt:
180
+ - `nbconvert` - For Jupyter notebook execution
181
+ - `psutil` - For system monitoring
182
+ - `GPUtil` - For GPU monitoring
183
+
184
+ ## Examples
185
+
186
+ ### Basic PyTorch Training
187
+
188
+ ```python
189
+ from kaio import Client
190
+
191
+ client = Client("https://api.kaion5.com")
192
+ client.login("your-api-key")
193
+
194
+ result = client.submit_job(
195
+ directory="./pytorch_model",
196
+ job_name="pytorch-training",
197
+ instance_type="ml.g4dn.xlarge",
198
+ entrypoint="train.py",
199
+ volume_size_gb=10
200
+ )
201
+ ```
202
+
203
+ ### TensorFlow with Custom Framework Version
204
+
205
+ ```python
206
+ result = client.submit_job(
207
+ directory="./tensorflow_model",
208
+ job_name="tf-experiment",
209
+ instance_type="ml.p3.2xlarge",
210
+ framework="tensorflow",
211
+ framework_version="2.13.0",
212
+ entrypoint="model.py"
213
+ )
214
+ ```
215
+
216
+ ### Jupyter Notebook Execution
217
+
218
+ ```python
219
+ result = client.submit_job(
220
+ directory="./notebooks",
221
+ job_name="data-analysis",
222
+ instance_type="ml.m5.xlarge",
223
+ entrypoint="analysis.ipynb"
224
+ )
225
+ ```
226
+
227
+ ## Error Handling
228
+
229
+ ```python
230
+ import requests
231
+
232
+ try:
233
+ result = client.submit_job(
234
+ directory="./code",
235
+ job_name="my-job",
236
+ instance_type="ml.g4dn.xlarge"
237
+ )
238
+ except requests.HTTPError as e:
239
+ if e.response.status_code == 403:
240
+ print("Access denied - check your API key")
241
+ else:
242
+ print(f"API error: {e}")
243
+ except ValueError as e:
244
+ print(f"Configuration error: {e}")
245
+ except FileNotFoundError as e:
246
+ print(f"File not found: {e}")
247
+ ```
248
+
249
+ ## License
250
+
251
+ MIT License
kaio-0.1.0/README.md ADDED
@@ -0,0 +1,221 @@
1
+ # Kaio Python Client
2
+
3
+ A Python client for the Kaio multi-tenant machine learning platform that enables developers to run SageMaker jobs through simple APIs with automatic image resolution and secure file uploads.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install kaio
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from kaio import Client
15
+
16
+ # Initialize client
17
+ client = Client("https://api.kaion5.com")
18
+
19
+ # Login with your API key
20
+ client.login("your-api-key")
21
+
22
+ # Submit a job
23
+ result = client.submit_job(
24
+ directory="./my_code",
25
+ job_name="training-job",
26
+ instance_type="ml.g4dn.xlarge",
27
+ entrypoint="train.py"
28
+ )
29
+ ```
30
+
31
+ ## Features
32
+
33
+ - **Automatic Image Resolution**: Detects your local ML framework and selects appropriate Docker images
34
+ - **Secure File Uploads**: Handles code packaging and S3 uploads automatically
35
+ - **Job Management**: Submit, monitor, and download results from SageMaker jobs
36
+ - **Multi-Framework Support**: Works with PyTorch, TensorFlow, and Scikit-learn
37
+ - **GPU/CPU Instance Matching**: Automatically selects GPU or CPU optimized containers
38
+ - **Automatic Dependencies**: Adds required packages (nbconvert, psutil, GPUtil) to requirements.txt
39
+ - **JWT Token Management**: Handles authentication token refresh automatically
40
+
41
+ ## API Reference
42
+
43
+ ### Client
44
+
45
+ #### `Client(api_base, verbose=False)`
46
+
47
+ Initialize the Kaio client.
48
+
49
+ **Parameters:**
50
+ - `api_base` (str): Base URL of the Kaio API endpoint
51
+ - `verbose` (bool): Enable verbose logging for debugging. Defaults to False.
52
+
53
+ **Example:**
54
+ ```python
55
+ client = Client("https://api.kaion5.com", verbose=True)
56
+ ```
57
+
58
+ #### `login(api_key)`
59
+
60
+ Authenticate with API key and obtain JWT token.
61
+
62
+ **Parameters:**
63
+ - `api_key` (str): Your Kaio platform API key
64
+
65
+ **Returns:**
66
+ - `Client`: Self for method chaining
67
+
68
+ **Raises:**
69
+ - `requests.HTTPError`: If authentication fails
70
+
71
+ #### `submit_job(**kwargs)`
72
+
73
+ Submit a SageMaker job with automatic image resolution.
74
+
75
+ **Parameters:**
76
+ - `directory` (str): Path to code directory. Defaults to current directory.
77
+ - `job_name` (str): Unique name for the job. Defaults to "job".
78
+ - `instance_type` (str): SageMaker instance type. Defaults to "ml.m5.large".
79
+ - `instance_count` (int): Number of instances. Defaults to 1.
80
+ - `volume_size_gb` (int): EBS volume size in GB. Defaults to 5.
81
+ - `entrypoint` (str): Main script to execute (.py or .ipynb). Defaults to "train.py".
82
+ - `input_data` (str, optional): S3 URI for input data (not implemented yet).
83
+ - `framework` (str, optional): ML framework ("pytorch", "tensorflow", "sklearn").
84
+ - `framework_version` (str, optional): Framework version.
85
+
86
+ **Returns:**
87
+ - `dict`: Job submission result with status, job_name, and entrypoint
88
+
89
+ **Raises:**
90
+ - `requests.HTTPError`: If API calls fail
91
+ - `FileNotFoundError`: If directory or entrypoint doesn't exist
92
+ - `ValueError`: If code package exceeds volume capacity
93
+
94
+ #### `get_job(job_id)`
95
+
96
+ Get job status and details.
97
+
98
+ **Parameters:**
99
+ - `job_id` (str): Job identifier
100
+
101
+ **Returns:**
102
+ - `dict`: Job details including status, logs, and output URLs
103
+
104
+ **Raises:**
105
+ - `requests.HTTPError`: If job not found or API error
106
+
107
+ #### `download_output(job_id, output_dir=".")`
108
+
109
+ Download completed job output files.
110
+
111
+ **Parameters:**
112
+ - `job_id` (str): Job identifier
113
+ - `output_dir` (str): Local directory to save output. Defaults to current directory.
114
+
115
+ **Returns:**
116
+ - `Path`: Path to downloaded output tar.gz file
117
+
118
+ **Raises:**
119
+ - `RuntimeError`: If job is not completed
120
+ - `requests.HTTPError`: If download fails
121
+
122
+ ## Supported Instance Types
123
+
124
+ ### CPU Instances
125
+ - `ml.m5.large`, `ml.m5.xlarge`, `ml.m5.2xlarge`, `ml.m5.4xlarge`
126
+ - `ml.c5.large`, `ml.c5.xlarge`, `ml.c5.2xlarge`, `ml.c5.4xlarge`
127
+
128
+ ### GPU Instances
129
+ - `ml.g4dn.xlarge`, `ml.g4dn.2xlarge`, `ml.g4dn.4xlarge`, `ml.g4dn.8xlarge`
130
+ - `ml.p3.2xlarge`, `ml.p3.8xlarge`, `ml.p3.16xlarge`
131
+ - `ml.g5.xlarge`, `ml.g5.2xlarge`, `ml.g5.4xlarge`, `ml.g5.8xlarge`
132
+
133
+ ## Framework Auto-Detection
134
+
135
+ The SDK automatically detects your local ML framework and selects appropriate Docker images:
136
+
137
+ - **PyTorch**: Detects version and selects matching SageMaker PyTorch container
138
+ - **TensorFlow**: Detects version and selects matching SageMaker TensorFlow container
139
+ - **Scikit-learn**: Falls back to scikit-learn container for general ML workloads
140
+
141
+ ## Code Requirements
142
+
143
+ ### File Size Limits
144
+ Code packages must not exceed half your volume size:
145
+ - 5GB volume → 2.5GB max code package
146
+ - 10GB volume → 5GB max code package
147
+
148
+ ### Automatic Dependencies
149
+ The SDK automatically adds these packages to your requirements.txt:
150
+ - `nbconvert` - For Jupyter notebook execution
151
+ - `psutil` - For system monitoring
152
+ - `GPUtil` - For GPU monitoring
153
+
154
+ ## Examples
155
+
156
+ ### Basic PyTorch Training
157
+
158
+ ```python
159
+ from kaio import Client
160
+
161
+ client = Client("https://api.kaion5.com")
162
+ client.login("your-api-key")
163
+
164
+ result = client.submit_job(
165
+ directory="./pytorch_model",
166
+ job_name="pytorch-training",
167
+ instance_type="ml.g4dn.xlarge",
168
+ entrypoint="train.py",
169
+ volume_size_gb=10
170
+ )
171
+ ```
172
+
173
+ ### TensorFlow with Custom Framework Version
174
+
175
+ ```python
176
+ result = client.submit_job(
177
+ directory="./tensorflow_model",
178
+ job_name="tf-experiment",
179
+ instance_type="ml.p3.2xlarge",
180
+ framework="tensorflow",
181
+ framework_version="2.13.0",
182
+ entrypoint="model.py"
183
+ )
184
+ ```
185
+
186
+ ### Jupyter Notebook Execution
187
+
188
+ ```python
189
+ result = client.submit_job(
190
+ directory="./notebooks",
191
+ job_name="data-analysis",
192
+ instance_type="ml.m5.xlarge",
193
+ entrypoint="analysis.ipynb"
194
+ )
195
+ ```
196
+
197
+ ## Error Handling
198
+
199
+ ```python
200
+ import requests
201
+
202
+ try:
203
+ result = client.submit_job(
204
+ directory="./code",
205
+ job_name="my-job",
206
+ instance_type="ml.g4dn.xlarge"
207
+ )
208
+ except requests.HTTPError as e:
209
+ if e.response.status_code == 403:
210
+ print("Access denied - check your API key")
211
+ else:
212
+ print(f"API error: {e}")
213
+ except ValueError as e:
214
+ print(f"Configuration error: {e}")
215
+ except FileNotFoundError as e:
216
+ print(f"File not found: {e}")
217
+ ```
218
+
219
+ ## License
220
+
221
+ MIT License
@@ -0,0 +1,251 @@
1
+ Metadata-Version: 2.4
2
+ Name: kaio
3
+ Version: 0.1.0
4
+ Summary: Python client for the Kaio multi-tenant machine learning platform
5
+ Home-page: https://github.com/Kaion5-Compute/kaio
6
+ Author: Kaio Platform
7
+ Author-email: Kaio Platform <danielb@kaion5.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/Kaion5-Compute/kaio
10
+ Project-URL: Repository, https://github.com/Kaion5-Compute/kaio
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: requests>=2.25.0
25
+ Requires-Dist: packaging>=21.0
26
+ Dynamic: author
27
+ Dynamic: home-page
28
+ Dynamic: license-file
29
+ Dynamic: requires-python
30
+
31
+ # Kaio Python Client
32
+
33
+ A Python client for the Kaio multi-tenant machine learning platform that enables developers to run SageMaker jobs through simple APIs with automatic image resolution and secure file uploads.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install kaio
39
+ ```
40
+
41
+ ## Quick Start
42
+
43
+ ```python
44
+ from kaio import Client
45
+
46
+ # Initialize client
47
+ client = Client("https://api.kaion5.com")
48
+
49
+ # Login with your API key
50
+ client.login("your-api-key")
51
+
52
+ # Submit a job
53
+ result = client.submit_job(
54
+ directory="./my_code",
55
+ job_name="training-job",
56
+ instance_type="ml.g4dn.xlarge",
57
+ entrypoint="train.py"
58
+ )
59
+ ```
60
+
61
+ ## Features
62
+
63
+ - **Automatic Image Resolution**: Detects your local ML framework and selects appropriate Docker images
64
+ - **Secure File Uploads**: Handles code packaging and S3 uploads automatically
65
+ - **Job Management**: Submit, monitor, and download results from SageMaker jobs
66
+ - **Multi-Framework Support**: Works with PyTorch, TensorFlow, and Scikit-learn
67
+ - **GPU/CPU Instance Matching**: Automatically selects GPU or CPU optimized containers
68
+ - **Automatic Dependencies**: Adds required packages (nbconvert, psutil, GPUtil) to requirements.txt
69
+ - **JWT Token Management**: Handles authentication token refresh automatically
70
+
71
+ ## API Reference
72
+
73
+ ### Client
74
+
75
+ #### `Client(api_base, verbose=False)`
76
+
77
+ Initialize the Kaio client.
78
+
79
+ **Parameters:**
80
+ - `api_base` (str): Base URL of the Kaio API endpoint
81
+ - `verbose` (bool): Enable verbose logging for debugging. Defaults to False.
82
+
83
+ **Example:**
84
+ ```python
85
+ client = Client("https://api.kaion5.com", verbose=True)
86
+ ```
87
+
88
+ #### `login(api_key)`
89
+
90
+ Authenticate with API key and obtain JWT token.
91
+
92
+ **Parameters:**
93
+ - `api_key` (str): Your Kaio platform API key
94
+
95
+ **Returns:**
96
+ - `Client`: Self for method chaining
97
+
98
+ **Raises:**
99
+ - `requests.HTTPError`: If authentication fails
100
+
101
+ #### `submit_job(**kwargs)`
102
+
103
+ Submit a SageMaker job with automatic image resolution.
104
+
105
+ **Parameters:**
106
+ - `directory` (str): Path to code directory. Defaults to current directory.
107
+ - `job_name` (str): Unique name for the job. Defaults to "job".
108
+ - `instance_type` (str): SageMaker instance type. Defaults to "ml.m5.large".
109
+ - `instance_count` (int): Number of instances. Defaults to 1.
110
+ - `volume_size_gb` (int): EBS volume size in GB. Defaults to 5.
111
+ - `entrypoint` (str): Main script to execute (.py or .ipynb). Defaults to "train.py".
112
+ - `input_data` (str, optional): S3 URI for input data (not implemented yet).
113
+ - `framework` (str, optional): ML framework ("pytorch", "tensorflow", "sklearn").
114
+ - `framework_version` (str, optional): Framework version.
115
+
116
+ **Returns:**
117
+ - `dict`: Job submission result with status, job_name, and entrypoint
118
+
119
+ **Raises:**
120
+ - `requests.HTTPError`: If API calls fail
121
+ - `FileNotFoundError`: If directory or entrypoint doesn't exist
122
+ - `ValueError`: If code package exceeds volume capacity
123
+
124
+ #### `get_job(job_id)`
125
+
126
+ Get job status and details.
127
+
128
+ **Parameters:**
129
+ - `job_id` (str): Job identifier
130
+
131
+ **Returns:**
132
+ - `dict`: Job details including status, logs, and output URLs
133
+
134
+ **Raises:**
135
+ - `requests.HTTPError`: If job not found or API error
136
+
137
+ #### `download_output(job_id, output_dir=".")`
138
+
139
+ Download completed job output files.
140
+
141
+ **Parameters:**
142
+ - `job_id` (str): Job identifier
143
+ - `output_dir` (str): Local directory to save output. Defaults to current directory.
144
+
145
+ **Returns:**
146
+ - `Path`: Path to downloaded output tar.gz file
147
+
148
+ **Raises:**
149
+ - `RuntimeError`: If job is not completed
150
+ - `requests.HTTPError`: If download fails
151
+
152
+ ## Supported Instance Types
153
+
154
+ ### CPU Instances
155
+ - `ml.m5.large`, `ml.m5.xlarge`, `ml.m5.2xlarge`, `ml.m5.4xlarge`
156
+ - `ml.c5.large`, `ml.c5.xlarge`, `ml.c5.2xlarge`, `ml.c5.4xlarge`
157
+
158
+ ### GPU Instances
159
+ - `ml.g4dn.xlarge`, `ml.g4dn.2xlarge`, `ml.g4dn.4xlarge`, `ml.g4dn.8xlarge`
160
+ - `ml.p3.2xlarge`, `ml.p3.8xlarge`, `ml.p3.16xlarge`
161
+ - `ml.g5.xlarge`, `ml.g5.2xlarge`, `ml.g5.4xlarge`, `ml.g5.8xlarge`
162
+
163
+ ## Framework Auto-Detection
164
+
165
+ The SDK automatically detects your local ML framework and selects appropriate Docker images:
166
+
167
+ - **PyTorch**: Detects version and selects matching SageMaker PyTorch container
168
+ - **TensorFlow**: Detects version and selects matching SageMaker TensorFlow container
169
+ - **Scikit-learn**: Falls back to scikit-learn container for general ML workloads
170
+
171
+ ## Code Requirements
172
+
173
+ ### File Size Limits
174
+ Code packages must not exceed half your volume size:
175
+ - 5GB volume → 2.5GB max code package
176
+ - 10GB volume → 5GB max code package
177
+
178
+ ### Automatic Dependencies
179
+ The SDK automatically adds these packages to your requirements.txt:
180
+ - `nbconvert` - For Jupyter notebook execution
181
+ - `psutil` - For system monitoring
182
+ - `GPUtil` - For GPU monitoring
183
+
184
+ ## Examples
185
+
186
+ ### Basic PyTorch Training
187
+
188
+ ```python
189
+ from kaio import Client
190
+
191
+ client = Client("https://api.kaion5.com")
192
+ client.login("your-api-key")
193
+
194
+ result = client.submit_job(
195
+ directory="./pytorch_model",
196
+ job_name="pytorch-training",
197
+ instance_type="ml.g4dn.xlarge",
198
+ entrypoint="train.py",
199
+ volume_size_gb=10
200
+ )
201
+ ```
202
+
203
+ ### TensorFlow with Custom Framework Version
204
+
205
+ ```python
206
+ result = client.submit_job(
207
+ directory="./tensorflow_model",
208
+ job_name="tf-experiment",
209
+ instance_type="ml.p3.2xlarge",
210
+ framework="tensorflow",
211
+ framework_version="2.13.0",
212
+ entrypoint="model.py"
213
+ )
214
+ ```
215
+
216
+ ### Jupyter Notebook Execution
217
+
218
+ ```python
219
+ result = client.submit_job(
220
+ directory="./notebooks",
221
+ job_name="data-analysis",
222
+ instance_type="ml.m5.xlarge",
223
+ entrypoint="analysis.ipynb"
224
+ )
225
+ ```
226
+
227
+ ## Error Handling
228
+
229
+ ```python
230
+ import requests
231
+
232
+ try:
233
+ result = client.submit_job(
234
+ directory="./code",
235
+ job_name="my-job",
236
+ instance_type="ml.g4dn.xlarge"
237
+ )
238
+ except requests.HTTPError as e:
239
+ if e.response.status_code == 403:
240
+ print("Access denied - check your API key")
241
+ else:
242
+ print(f"API error: {e}")
243
+ except ValueError as e:
244
+ print(f"Configuration error: {e}")
245
+ except FileNotFoundError as e:
246
+ print(f"File not found: {e}")
247
+ ```
248
+
249
+ ## License
250
+
251
+ MIT License
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ setup.py
6
+ kaio.egg-info/PKG-INFO
7
+ kaio.egg-info/SOURCES.txt
8
+ kaio.egg-info/dependency_links.txt
9
+ kaio.egg-info/requires.txt
10
+ kaio.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ requests>=2.25.0
2
+ packaging>=21.0
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,34 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "kaio"
7
+ version = "0.1.0"
8
+ description = "Python client for the Kaio multi-tenant machine learning platform"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Kaio Platform", email = "danielb@kaion5.com"}
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ ]
27
+ dependencies = [
28
+ "requests>=2.25.0",
29
+ "packaging>=21.0",
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/Kaion5-Compute/kaio"
34
+ Repository = "https://github.com/Kaion5-Compute/kaio"
kaio-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
kaio-0.1.0/setup.py ADDED
@@ -0,0 +1,33 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ with open("README.md", "r", encoding="utf-8") as fh:
4
+ long_description = fh.read()
5
+
6
+ setup(
7
+ name="kaio",
8
+ version="0.1.0",
9
+ author="Kaio Platform",
10
+ author_email="danielb@kaion5.com",
11
+ description="Python client for the Kaio multi-tenant machine learning platform",
12
+ long_description=long_description,
13
+ long_description_content_type="text/markdown",
14
+ url="https://github.com/Kaion5-Compute/kaio",
15
+ packages=find_packages(),
16
+ classifiers=[
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.8",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ ],
28
+ python_requires=">=3.8",
29
+ install_requires=[
30
+ "requests>=2.25.0",
31
+ "packaging>=21.0",
32
+ ],
33
+ )