Skip to content

Commit

Permalink
Merge branch 'dev' into feat/shillaker/scw-instances
Browse files Browse the repository at this point in the history
  • Loading branch information
da-ekchajzer authored Oct 23, 2024
2 parents e9be353 + d18c244 commit 478857d
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 452 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/generate_requirements_for_clever_cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Generate requirements.txt for clever branches

on:
push:
branches:
- run-clever
- dev-clever
pull_request:
branches:
- run-clever
- dev-clever

jobs:
export-requirements:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # Choose your Python version

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Configure Poetry (no virtualenv)
run: poetry config virtualenvs.create false

- name: Install dependencies
run: poetry install


- name: Export requirements.txt
run: |
poetry export --without-hashes --format=requirements.txt > requirements.txt
- run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- run: git add requirements.txt
- run: git commit --m 'generate requirements.txt from poetry' || exit 0
- run: git push
39 changes: 0 additions & 39 deletions Pipfile

This file was deleted.

12 changes: 6 additions & 6 deletions boaviztapi/data/archetypes/cloud/aws.csv
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ inf2.xlarge,4,16,0,0,1,inf2.48xlarge,
inf2.8xlarge,32,128,0,0,1,inf2.48xlarge,
inf2.24xlarge,96,384,0,0,6,inf2.48xlarge,
inf2.48xlarge,192,768,0,0,12,inf2.48xlarge,
is4gen.medium,1,6,937,0,0,is4gen.8xlarge,
is4gen.large,2,12,1875,0,0,is4gen.8xlarge,
is4gen.xlarge,4,24,3750,0,0,is4gen.8xlarge,
is4gen.2xlarge,8,48,7500,0,0,is4gen.8xlarge,
is4gen.4xlarge,16,96,15000,0,0,is4gen.8xlarge,
is4gen.8xlarge,32,192,30000,0,0,is4gen.8xlarge,
is4gen.medium,1,6,937,0,0,is4gen.metal,
is4gen.large,2,12,1875,0,0,is4gen.metal,
is4gen.xlarge,4,24,3750,0,0,is4gen.metal,
is4gen.2xlarge,8,48,7500,0,0,is4gen.metal,
is4gen.4xlarge,16,96,15000,0,0,is4gen.metal,
is4gen.8xlarge,32,192,30000,0,0,is4gen.metal,
db.m1.medium,1,3.75,0,0,0,platform_aws_m1,https://aws.amazon.com/ec2/previous-generation/
m1.medium,1,3.75,410,0,0,platform_aws_m1,https://aws.amazon.com/ec2/previous-generation/
db.m1.small,1,1.7,0,0,0,platform_aws_m1,https://aws.amazon.com/ec2/previous-generation/
Expand Down
322 changes: 1 addition & 321 deletions boaviztapi/data/archetypes/cloud/azure.csv

Large diffs are not rendered by default.

112 changes: 57 additions & 55 deletions boaviztapi/data/archetypes/server.csv

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion boaviztapi/data/crowdsourcing/cpu_specs.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,6 @@ Intel Xeon E5-2670 V2,Ivy Bridge,,,,,115.0,10.0,20.0,,,,,,541.0,Max value of cpu
Intel Xeon E5-2670 V3,Haswell,,,,,,12.0,24.0,,,,,,622.0,Max value of cpu_manufacture https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Octadeca-core,Intel,Xeon E5,https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/tree/main/data
Intel Xeon E5-2676 V3,Haswell,,,,,120.0,12.0,24.0,,,,,,462.4,Linear regression of cpu_manufacture,Intel,Xeon E5,https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652
Intel Xeon E5-2680 V2,Ivy Bridge,,,,,115.0,10.0,20.0,,,,,,341.0,Value of cpu_manufacture https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Deca-core_Ivy_Bridge_Die,Intel,Xeon E5,https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652
Intel Xeon E5-2686 V4,Broadwell,,,,,145.0,18.0,36.0,,,,,,367.1,Linear regression of cpu_manufacture,Intel,Xeon E5,https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652
Intel Xeon E7-8880 V3,Haswell,,,,,150.0,18.0,36.0,,,,,,570.1,Linear regression of cpu_manufacture,Intel,Xeon E7,https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652
Intel Xeon Platinum 8124M,Skylake,,,,,240.0,18.0,36.0,,,,,,485.0,Value of cpu_manufacture https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#High_Core_Count_.28HCC.29,Intel,Xeon Platinum,https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652
Intel Xeon Platinum 8151,Skylake,,,,,240.0,12.0,24.0,,,,,,336.4,Linear regression of cpu_manufacture,Intel,Xeon Platinum,https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652
Expand All @@ -1789,3 +1788,5 @@ Intel Xeon Platinum 8259CL,Cascade Lake,,,,,210.0,24.0,48.0,,,,,,,,Intel,Xeon Pl
Intel Xeon Platinum 8275CL,Cascade Lake,,,,,240.0,24.0,48.0,,,,,,,,Intel,Xeon Platinum,https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652
Intel Xeon Platinum 8375C,Ice Lake,,,,,300.0,32.0,64.0,,,,,,529.5,Linear regression of cpu_manufacture,Intel,Xeon Platinum,https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652
Intel Xeon Platinum 8488C,Sapphire Rapids,Xeon Platinum (Sapphire Rapids-SP),Intel,,2.4 GHz,385.0,48.0,96.0,,,,,,,,Intel,Xeon Platinum,
Intel Xeon 6455B,Sapphire Rapids,Xeon Scalable (Sapphire Rapids),Intel,2023-10-16,3.9 GHz,350.0,32.0,64.0,,7.0,,,,,,Intel,Xeon, https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit?gid=1498560972#gid=1498560972
Intel Xeon E5-2686 v4,Broadwell,,,,2.3 GHz,145.0,18.0,36.0,,14,,,,456,,,,https://www.x86-guide.net/fr/cpu/Intel-Xeon-E5-2686-v4-cpu-no5808.html
8 changes: 7 additions & 1 deletion boaviztapi/dto/device/device.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Optional, List

