This repository contains python clients to produce statistics that can be used by EGI Foundation team to identify trends and monitor progress following the Objectives and Key Results (OKRs) goal-setting framework.
Specifically, the statistics generated by these python clients are:
- Cloud CPU/h consumed by the production VOs of EGI
- HTC CPU/h consumed by the production VOs of EGI
- Num. of 'active', 'total' and 'actual' users of the production VOs registered in the EGI Operations Portal
- Num. of Service Orders (SOs) received from the EOSC MarketPlace
- ...
The statistics generated by these python clients will be pushed in a Google Worksheet using the gspread APIs
Python 3.10.12+
installed on your local computer- Install pip3:
apt-get install -y python3-pip
- Install gspread API:
sudo pip3 install gspread
- Install venv:
sudo apt install -y python3-venv
In order to read from and write data to Google Sheets in Python, we will have to create a Google Service Account.
Instructions to create a Google Service Account are the following:
- Head over to Google developer console and click on Create Project
- Fill in the required fields and click on Create
- Click on Enable API and Services
- Search for Google Drive API and click on Enable
- Search for the Google Sheets API and click on Enable
- Click on Create Credentials
- Select Google Drive API as the API and Web server
- Name the service account, then grant it a Project role with Editor access
- Click on Continue
- The credentials will be created and downloaded as a JSON file
- Copy the JSON file to your code directory and rename it to
credentials.json
Use virtualenv to configure the working environment:
]$ virtualenv -p /usr/bin/python3.10 venv
created virtual environment CPython3.10.12.final.0-64 in 1748ms
[..]
]$ source venv/bin/activate
Install the library gspread
with pip3:
]$ pip3 install gspread
[..]
This GitHub repository includes clients to calculate: