Skip to content

Commit e0b2fc8

Browse files
authored
Refactored scripts location (#815)
1 parent 9d1d769 commit e0b2fc8

18 files changed

+31
-31
lines changed

.github/workflows/build-and-run-tests-from-branch.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ jobs:
7373
- name: Run monitoring
7474
run: |
7575
echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
76-
chmod +x ./scripts/monitoring.sh
77-
./scripts/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
76+
chmod +x ./scripts/project/monitoring.sh
77+
./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
7878
- name: Run tests
7979
run: |
8080
gradle --no-daemon :utbot-framework:test ${{ matrix.project.TESTS_TO_RUN }}
@@ -131,8 +131,8 @@ jobs:
131131
- name: Run monitoring
132132
run: |
133133
echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
134-
chmod +x ./scripts/monitoring.sh
135-
./scripts/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
134+
chmod +x ./scripts/project/monitoring.sh
135+
./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
136136
- name: Run tests
137137
run: |
138138
cd ${{ matrix.project }}

.github/workflows/run-chosen-tests-from-branch.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
- name: Run monitoring
4646
run: |
4747
echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
48-
chmod +x ./scripts/monitoring.sh
49-
./scripts/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
48+
chmod +x ./scripts/project/monitoring.sh
49+
./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
5050
5151
- name: Run chosen tests
5252
run: |

docs/jlearch/pipeline-training-usage.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ Briefly:
3232
To do this, you should:
3333
* Be sure that you use `Java 8` by `java` command and set `JAVA_HOME` to `Java 8`.
3434
* Put projects, on which you want to learn in `contest_input/projects` folder, then list classes, on which you want to learn in `contest_input/classes/<project name>/list` (if it is empty, than we will take all classes from project jar).
35-
* Run `pip install -r scripts/requirements.txt`. It is up to you to make it in virtual environment or not.
36-
* List selectors in `scripts/selector_list` and projects in `scripts/prog_list`
37-
* Run `./scripts/train_iteratively.sh `
35+
* Run `pip install -r scripts/ml/requirements.txt`. It is up to you to make it in virtual environment or not.
36+
* List selectors in `scripts/ml/selector_list` and projects in `scripts/ml/prog_list`
37+
* Run `./scripts/ml/train_iteratively.sh `

docs/jlearch/scripts.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ For each scenario: go to root of `UTBotJava` repository - it is `WORKDIR`.
55

66
Before start of work run:
77
```bash
8-
./scripts/prepare.sh
8+
./scripts/ml/prepare.sh
99
```
1010

1111
It will copy contest resources in `contest_input` folder and build the project, because we use jars, so if you want to change something in code and re-run scripts, then you should run:
@@ -16,11 +16,11 @@ It will copy contest resources in `contest_input` folder and build the project,
1616
## To Train a few iterations of your models:
1717
By default features directory is `eval/features` - it should be created, to change it you should manually do it in source code of scripts.
1818

19-
List projects and selectors on what you want to train in `scripts/prog_list` and `scripts/selector_list`. You will be trained on all methods of all classes from `contest_input/classes/<project name>/list`.
19+
List projects and selectors on what you want to train in `scripts/ml/prog_list` and `scripts/selector_list`. You will be trained on all methods of all classes from `contest_input/classes/<project name>/list`.
2020

2121
Then just run:
2222
```bash
23-
./scripts/train_iteratively.sh <time_limit> <iterations> <output_dir> <python_command>
23+
./scripts/ml/train_iteratively.sh <time_limit> <iterations> <output_dir> <python_command>
2424
```
2525
Python command is your command for python3, in the end of execution you will get iterations models in `<output_dir>` folder and features for each selector and project in `<features_dir>/<selector>/<project>` for `selector` from `selectors_list` and in `<features_dir>/jlearch/<selector>/<prog>` for models.
2626

@@ -29,15 +29,15 @@ Check that `srcTestDir` with your project exist in `build.gradle` of `utbot-juni
2929

3030
Then just run:
3131
```bash
32-
./scripts/run_with_coverage.sh <project> <time_limit> <path_selector> <selector_alias>
32+
./scripts/ml/run_with_coverage.sh <project> <time_limit> <path_selector> <selector_alias>
3333
```
3434

3535
In the end of execution you will get jacoco report in `eval/jacoco/<project>/<selector_alias>/` folder.
3636

3737
## To estimate quality
3838
Just run:
3939
```bash
40-
./scripts/quality_analysis.sh <project> <selector_aliases, separated by comma>
40+
./scripts/ml/quality_analysis.sh <project> <selector_aliases, separated by comma>
4141
```
4242
It will take coverage reports from relative report folders (at `eval/jacoco/project/alias`) and generate charts in `$outputDir/<project>/<timestamp>.html`.
4343
`outputDir` can be changed in `QualityAnalysisConfig`. Result file will contain information about 3 metrics:

docs/jlearch/setup.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# How to setup environment for experiments on Linux
22

33
* Clone repository, go to root
4-
* `chmod +x ./scripts/*` and `chmod +x gradlew`.
4+
* `chmod +x ./scripts/ml/*` and `chmod +x gradlew`.
55
* Set `Java 8` as default and set `JAVA_HOME` to this `Java`.
66
For example
77
* Go through [this](https://sdkman.io/install) until `Windows installation`
@@ -17,19 +17,19 @@
1717
* `python3 -m venv /path/to/new/virtual/environment`
1818
* `source /path/to/venv/bin/activate`
1919
* Check `which python3`, it should be somewhere in `path/to/env` folder.
20-
* `pip install -r scripts/requirements.txt`
21-
* `./scripts/prepare.sh`
22-
* Change `scripts/prog_list` to run on smaller project or delete some classes from `contest_input/classes/<project>/list`.
20+
* `pip install -r scripts/ml/requirements.txt`
21+
* `./scripts/ml/prepare.sh`
22+
* Change `scripts/ml/prog_list` to run on smaller project or delete some classes from `contest_input/classes/<project>/list`.
2323

2424
# Default settings and how to change it
25-
* You can reduce number of models in `models` variable in `scripts/train_iteratively.sh`
25+
* You can reduce number of models in `models` variable in `scripts/ml/train_iteratively.sh`
2626
* You can change amount of required RAM in `run_contest_estimator.sh`: `16 gb` by default
2727
* You can change `batch_size` or `device` n `train.py`: `4096` and `gpu` by default
2828
* If you are completing setup on server, then you will need to uncomment tmp directory option in `run_contest_estimator.sh`
2929

3030
# Continue setup
31-
* `scripts/train_iteratively.sh 30 2 models <your python3 command>`
31+
* `scripts/ml/train_iteratively.sh 30 2 models <your python3 command>`
3232
* In `models/` you should get models.
3333
* `mkdir eval/jacoco`
34-
* `./scripts/run_with_coverage.sh <any project (guava-26.0, for example)> 30 "NN_REWARD_GUIDED_SELECTOR path/to/model" some_alias`. `path/to/model` should be something like `models/nn32/0`, where `nn32` is a type of model and `0` is the iteration number
34+
* `./scripts/ml/run_with_coverage.sh <any project (guava-26.0, for example)> 30 "NN_REWARD_GUIDED_SELECTOR path/to/model" some_alias`. `path/to/model` should be something like `models/nn32/0`, where `nn32` is a type of model and `0` is the iteration number
3535
* You should get jacoco report in `eval/jacoco/guava-26.0/some_alias/`
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/run_with_coverage.sh renamed to scripts/ml/run_with_coverage.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [[ -n $COVERAGE_PROCESSING ]]; then
1313
fi
1414

1515
WORKDIR="."
16-
$WORKDIR/scripts/run_contest_estimator.sh $PROJECT $TIME_LIMIT "$PATH_SELECTOR" "" "$COVERAGE_PROCESSING"
16+
$WORKDIR/scripts/ml/run_contest_estimator.sh $PROJECT $TIME_LIMIT "$PATH_SELECTOR" "" "$COVERAGE_PROCESSING"
1717

1818
./gradlew :utbot-junit-contest:test :utbot-junit-contest:jacocoTestReport
1919

File renamed without changes.
File renamed without changes.

scripts/train_data.sh renamed to scripts/ml/train_data.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ while read prog; do
99
while read selector; do
1010
echo "Starting features collection from $prog with $selector"
1111
selector="${selector%%[[:cntrl:]]}"
12-
$WORKDIR/scripts/run_contest_estimator.sh "$prog" "$TIME_LIMIT" "$selector" true
13-
done <"$WORKDIR/scripts/selector_list"
14-
done <"$WORKDIR/scripts/prog_list"
12+
$WORKDIR/scripts/ml/run_contest_estimator.sh "$prog" "$TIME_LIMIT" "$selector" true
13+
done <"$WORKDIR/scripts/ml/selector_list"
14+
done <"$WORKDIR/scripts/ml/prog_list"

scripts/train_iteratively.sh renamed to scripts/ml/train_iteratively.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ WORKDIR="."
1111

1212
echo "Start training data on heuristical based selectors"
1313

14-
$WORKDIR/scripts/train_data.sh $TIME_LIMIT
14+
$WORKDIR/scripts/ml/train_data.sh $TIME_LIMIT
1515

1616
echo "Start iterative learning of models"
1717

@@ -28,7 +28,7 @@ do
2828
echo "EXTRA_ARGS=$EXTRA_ARGS"
2929
fi
3030

31-
COMMAND="$PYTHON_COMMAND $WORKDIR/scripts/train.py --features_dir $WORKDIR/eval/features --output_dir $OUTPUT_DIR/$model/$i --prog_list $WORKDIR/scripts/prog_list --model $model $EXTRA_ARGS"
31+
COMMAND="$PYTHON_COMMAND $WORKDIR/scripts/ml/train.py --features_dir $WORKDIR/eval/features --output_dir $OUTPUT_DIR/$model/$i --prog_list $WORKDIR/scripts/prog_list --model $model $EXTRA_ARGS"
3232
echo "TRAINING COMMAND=$COMMAND"
3333
$COMMAND
3434
done
@@ -44,7 +44,7 @@ do
4444
PREDICTOR="LINEAR"
4545
fi
4646

47-
$WORKDIR/scripts/run_contest_estimator.sh $prog $TIME_LIMIT "NN_REWARD_GUIDED_SELECTOR $OUTPUT_DIR/$model/$i $PREDICTOR" "true eval/features/jlearch/$model$i/$prog"
47+
$WORKDIR/scripts/ml/run_contest_estimator.sh $prog $TIME_LIMIT "NN_REWARD_GUIDED_SELECTOR $OUTPUT_DIR/$model/$i $PREDICTOR" "true eval/features/jlearch/$model$i/$prog"
4848
done
49-
done <"$WORKDIR/scripts/prog_list"
49+
done <"$WORKDIR/scripts/ml/prog_list"
5050
done

scripts/monitoring.sh renamed to scripts/project/monitoring.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ if ! netstat -tulpn | grep -q ${PORT_NODE_EXPORTER} ; then
5353
fi
5454

5555
# custom java processes memory metrics
56-
chmod +x scripts/ps_parser.sh
56+
chmod +x scripts/project/ps_parser.sh
5757
while true; do
58-
./scripts/ps_parser.sh | curl -u "${PUSHGATEWAY_USER}":"${PUSHGATEWAY_PASSWORD}" --data-binary @- "https://${PUSHGATEWAY_HOSTNAME}${PUSHGATEWAY_ADDITIONAL_PATH}/metrics/job/pushgateway/instance/${GITHUB_RUN_ID}-${HOSTNAME}${PROM_ADDITIONAL_LABELS}" 2>/dev/null
58+
./scripts/project/ps_parser.sh | curl -u "${PUSHGATEWAY_USER}":"${PUSHGATEWAY_PASSWORD}" --data-binary @- "https://${PUSHGATEWAY_HOSTNAME}${PUSHGATEWAY_ADDITIONAL_PATH}/metrics/job/pushgateway/instance/${GITHUB_RUN_ID}-${HOSTNAME}${PROM_ADDITIONAL_LABELS}" 2>/dev/null
5959
sleep ${SLEEP_TIME_SECONDS}
6060
done &
6161

File renamed without changes.

0 commit comments

Comments
 (0)