from fastapi import HTTPException

from boaviztapi import config
from boaviztapi.dto.component import CPU, RAM, Disk, PowerSupply
from boaviztapi.dto.component.cpu import mapper_cpu
Expand All @@ -14,7 +16,8 @@
from boaviztapi.model.device.server import DeviceServer
from boaviztapi.model.services.cloud_instance import ServiceCloudInstance
from boaviztapi.model.usage import ModelUsage
from boaviztapi.service.archetype import get_server_archetype, get_arch_component, get_cloud_instance_archetype
from boaviztapi.service.archetype import get_server_archetype, get_arch_component, get_cloud_instance_archetype, \
get_arch_value


class DeviceDTO(BaseDTO):
Expand Down Expand Up @@ -75,6 +78,9 @@ class Cloud(Server):


def mapper_cloud_instance(cloud_dto: Cloud, archetype=get_cloud_instance_archetype(config["default_cloud_instance"], config["default_cloud_provider"])) -> ServiceCloudInstance:
if get_server_archetype(archetype_name=get_arch_value(archetype, 'platform', 'default')) is False:
raise HTTPException(status_code=404, detail=f"Cloud platform {get_arch_value(archetype, 'platform', 'default')} not found. Please add it to the server archetypes. For more information, please check the documentation https://doc.api.boavizta.org/contributing/server/.")

model_cloud_instance = ServiceCloudInstance(archetype=archetype)

model_cloud_instance.usage = mapper_usage_cloud(cloud_dto.usage or UsageCloud(), archetype=get_arch_component(model_cloud_instance.archetype, "USAGE"))
Expand Down
8 changes: 7 additions & 1 deletion boaviztapi/routers/utils_router.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import os

import pandas as pd
import toml
from fastapi import APIRouter, Query

from boaviztapi.dto.component.cpu import CPU
Expand All @@ -23,6 +23,12 @@
_ram_manuf = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/ram_manufacture.csv'))



@utils_router.get('/version', description="Get the version of the API")
async def version():
return toml.loads(open(os.path.join(os.path.dirname(__file__), '../../pyproject.toml'), 'r').read())['tool']['poetry'][
'version']

@utils_router.get('/country_code', description=country_code)
async def utils_get_all_countries():
return get_available_countries()
Expand Down
28 changes: 0 additions & 28 deletions requirements.txt

This file was deleted.

15 changes: 15 additions & 0 deletions tests/api/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from httpx import AsyncClient
import re

from boaviztapi.main import app

Expand Down Expand Up @@ -54,3 +55,17 @@ async def test_complete_cpu_from_name():
async with AsyncClient(app=app, base_url="http://test") as ac:
res = await ac.get('/v1/utils/name_to_cpu?cpu_name=deijeijdiejdzij')
assert res.json() == "CPU name deijeijdiejdzij is not found in our database"

@pytest.mark.asyncio
async def test_get_api_version_is_not_empty_string():
async with AsyncClient(app=app, base_url="http://test") as ac:
res = await ac.get('/v1/utils/version')
assert res.json()

# @pytest.mark.asyncio
# async def test_get_api_version_is_semver():
# async with AsyncClient(app=app, base_url="http://test") as ac:
# res = await ac.get('/v1/utils/version')
# # Check returned version matches semver regex
# # See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# assert re.match("^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", res.json())

0 comments on commit 478857d

Please sign in to comment.