Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server data model #4

Closed
da-ekchajzer opened this issue Nov 15, 2021 · 15 comments
Closed

Server data model #4

da-ekchajzer opened this issue Nov 15, 2021 · 15 comments
Assignees

Comments

@da-ekchajzer
Copy link
Collaborator

da-ekchajzer commented Nov 15, 2021

Epic

Server

Route(s) involved

/v1/server/ref_data
/v1/server/bottom_up
/v1/server/

Description

The server data model contains all the data describing a server, except for its impact. When fully filled, a server object contains :

  • The data needed to apply the bottom-up methodology
  • Data to identify user servers close (model/configuration) to existing server in the database

Example

{
"model":{
   "brand": "Dell",
   "name": "R740",
   "type": "rack",
   "year": 2020
},
"configuration": {
    "cpu":{
        "number": 2,
        "core_number": 24
        "die": 0.245,
        "manufacturer": "Intel",
        "model": "",
        "cpu_family":
    },
    "ram":{
        "capacity": 32,
        "quantity": 12,
        "die": 1.79,
        "manufacturer": "Samsung",
        "model": "",
        "integrator": "Corsaire"
    },
    "ssd":{
        "capacity": 400,
        "quantity": 1,
        "die": 50.6,
        "manufacturer": "Samsung",
        "model": ""
        
    },
    "hdd":{
        "number": 0,
        "manufacturer": "Samsung",
        "model": ""
    },
   "power_supply":{
         "weight": 10,
         "quantity": 1
    }
}
add-method:
add-date:
}
@AirLoren

This comment has been minimized.

@benjaminlebigot

This comment has been minimized.

@benjaminlebigot

This comment has been minimized.

benjaminlebigot added a commit that referenced this issue Dec 2, 2021
@benjaminlebigot
Copy link
Contributor

useful for next time :

https://jsontopydantic.com/

@samuelrince
Copy link
Member

JSON Schema:

