This project seamlessly store the battery test record into the InfluxDataBase, offering an efficient solution for write and read data.
- Prerequisites
- Setting up a Virtual Environment
- Installing Dependencies
- Docker
- Usage
- Usage by Docker
- ROSA
- License
- Questions
- Python 3.9 or higher
- pip (comes with Python)
- Docker and Docker-compose (https://www.docker.com)
- OpenShift CLI (https://docs.openshift.com/container-platform/4.11/cli_reference/openshift_cli/getting-started-cli.html)
Virtual environments allow you to manage project-specific dependencies, which can prevent conflicts between versions.
-
Install
virtualenv
(If not installed)pip install virtualenv
-
Navigate to your project directory:
cd /path/to/your/project
-
Create a virtual environment:
virtualenv venv
-
Activate the virtual environment:
-
On macOS and Linux:
source venv/bin/activate
-
On Windows:
.\venv\Scripts\activate
After activation, your command prompt should show the name of the virtual environment (
venv
in this case). -
Once the virtual environment is activated, you can install the project's dependencies.
pip install -r requirements.txt
Install docker: https://www.docker.com/products/docker-desktop/
- Connect our network drive to your PC.
- Navigate to 'docker-compose.yml'.
- Update the 'volumns' to the path of our network drive and map that.
To start the container:
docker-compose up
To stop the container:
docker-compose down
To access the InfluxDB dashboard, navigate to localhost:8086. Log in using the credentials specified in the 'docker-compose.yml' file. Once logged in, locate the 'Data' section and select 'Tokens'. Copy the displayed token and then replace the existing token in the 'influx.env' file with this new one.
To upload the file:
from src.model improt DataManager
data_manager = DataManager()
file_path = "path/to/the/file"
data_manager.write_data(file_path)
To make the query:
from src.model improt DataManager
data_manager = DataManager()
measurement = "GMJuly2022_CELL004_EIS_3d_P25C_25P0PSI_20230324_R0_CH032"
tags = {"ChannelNumber": "CH032", "Pressure": "25P0PSI"}
data = data_manager.query_data(tags=tags)
# OR data = data_manager.query_data(measurement=measurement)
To learn more about the write and query API, hover your cursor over the respective function to view a tooltip or pop-up with detailed instructions and information.
Compose up the container:
sudo docker-compose up -d
Then get in the app container:
sudo docker-compose run --service-ports app
Inside the container, try upload like:
--write /data/PROJ_GMJULY2022/Cycler_Data_By_Cell/GMJuly2022_CELL002/GMJuly2022_CELL002_Test3_1_P0C_5P0PSI_20230505_R0_CH041.csv neware_vdf
Recursive write
--write /data/PROJ_GMJULY2022/Cycler_Data_By_Cell/GMJuly2022_CELL002/ -r
--write /data/PROJ_GMJULY2022/Cycler_Data_By_Cell/GMJuly2022_CELL002/ --recursive
Try query like:
--query GMJuly2022_CELL102_EIS_3d_P25C_5P0PSI_20230717_R0_CA8 Pressure=5P0PSI
Find your oc login API token ,then login like:
oc login --token=bvna2asdasfeR3sdfeSASfnUW6snA2rDm23asd --server=https://api.containersprod.art2.p1.openshiftapps.com:6443
Adjust the YAML files in the 'deployment/kubernetes' folder to match your computing environment.
Apply all the yaml files like:
oc apply -f influxdb-pvc.yaml
This project is licensed under the MIT License.
If you have any questions or encounter any bugs, please raise an issue in our repository or send an email to [email protected]. We greatly appreciate your feedback.