accli 1.1.3__tar.gz → 2.0.0b1__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.
- {accli-1.1.3 → accli-2.0.0b1}/PKG-INFO +22 -7
- {accli-1.1.3 → accli-2.0.0b1}/README.md +20 -6
- {accli-1.1.3 → accli-2.0.0b1}/accli/AcceleratorJobProjectService.py +24 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli/AcceleratorTerminalCliProjectService.py +22 -9
- {accli-1.1.3 → accli-2.0.0b1}/accli/_version.py +1 -1
- accli-2.0.0b1/accli/cli.py +1266 -0
- accli-2.0.0b1/accli/mount_downloader.py +156 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli.egg-info/PKG-INFO +22 -7
- {accli-1.1.3 → accli-2.0.0b1}/accli.egg-info/SOURCES.txt +1 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli.egg-info/requires.txt +1 -0
- {accli-1.1.3 → accli-2.0.0b1}/pyproject.toml +1 -0
- accli-1.1.3/accli/cli.py +0 -309
- {accli-1.1.3 → accli-2.0.0b1}/LICENSE +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli/AcceleratorTaskDispatcher.py +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli/CsvRegionalTimeseriesValidator.py +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli/__init__.py +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli/__main__.py +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli/common.py +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli/token.py +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli.egg-info/dependency_links.txt +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli.egg-info/entry_points.txt +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/accli.egg-info/top_level.txt +0 -0
- {accli-1.1.3 → accli-2.0.0b1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: accli
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0b1
|
|
4
4
|
Summary: IIASA Accelerator Client
|
|
5
5
|
Author-email: Wrufesh S <wrufesh@gmail.com>
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -39,9 +39,9 @@ Requires-Dist: requests>=2.25.1
|
|
|
39
39
|
Requires-Dist: jsonschema>=4.5.1
|
|
40
40
|
Requires-Dist: pydantic>=2.0
|
|
41
41
|
Requires-Dist: GitPython
|
|
42
|
+
Requires-Dist: hf-xet>=1.4.3
|
|
42
43
|
Dynamic: license-file
|
|
43
44
|
|
|
44
|
-
|
|
45
45
|
# Accelerator Terminal Client and Python API
|
|
46
46
|
|
|
47
47
|
This package provides:
|
|
@@ -49,7 +49,8 @@ This package provides:
|
|
|
49
49
|
- A **command-line client** (`accli`) for interacting with the **Accelerator**.
|
|
50
50
|
- A **Python API** via the `accli` package.
|
|
51
51
|
|
|
52
|
-
Both interfaces communicate with the Accelerator’s REST API, implemented in
|
|
52
|
+
Both interfaces communicate with the Accelerator’s REST API, implemented in
|
|
53
|
+
the [Control Services Backend](https://github.com/iiasa/control_services_backend).
|
|
53
54
|
|
|
54
55
|
---
|
|
55
56
|
|
|
@@ -57,10 +58,11 @@ Both interfaces communicate with the Accelerator’s REST API, implemented in th
|
|
|
57
58
|
|
|
58
59
|
This client uses **device authentication** via Auth0.
|
|
59
60
|
|
|
60
|
-
- **OAuth Flow
|
|
61
|
-
|
|
62
|
-
- **
|
|
63
|
-
- **
|
|
61
|
+
- **OAuth Flow
|
|
62
|
+
**: [Device Authorization Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow)
|
|
63
|
+
- **Token Validity**: 7 days
|
|
64
|
+
- **Access Control**: Role-Based Access Control (RBAC) with stateless tokens
|
|
65
|
+
- **Grants**: Limited and scoped
|
|
64
66
|
|
|
65
67
|
---
|
|
66
68
|
|
|
@@ -77,11 +79,13 @@ This client uses **device authentication** via Auth0.
|
|
|
77
79
|
No Python install required. Run the appropriate command for your system:
|
|
78
80
|
|
|
79
81
|
**Linux / macOS:**
|
|
82
|
+
|
|
80
83
|
```bash
|
|
81
84
|
curl -fsSL https://raw.githubusercontent.com/iiasa/accli/master/scripts/install.sh | bash
|
|
82
85
|
```
|
|
83
86
|
|
|
84
87
|
**Windows (PowerShell):**
|
|
88
|
+
|
|
85
89
|
```powershell
|
|
86
90
|
irm https://raw.githubusercontent.com/iiasa/accli/master/scripts/install.ps1 | iex
|
|
87
91
|
```
|
|
@@ -132,6 +136,17 @@ Usage: accli [OPTIONS] COMMAND [ARGS]...
|
|
|
132
136
|
|
|
133
137
|
## 👩💻 Developer Guide
|
|
134
138
|
|
|
139
|
+
### Handling self-signed certificates
|
|
140
|
+
|
|
141
|
+
1. Copy and paste certificates from `<control_services_backend>/certs/public.crt` as
|
|
142
|
+
`./certs/dev-backend.crt` and `<accelerator_service>/minio_certs/public.crt` as
|
|
143
|
+
`./certs/dev-minio-ca.crt`.
|
|
144
|
+
2. Run
|
|
145
|
+
```
|
|
146
|
+
cd scripts
|
|
147
|
+
import_certs_certutil.ps1
|
|
148
|
+
```
|
|
149
|
+
|
|
135
150
|
### 🛠 Build & Upload
|
|
136
151
|
|
|
137
152
|
Follow the official Python packaging tutorial:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# Accelerator Terminal Client and Python API
|
|
3
2
|
|
|
4
3
|
This package provides:
|
|
@@ -6,7 +5,8 @@ This package provides:
|
|
|
6
5
|
- A **command-line client** (`accli`) for interacting with the **Accelerator**.
|
|
7
6
|
- A **Python API** via the `accli` package.
|
|
8
7
|
|
|
9
|
-
Both interfaces communicate with the Accelerator’s REST API, implemented in
|
|
8
|
+
Both interfaces communicate with the Accelerator’s REST API, implemented in
|
|
9
|
+
the [Control Services Backend](https://github.com/iiasa/control_services_backend).
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -14,10 +14,11 @@ Both interfaces communicate with the Accelerator’s REST API, implemented in th
|
|
|
14
14
|
|
|
15
15
|
This client uses **device authentication** via Auth0.
|
|
16
16
|
|
|
17
|
-
- **OAuth Flow
|
|
18
|
-
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
17
|
+
- **OAuth Flow
|
|
18
|
+
**: [Device Authorization Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow)
|
|
19
|
+
- **Token Validity**: 7 days
|
|
20
|
+
- **Access Control**: Role-Based Access Control (RBAC) with stateless tokens
|
|
21
|
+
- **Grants**: Limited and scoped
|
|
21
22
|
|
|
22
23
|
---
|
|
23
24
|
|
|
@@ -34,11 +35,13 @@ This client uses **device authentication** via Auth0.
|
|
|
34
35
|
No Python install required. Run the appropriate command for your system:
|
|
35
36
|
|
|
36
37
|
**Linux / macOS:**
|
|
38
|
+
|
|
37
39
|
```bash
|
|
38
40
|
curl -fsSL https://raw.githubusercontent.com/iiasa/accli/master/scripts/install.sh | bash
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
**Windows (PowerShell):**
|
|
44
|
+
|
|
42
45
|
```powershell
|
|
43
46
|
irm https://raw.githubusercontent.com/iiasa/accli/master/scripts/install.ps1 | iex
|
|
44
47
|
```
|
|
@@ -89,6 +92,17 @@ Usage: accli [OPTIONS] COMMAND [ARGS]...
|
|
|
89
92
|
|
|
90
93
|
## 👩💻 Developer Guide
|
|
91
94
|
|
|
95
|
+
### Handling self-signed certificates
|
|
96
|
+
|
|
97
|
+
1. Copy and paste certificates from `<control_services_backend>/certs/public.crt` as
|
|
98
|
+
`./certs/dev-backend.crt` and `<accelerator_service>/minio_certs/public.crt` as
|
|
99
|
+
`./certs/dev-minio-ca.crt`.
|
|
100
|
+
2. Run
|
|
101
|
+
```
|
|
102
|
+
cd scripts
|
|
103
|
+
import_certs_certutil.ps1
|
|
104
|
+
```
|
|
105
|
+
|
|
92
106
|
### 🛠 Build & Upload
|
|
93
107
|
|
|
94
108
|
Follow the official Python packaging tutorial:
|
|
@@ -446,6 +446,30 @@ class AcceleratorJobProjectService:
|
|
|
446
446
|
headers=headers
|
|
447
447
|
)
|
|
448
448
|
|
|
449
|
+
def register_validation_with_filename(
|
|
450
|
+
self,
|
|
451
|
+
validated_filename: str,
|
|
452
|
+
dataset_template_id: int,
|
|
453
|
+
validated_metadata: dict,
|
|
454
|
+
validation_supporting_filenames: List[str]
|
|
455
|
+
):
|
|
456
|
+
headers = {"Content-Type": "application/json"}
|
|
457
|
+
|
|
458
|
+
headers.update(self.common_request_headers)
|
|
459
|
+
|
|
460
|
+
res = self.http_client_request(
|
|
461
|
+
"PUT",
|
|
462
|
+
f"{self.cli_base_url}/register-validation-with-filename/",
|
|
463
|
+
json=dict(
|
|
464
|
+
validated_filename=validated_filename,
|
|
465
|
+
dataset_template_id=dataset_template_id,
|
|
466
|
+
validated_metadata=validated_metadata,
|
|
467
|
+
validation_supporting_filenames=validation_supporting_filenames
|
|
468
|
+
),
|
|
469
|
+
headers=headers
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
|
|
449
473
|
def get_dataset_template_details(
|
|
450
474
|
self,
|
|
451
475
|
dataset_template_id
|
|
@@ -4,6 +4,7 @@ import json
|
|
|
4
4
|
import os
|
|
5
5
|
|
|
6
6
|
import requests
|
|
7
|
+
from requests.adapters import HTTPAdapter
|
|
7
8
|
import urllib3
|
|
8
9
|
from typing import List, Tuple
|
|
9
10
|
|
|
@@ -21,7 +22,12 @@ class AccAPIError(Exception):
|
|
|
21
22
|
self.status_code = status_code
|
|
22
23
|
|
|
23
24
|
|
|
24
|
-
retries = urllib3.util.Retry(
|
|
25
|
+
retries = urllib3.util.Retry(
|
|
26
|
+
total=10,
|
|
27
|
+
backoff_factor=1,
|
|
28
|
+
status_forcelist=[408, 429, 500, 502, 503, 504],
|
|
29
|
+
allowed_methods=["HEAD", "GET", "OPTIONS", "PUT"]
|
|
30
|
+
)
|
|
25
31
|
|
|
26
32
|
http_client = urllib3.poolmanager.PoolManager(
|
|
27
33
|
num_pools=20, retries=retries, maxsize=2000, block=True
|
|
@@ -41,8 +47,9 @@ class AcceleratorTerminalCliProjectService:
|
|
|
41
47
|
):
|
|
42
48
|
|
|
43
49
|
self.user_token = user_token
|
|
50
|
+
self.verify_cert = verify_cert
|
|
44
51
|
|
|
45
|
-
if verify_cert:
|
|
52
|
+
if self.verify_cert:
|
|
46
53
|
self.http_client = http_client
|
|
47
54
|
else:
|
|
48
55
|
self.http_client = http_client_wo_cert_verification
|
|
@@ -264,16 +271,22 @@ class AcceleratorTerminalCliProjectService:
|
|
|
264
271
|
project_slug, app_bucket_id, uniqified_filename, upload_id, part_number
|
|
265
272
|
)
|
|
266
273
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
session = requests.Session()
|
|
275
|
+
adapter = HTTPAdapter(max_retries=retries)
|
|
276
|
+
session.mount("https://", adapter)
|
|
277
|
+
session.verify = self.verify_cert
|
|
278
|
+
|
|
279
|
+
with session.put(
|
|
280
|
+
put_presigned_url,
|
|
281
|
+
data=part_data,
|
|
282
|
+
timeout=120
|
|
283
|
+
) as part_upload_response:
|
|
284
|
+
part_upload_response.raise_for_status()
|
|
285
|
+
|
|
286
|
+
etag = part_upload_response.headers.get("etag").replace('"', "")
|
|
273
287
|
|
|
274
288
|
progress.update(task, advance=len(part_data))
|
|
275
289
|
|
|
276
|
-
etag = part_upload_response.headers.get("etag").replace('"', "")
|
|
277
290
|
return part_number, etag
|
|
278
291
|
|
|
279
292
|
def upload_filestream_to_accelerator(self, project_slug, filename, file_stream, progress, task,
|