-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #342 from Boavizta/main
Merge clever api demo
- Loading branch information
Showing
26 changed files
with
1,231 additions
and
1,188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
provider.name,provider.description | ||
aws,Amazon Web Services | ||
azure,Microsoft Azure | ||
scaleway,Scaleway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
id,vcpu,memory,ssd_storage,hdd_storage,gpu_units,platform,source | ||
coparm1-16c-64g,16,64,10,0,0,scw_coparm1.base, | ||
coparm1-2c-8g,2,8,10,0,0,scw_coparm1.base, | ||
coparm1-32c-128g,32,128,10,0,0,scw_coparm1.base, | ||
coparm1-4c-16g,4,16,10,0,0,scw_coparm1.base, | ||
coparm1-8c-32g,8,32,10,0,0,scw_coparm1.base, | ||
dev1-l,4,8,10,0,0,scw_dev1.base, | ||
dev1-m,3,4,10,0,0,scw_dev1.base, | ||
dev1-s,2,2,10,0,0,scw_dev1.base, | ||
dev1-xl,4,12,10,0,0,scw_dev1.base, | ||
ent1-2xl,96,384,10,0,0,scw_ent1.base, | ||
ent1-l,32,128,10,0,0,scw_ent1.base, | ||
ent1-m,16,64,10,0,0,scw_ent1.base, | ||
ent1-s,8,32,10,0,0,scw_ent1.base, | ||
ent1-xl,64,256,10,0,0,scw_ent1.base, | ||
ent1-xs,4,16,10,0,0,scw_ent1.base, | ||
ent1-xxs,2,8,10,0,0,scw_ent1.base, | ||
gp1-l,32,128,10,0,0,scw_gp1.base, | ||
gp1-m,16,64,10,0,0,scw_gp1.base, | ||
gp1-s,8,32,10,0,0,scw_gp1.base, | ||
gp1-viz,8,32,10,0,0,scw_gp1.base, | ||
gp1-xl,48,256,10,0,0,scw_gp1.base, | ||
gp1-xs,4,16,10,0,0,scw_gp1.base, | ||
gpu-3070-s,8,16,10,0,1,scw_renders.base, | ||
h100-1-80g,24,240,10,0,1,scw_h100.base, | ||
h100-1-m,24,240,10,0,1,scw_h100.base, | ||
h100-2-80g,48,480,10,0,2,scw_h100.base, | ||
h100-2-m,48,480,10,0,2,scw_h100.base, | ||
l4-1-24g,8,48,10,0,1,scw_l4.base, | ||
l4-2-24g,16,96,10,0,2,scw_l4.base, | ||
l4-4-24g,32,192,10,0,4,scw_l4.base, | ||
l4-8-24g,64,384,10,0,8,scw_l4.base, | ||
l40s-1-48g,8,96,10,0,1,scw_l4.base, | ||
l40s-2-48g,16,192,10,0,2,scw_l4.base, | ||
l40s-4-48g,32,384,10,0,4,scw_l4.base, | ||
l40s-8-48g,64,768,10,0,8,scw_l4.base, | ||
play2-micro,4,8,10,0,0,scw_play2.base, | ||
play2-nano,2,4,10,0,0,scw_play2.base, | ||
play2-pico,1,2,10,0,0,scw_play2.base, | ||
pop2-16c-64g,16,64,10,0,0,scw_pop2.base, | ||
pop2-16c-64g-win,16,64,10,0,0,scw_pop2.base, | ||
pop2-2c-8g,2,8,10,0,0,scw_pop2.base, | ||
pop2-2c-8g-win,2,8,10,0,0,scw_pop2.base, | ||
pop2-32c-128g,32,128,10,0,0,scw_pop2.base, | ||
pop2-32c-128g-win,32,128,10,0,0,scw_pop2.base, | ||
pop2-4c-16g,4,16,10,0,0,scw_pop2.base, | ||
pop2-4c-16g-win,4,16,10,0,0,scw_pop2.base, | ||
pop2-64c-256g,64,256,10,0,0,scw_pop2.base, | ||
pop2-8c-32g,8,32,10,0,0,scw_pop2.base, | ||
pop2-8c-32g-win,8,32,10,0,0,scw_pop2.base, | ||
pop2-hc-16c-32g,16,32,10,0,0,scw_pop2hc.base, | ||
pop2-hc-2c-4g,2,4,10,0,0,scw_pop2hc.base, | ||
pop2-hc-32c-64g,32,64,10,0,0,scw_pop2hc.base, | ||
pop2-hc-4c-8g,4,8,10,0,0,scw_pop2hc.base, | ||
pop2-hc-64c-128g,64,128,10,0,0,scw_pop2hc.base, | ||
pop2-hc-8c-16g,8,16,10,0,0,scw_pop2hc.base, | ||
pop2-hm-16c-128g,16,128,10,0,0,scw_pop2hm.base, | ||
pop2-hm-2c-16g,2,16,10,0,0,scw_pop2hm.base, | ||
pop2-hm-32c-256g,32,256,10,0,0,scw_pop2hm.base, | ||
pop2-hm-4c-32g,4,32,10,0,0,scw_pop2hm.base, | ||
pop2-hm-64c-512g,64,512,10,0,0,scw_pop2hm.base, | ||
pop2-hm-8c-64g,8,64,10,0,0,scw_pop2hm.base, | ||
pop2-hn-10,4,8,10,0,0,scw_pop2.base, | ||
pop2-hn-3,2,4,10,0,0,scw_pop2.base, | ||
pop2-hn-5,4,8,10,0,0,scw_pop2.base, | ||
pro2-l,32,128,10,0,0,scw_pro2.base, | ||
pro2-m,16,64,10,0,0,scw_pro2.base, | ||
pro2-s,8,32,10,0,0,scw_pro2.base, | ||
pro2-xs,4,16,10,0,0,scw_pro2.base, | ||
pro2-xxs,2,8,10,0,0,scw_pro2.base, |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
boaviztapi/data/utils/complete_Scaleway_Instances/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Completing and updating Scaleway Instances data | ||
|
||
The Scaleway export can be done via the [scw-environmental-footprint](https://github.com/Shillaker/scw-environmental-footprint) project, specifically following [this doc](https://github.com/Shillaker/scw-environmental-footprint/blob/main/docs/boavizta.md). | ||
|
||
This does the following: | ||
|
||
- Lists all types of Instances using the Scaleway API | ||
- Maps these to a set of hard-coded base server types (see below) | ||
- Generates two CSV files: `instances.csv` (the instance types), and `servers.csv` (the base servers) | ||
|
||
To add to Boavizta: | ||
|
||
- Copy `instances.csv` to `boaviztapi/data/archetypes/cloud/scaleway.csv` (simply overwrite if updating) | ||
- Add the lines form `servers.csv` to `boaviztapi/data/archetypes/server.csv` (delete all existing servers starting with `scw_` if you are updating) | ||
|
||
## Testing | ||
|
||
1. Update CSV files | ||
2. Build the Docker image locally: `docker build -t boaviztapi-dev .` | ||
3. Run it `docker run -p "5000:5000" -t boaviztapi-dev` | ||
|
||
You can then run the script to check the changes using the `check.py` script in this directory: | ||
|
||
``` | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
pip install -r requirements.txt | ||
python3 check.py | ||
``` | ||
|
||
## Scripting | ||
|
||
It would be much better if this code lived in the Boavizta repo. It can be scripted relatively easily: | ||
|
||
1. Hard-code the base server types held in the [scw-environmental-footprint](https://github.com/Shillaker/scw-environmental-footprint) repo [here](https://github.com/Shillaker/scw-environmental-footprint/blob/main/model/instances.go) | ||
2. Use the [scaleway-sdk-python](https://github.com/scaleway/scaleway-sdk-python) to list all the Instance types | ||
3. Map these the the underlying base server types based on the prefix of the Instance type | ||
4. Print two CSV files: i) `instances.csv` with the instance types; ii) `servers.csv` with the specs of the base servers |
42 changes: 42 additions & 0 deletions
42
boaviztapi/data/utils/complete_Scaleway_Instances/check.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import requests | ||
|
||
CLOUD_URL="http://localhost:5000/v1/cloud/instance" | ||
PROVIDERS_URL=f"{CLOUD_URL}/all_providers" | ||
VALID_INSTANCE_TYPE="dev1-l" | ||
|
||
def main(): | ||
resp = requests.get(PROVIDERS_URL) | ||
|
||
if not resp.ok: | ||
print(f"Providers request failed: {resp.json()}") | ||
exit(1) | ||
|
||
if "scaleway" in resp.json(): | ||
print("Found Scaleway in list of providers") | ||
else: | ||
print("Did not find Scaleway in list of providers: {resp.status_code}") | ||
exit(1) | ||
|
||
url_params = { | ||
"provider": "scaleway", | ||
"instance_type": VALID_INSTANCE_TYPE, | ||
"verbose": True, | ||
"duration": "100", | ||
} | ||
|
||
resp = requests.get(CLOUD_URL, params=url_params) | ||
if resp.ok: | ||
print(f"Got response to impact request for type {VALID_INSTANCE_TYPE}") | ||
else: | ||
print("Did not find Scaleway in list of providers: {resp.status_code}") | ||
exit(1) | ||
|
||
resp_body = resp.json() | ||
for impact_name, impact in resp_body["impacts"].items(): | ||
print(f"\nGot {impact_name}: {impact}") | ||
|
||
cpu = resp_body["verbose"]["CPU-1"]["model_range"]["value"] | ||
print(f"\nGot CPU model: {cpu}") | ||
|
||
if __name__ == "__main__": | ||
main() |
1 change: 1 addition & 0 deletions
1
boaviztapi/data/utils/complete_Scaleway_Instances/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requests==2.32.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.