Skip to content

Commit

Permalink
Enable automatic loading of the results folder and update the README …
Browse files Browse the repository at this point in the history
…accordingly.
  • Loading branch information
Hhyemin committed Feb 12, 2025
1 parent affab4e commit 48d8646
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Experiments

The entry point for all experiments performed for the study is the scripts in the *src/suppression_study/experiments* directory.
The entry point for all experiments performed for the study is the scripts in the *src/suppression_study/experiments* directory.
You can run experiments with a command like this:
`python -m suppression_study.experiments.<NameOfExperiment>`

Expand Down Expand Up @@ -43,8 +43,8 @@ The *data* directory contains the following subdirectories and files, most of wh
* Other files are about the studied repositories.
* Subdirectories:
* *data/repos* contains the repositories we study:
* Now it is empty, the experiments will check the existence and clone the repositories as needed.
* **data/results** contains the results of running the experiments:
* Now it is empty, the experiments will check the existence and clone the repositories as needed.
* **data/results** [Load pre-computed results](#load-pre-computed-results), contains the results of running the experiments:
* **[Individual perspective]** *data/results/<repo_name>* contains all results for the repository.
*repo_name*.
* For each project, the following records the detailed results for RQ1 to RQ5:
Expand All @@ -59,7 +59,8 @@ The *data* directory contains the following subdirectories and files, most of wh
* **[Overall perspective] Folders RQ1 to RQ5 contain the overall result of the corresponding research question.**

## Reproducing the results in the paper
Choose between **SLOW MODE**, which extracts the suppressions and warnings and may take several hours, depending on hardware, and **FAST MODE**, which generates the tables and plots (the ones with no manual analysis required) from pre-computed results and should take less than 30 minutes (include cloning the repositories).
Choose between **SLOW MODE**, which extracts the suppressions and warnings and may take several hours, depending on hardware,
and **FAST MODE**, which generates the tables and plots from pre-computed results and should take less than 30 minutes (include cloning the repositories).

**Note**: If no explicit path is written, by default all code files are in *src/suppression_study/experiments* and result files are in *data/results*.

Expand Down Expand Up @@ -90,7 +91,15 @@ Choose between **SLOW MODE**, which extracts the suppressions and warnings and m
* Manual analysis. -> Table 6

### FAST MODE
All tables (exclude the ones require manual analysis) and figures in results:
#### Load pre-computed results
Before generate the table and plots, load the pre-computed results. Here are two options:
* [Option 1] Run LoadPreComputedResults.py, it will automatically load and place the results folder in the correct location.
* [Option 2] Manually download results.zip from release v1.0.0 and extract it into the _data_ folder.

You can check the structure of _data/results_ [here](#structure-of-the-data-directory).

#### Reproduce tables and plots:
All tables and figures (exclude the ones require manual analysis) in results:
* Run CountSuppressionsOnLatestCommit.py -> suppressions_per_repo.tex (part of Table 2).
* Run DistributionOfSuppressionsNumOnMainCommits.py -> Figure 4.
* Run VisualizeLifetimeForAllSuppressions.py -> Figure 5 and commits_and_histories.tex (remaining Part of Table 2).
Expand Down
21 changes: 21 additions & 0 deletions src/suppression_study/experiments/LoadPreComputedResults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import requests
import zipfile
from io import BytesIO


GITHUB_RELEASE_URL = "https://github.com/sola-st/suppression_study/releases/download/v1.0.0/results.zip"
DESTINATION_FOLDER = "./data" # save the results folder inside the "data" folder (data/results).
os.makedirs(DESTINATION_FOLDER, exist_ok=True)

print("Downloading pre-computed results...")
response = requests.get(GITHUB_RELEASE_URL, stream=True)

if response.status_code == 200:
print("Download complete. Extracting files...")
with zipfile.ZipFile(BytesIO(response.content), 'r') as zip_ref:
zip_ref.extractall(DESTINATION_FOLDER)

print(f"Files extracted to: {DESTINATION_FOLDER}")
else:
print(f"Failed to download file. HTTP Status Code: {response.status_code}")

0 comments on commit 48d8646

Please sign in to comment.