This project focuses on the automatic detection of architectural anti-patterns in microservices using Graph Neural Networks (GNNs). Our approach aims to identify design issues early in the development process, providing developers with insights to improve the maintainability and scalability of their systems.
-
Description: This folder contains the training and validation datasets along with the classes required to preprocess them for training.
-
Contents:
-
Training and validation datasets (Download from Google Drive unzip the dataset to the Dataset folder.)
-
Preprocessing classes for training
-
-
Description: This folder contains simulated code for MSNOSE and Arcan-Aroma.
-
Contents:
- Simulated code for MSNOSE and Arcan-Aroma
-
Description: Contains the LLM prompts used to create graph datasets and the code that utilizes OpenAI to generate them.
-
Contents:
- LLM prompts for graph dataset creation
- Code for using OpenAI to generate datasets
- Description: This folder includes subfolders for each GNN model we used; you can simply run any of them to train the model.
- Contents:
- Subfolders for each GNN model
- Training scripts per model
-
Description: A folder that loads the final model, allowing you to test it using your own data.
-
Contents:
- Final model loading scripts
- Testing scripts for custom datasets
-
Clone the repository:
git clone https://github.com/tarvt/artichral-smell-gnn.git
-
Download the dataset from Google Drive unzip the dataset to the Dataset folder.
-
Set Up the Python Environment and Install Dependencies
-
Training the Model
cd train/graphsage python train_gnn.py
The script will automatically:
- Load the data using the MicroservicesDataset class defined in dataset.py. - Train the model using the parameters defined in the script.
First, ensure that you have Python 3.8 or later installed, along with PyTorch and PyTorch Geometric. Install the necessary packages using:
pip install torch torchvision torch-geometric
To run the model on your data, follow these steps:
-
Prepare Your Data: Ensure your data is formatted correctly, according to the model's input requirements.
-
Load and Run the Model: Use the provided script to load your model and run it on the data.
This section explains how to use the test_model
directory to test the GraphSAGENet model with predefined or custom test data. The directory includes a Python script (load_model_test.py
) and a sample data file (test_data.json
) to help you quickly evaluate the model's performance on detecting architectural anti-patterns in microservices.
- Python 3.8 or later
- PyTorch 1.7 or later
- PyTorch Geometric Ensure all dependencies are installed using:
pip install torch torchvision torch-geometric
-
load_model_test.py: The main Python script for loading the model and running the tests.
-
test_data.json: A JSON file containing sample test data formatted to match the expected input schema.
-
Navigate to the Test Model Directory: Change your current working directory to
test_model
where the test script and data are located:cd test_model
- Open the
test_data.json
file to view the test data structure. You can modify this file to include your own test cases following the same format:
{
"Nodes": [[feature1, feature2, ...], ...],
"edge_index": [[source1, source2, ...], [target1, target2, ...]],
"edge_attr": [[attr1, attr2, ...], ...]
}
- Execute the
load_model_test.py
script to load the model and test it on the data provided intest_data.json
:
python load_model_test.py
- The script will output the detection results for each node.