{
  "title": "Server",
  "type": "object",
  "properties": {
    "model": {
      "$ref": "#/definitions/ModelServer"
    },
    "configuration": {
      "$ref": "#/definitions/ConfigurationServer"
    },
    "add_method": {
      "title": "Add Method",
      "type": "string"
    },
    "add_date": {
      "title": "Add Date",
      "type": "string"
    }
  },
  "definitions": {
    "ModelServer": {
      "title": "ModelServer",
      "type": "object",
      "properties": {
        "manufacturer": {
          "title": "Manufacturer",
          "type": "string"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "type": {
          "title": "Type",
          "type": "string"
        },
        "year": {
          "title": "Year",
          "type": "string"
        }
      }
    },
    "Cpu": {
      "title": "Cpu",
      "type": "object",
      "properties": {
        "units": {
          "title": "Units",
          "type": "integer"
        },
        "core_units": {
          "title": "Core Units",
          "type": "integer"
        },
        "die_size": {
          "title": "Die Size",
          "type": "number"
        },
        "die_size_per_core": {
          "title": "Die Size Per Core",
          "type": "number"
        },
        "process": {
          "title": "Process",
          "type": "number"
        },
        "manufacturer": {
          "title": "Manufacturer",
          "type": "string"
        },
        "manufacture_date": {
          "title": "Manufacture Date",
          "type": "string"
        },
        "model": {
          "title": "Model",
          "type": "string"
        },
        "family": {
          "title": "Family",
          "type": "string"
        }
      }
    },
    "Ram": {
      "title": "Ram",
      "type": "object",
      "properties": {
        "units": {
          "title": "Units",
          "type": "integer"
        },
        "capacity": {
          "title": "Capacity",
          "type": "integer"
        },
        "density": {
          "title": "Density",
          "type": "number"
        },
        "process": {
          "title": "Process",
          "type": "number"
        },
        "manufacturer": {
          "title": "Manufacturer",
          "type": "string"
        },
        "manufacture_date": {
          "title": "Manufacture Date",
          "type": "string"
        },
        "model": {
          "title": "Model",
          "type": "string"
        },
        "integrator": {
          "title": "Integrator",
          "type": "string"
        }
      }
    },
    "Disk": {
      "title": "Disk",
      "type": "object",
      "properties": {
        "units": {
          "title": "Units",
          "type": "integer"
        },
        "type": {
          "title": "Type",
          "type": "string"
        },
        "capacity": {
          "title": "Capacity",
          "type": "integer"
        },
        "density": {
          "title": "Density",
          "type": "number"
        },
        "manufacturer": {
          "title": "Manufacturer",
          "type": "string"
        },
        "manufacture_date": {
          "title": "Manufacture Date",
          "type": "string"
        },
        "model": {
          "title": "Model",
          "type": "string"
        }
      }
    },
    "PowerSupply": {
      "title": "PowerSupply",
      "type": "object",
      "properties": {
        "units": {
          "title": "Units",
          "type": "integer"
        },
        "unit_weight": {
          "title": "Unit Weight",
          "type": "number"
        }
      }
    },
    "ConfigurationServer": {
      "title": "ConfigurationServer",
      "type": "object",
      "properties": {
        "cpu": {
          "$ref": "#/definitions/Cpu"
        },
        "ram": {
          "title": "Ram",
          "type": "array",
          "items": {
            "$ref": "#/definitions/Ram"
          }
        },
        "disk": {
          "title": "Disk",
          "type": "array",
          "items": {
            "$ref": "#/definitions/Disk"
          }
        },
        "power_supply": {
          "$ref": "#/definitions/PowerSupply"
        }
      }
    }
  }
}

@bertrandkeller
Copy link
Collaborator

J'essaye d'utiliser Eleventy pour constituer mon objet à exploiter.

Je ne sais pas comment stocker au mieux les fichiers "inventaire", je réfléchis pour le moment ça donne
server
└── nom-serveur-1.json
└── nom-serveur-2.json

@da-ekchajzer
Copy link
Collaborator Author

Surement la meilleure manière en effet.
On réfléchit à supporter des CSV en entré, mais ça sera sûrement quand on s'attaquera à une vue système d'information.
Si tu veux un exemple qui fonctionne sur la version qu'on sort cet aprem : #6 (comment)

L'exemple suit le modèle ci-dessus

@bertrandkeller
Copy link
Collaborator

On peut aussi construire un CSV avec des intitulés sous cette forme : configuration:cpu:number

On peut utiliser ce package NPM pour convertir en format structuré :
https://www.npmjs.com/package/treeize

@bertrandkeller
Copy link
Collaborator

Ce qui impliquerait quand même de travail en priorité sur un fichier unique avec plein de serveurs, plutôt que plein de fichiers éclatés.

Pour le CSV, ça donnerait un truc comme ça :

"model:brand","model:name","model:type","model:year","configuration:cpu:number","configuration:cpu:core_number","configuration:cpu:die","configuration:cpu:manufacturer","configuration:cpu:model","configuration:cpu:cpu_family","configuration:ram:capacity","configuration:ram:quantity","configuration:ram:die","configuration:ram:manufacturer","configuration:ram:model","configuration:ram:cpu_family","configuration:ssd:capacity","configuration:ssd:quantity","configuration:ssd:die","configuration:ssd:manufacturer","configuration:ssd:model","configuration:hdd:number","configuration:hdd:manufacturer","configuration:hdd:model","configuration:power_supply:weight","configuration:power_supply:quantity"
"Dell","R740","rack",2020,2,24,0.245,"Intel","",,32,12,1.79,"Samsung","","Corsaire",400,1,50.6,"Samsung","",0,"Samsung","",10,1

@bertrandkeller
Copy link
Collaborator

bertrandkeller commented Dec 10, 2021

Ma lib node n'a pas l'air d'aimer les double quote sur les champs. Donc, ça marche mieux sans double quote.
J'arrive à récupérer le JSON associé.

Si fichier json dans un répertoire, j'envoie le contenu de ce json pour la requête ;
Si csv présent dans le répertoire, je converti le csv, et je m'en sers pour la requête.

Mais l'accès au serveur de test a l'air de ne plus marcher.

model:brand,model:name,model:type,model:year,configuration:cpu:number,configuration:cpu:core_number,configuration:cpu:die,configuration:cpu:manufacturer,configuration:cpu:model,configuration:cpu:cpu_family,configuration:ram:capacity,configuration:ram:quantity,configuration:ram:die,configuration:ram:manufacturer,configuration:ram:model,configuration:ram:cpu_family,configuration:ssd:capacity,configuration:ssd:quantity,configuration:ssd:die,configuration:ssd:manufacturer,configuration:ssd:model,configuration:hdd:number,configuration:hdd:manufacturer,configuration:hdd:model,configuration:power_supply:weight,configuration:power_supply:quantity
Dell,R740,rack,2020,2,24,0.245,Intel,,,32,12,1.79,Samsung,,Corsaire,400,1,50.6,Samsung,,0,Samsung,,10,1

@da-ekchajzer
Copy link
Collaborator Author

da-ekchajzer commented Dec 10, 2021

Hum on a publié ce matin dessus la V0.
Si tu veux voir la doc tu as des exemples de JSON qui fonctionnent bien :
http://149.202.185.115/API/server_route/

@da-ekchajzer
Copy link
Collaborator Author

Tu as une issue dédié ici => #14

@bertrandkeller
Copy link
Collaborator

Ok,

J'obtiens bien le résultat. Je continuerai la semaine prochaine.

J'ai donc script Node. Qui fonctionne avec eleventy et que je dois paramétrer pour fonctionner avec goHugo.
Il génère un objet pour eleventy ou peut écrire un fichier JSON pour Hugo.

Il faut ajouter une colonne au CSV pour avoir le nom de serveur. Ensuite. suffira de savoir ce que je fais avec ces données.

J'ai les informations en entrée que je peux exploiter ; plus celle de l’API que je peux afficher aussi.
Une petite liste de serveurs avec leur impact (plus le total :: la somme de tous).

C'est quoi exactement : gwp, pe, adp ?

@da-ekchajzer
Copy link
Collaborator Author

Quels sont les principaux indicateurs environnementaux considérés ?
Potentiel d’épuisement des ressources abiotiques : ADP (Abiotic Depletion Potential) évalue l'utilisation de minéraux et de matières premières fossiles. L’expression “ressources abiotiques” désigne des ressources non vivantes telles que le sol, l'eau, l'air et les minéraux.Unité : cet indicateur est exprimé en kg d'équivalents d'antimoine (kgSbeq). L'antimoine (symbole Sb) étant l’élément chimique utilisé comme unité de référence pour quantifier une consommation de matière première dans une analyse de cycle de vie.Certaines études différencient les impacts liés aux ressources minérales (ADPe ou ADPelement) et ceux liés aux ressources fossiles (ADPf ou ADPfossils)
Potentiel de gaz à effet de serre : GWP (Global Warming Potential) évalue l'effet sur le réchauffement de la planèteUnité : cet indicateur est exprimé en kilogramme d'équivalents de dioxyde de carbone (kgCO2eq).
Consommation de ressources énergétiques (renouvelables + non renouvelables) : PE (Primary Energy)Unité : cet indicateur est exprimé mégajoules (MJ)

@da-ekchajzer
Copy link
Collaborator Author

je passe nos discussion sur => #14 pour avoir l'historique

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants