From e8c56b0281cafbbac8e17ff0905bcf7136d13933 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 16:56:02 +0000 Subject: [PATCH 01/12] Refining badge --- .github/workflows/python-package.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9f2ff28..29648f6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -46,15 +46,27 @@ jobs: - name: Extract coverage percentage id: extract-coverage run: | + echo coverage_report.txt COVERAGE_PERCENTAGE=$(grep -oP 'TOTAL.*?\K\d+(?=%)' coverage_report.txt) echo "::set-output name=coverage::$COVERAGE_PERCENTAGE" + - name: Determine badge color + id: determine-color + run: | + COVERAGE=$(echo "${{ steps.extract-coverage.outputs.coverage }}") + if (( $(echo "$COVERAGE < 70" | bc -l) )); then + echo "::set-output name=color::red" + elif (( $(echo "$COVERAGE < 90" | bc -l) )); then + echo "::set-output name=color::yellow" + else + echo "::set-output name=color::green" + - name: Create Coverage Badge uses: schneegans/dynamic-badges-action@v1.7.0 with: auth: ${{ secrets.GIST_TOKEN }} gistID: 4aa01e058fee448070c587f6967037e4 filename: CodeCovSlune.json # Use test.svg if you want to use the SVG mode. - label: CodeCov - message: "Coverage: ${{ steps.extract-coverage.outputs.coverage }}%" - color: orange + label: Coverage + message: "${{ steps.extract-coverage.outputs.coverage }}%" + color: ${{ steps.determine-color.outputs.color }} From 9fe6e4be9cbf04deb80e07183c5be94349fa5071 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 17:01:54 +0000 Subject: [PATCH 02/12] Refining --- .github/workflows/python-package.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 29648f6..a8e8807 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -46,20 +46,9 @@ jobs: - name: Extract coverage percentage id: extract-coverage run: | - echo coverage_report.txt + less coverage_report.txt COVERAGE_PERCENTAGE=$(grep -oP 'TOTAL.*?\K\d+(?=%)' coverage_report.txt) echo "::set-output name=coverage::$COVERAGE_PERCENTAGE" - - - name: Determine badge color - id: determine-color - run: | - COVERAGE=$(echo "${{ steps.extract-coverage.outputs.coverage }}") - if (( $(echo "$COVERAGE < 70" | bc -l) )); then - echo "::set-output name=color::red" - elif (( $(echo "$COVERAGE < 90" | bc -l) )); then - echo "::set-output name=color::yellow" - else - echo "::set-output name=color::green" - name: Create Coverage Badge uses: schneegans/dynamic-badges-action@v1.7.0 @@ -69,4 +58,4 @@ jobs: filename: CodeCovSlune.json # Use test.svg if you want to use the SVG mode. label: Coverage message: "${{ steps.extract-coverage.outputs.coverage }}%" - color: ${{ steps.determine-color.outputs.color }} + color: ${{ if le(steps.extract-coverage.outputs.coverage, 70) }}red{{ elif le(steps.extract-coverage.outputs.coverage, 90) }}yellow{{ else }}green{{ endif }} From 2bdbe07a7338cd254be11e51ddf886df22e4ae43 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 17:05:32 +0000 Subject: [PATCH 03/12] Had invalid syntax --- .github/workflows/python-package.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a8e8807..d1f79ac 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -50,6 +50,18 @@ jobs: COVERAGE_PERCENTAGE=$(grep -oP 'TOTAL.*?\K\d+(?=%)' coverage_report.txt) echo "::set-output name=coverage::$COVERAGE_PERCENTAGE" + - name: Determine badge color + id: determine-color + run: | + echo "COVERAGE=${{ steps.extract-coverage.outputs.coverage }}" + if [ $(echo "${{ steps.extract-coverage.outputs.coverage }} < 70" | bc -l) -eq 1 ]; then + echo "::set-output name=color::red" + elif [ $(echo "${{ steps.extract-coverage.outputs.coverage }} < 90" | bc -l) -eq 1 ]; then + echo "::set-output name=color::yellow" + else + echo "::set-output name=color::green" + fi + - name: Create Coverage Badge uses: schneegans/dynamic-badges-action@v1.7.0 with: @@ -58,4 +70,4 @@ jobs: filename: CodeCovSlune.json # Use test.svg if you want to use the SVG mode. label: Coverage message: "${{ steps.extract-coverage.outputs.coverage }}%" - color: ${{ if le(steps.extract-coverage.outputs.coverage, 70) }}red{{ elif le(steps.extract-coverage.outputs.coverage, 90) }}yellow{{ else }}green{{ endif }} + color: ${{ steps.determine-color.outputs.color }} \ No newline at end of file From 96ee4210840b7f66f4f508a5a2e031217ca1a102 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 18:20:00 +0000 Subject: [PATCH 04/12] Changing coverage call --- .github/workflows/python-package.yml | 2 +- coverage_report.txt | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 coverage_report.txt diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index d1f79ac..860eb50 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -41,7 +41,7 @@ jobs: - name: Test with pytest and create coverage report run: | - pytest --cov-report term-missing --cov=src tests/ > coverage_report.txt + pytest --cov=src/slune /tests > coverage_report.txt - name: Extract coverage percentage id: extract-coverage diff --git a/coverage_report.txt b/coverage_report.txt new file mode 100644 index 0000000..e69de29 From 48b7c44916d0282a7d13d16ca592be665cf4d051 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 18:26:12 +0000 Subject: [PATCH 05/12] Added pwd for debugging --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 860eb50..c833aad 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -41,6 +41,7 @@ jobs: - name: Test with pytest and create coverage report run: | + pwd pytest --cov=src/slune /tests > coverage_report.txt - name: Extract coverage percentage From 35faf45314b3e6660186cf1ae109dff0b5a06e34 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 18:36:49 +0000 Subject: [PATCH 06/12] Calling python -m now --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c833aad..8b42413 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -42,7 +42,7 @@ jobs: - name: Test with pytest and create coverage report run: | pwd - pytest --cov=src/slune /tests > coverage_report.txt + python -m pytest --cov=src/slune tests/ > coverage_report.txt - name: Extract coverage percentage id: extract-coverage From 87b457327b5dd53c096b0692156a563ee9dea932 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 18:55:14 +0000 Subject: [PATCH 07/12] Added coverage files to ignore --- .github/workflows/python-package.yml | 1 + .gitignore | 6 +++++- README.md | 2 +- coverage_report.txt | 0 4 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 coverage_report.txt diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 8b42413..7e11e97 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -41,6 +41,7 @@ jobs: - name: Test with pytest and create coverage report run: | + cd $GITHUB_WORKSPACE pwd python -m pytest --cov=src/slune tests/ > coverage_report.txt diff --git a/.gitignore b/.gitignore index fea107e..c1f3fdb 100644 --- a/.gitignore +++ b/.gitignore @@ -160,4 +160,8 @@ cython_debug/ #.idea/ # Don't include vs code settings -.vscode \ No newline at end of file +.vscode + +# Don't include coverage reports +.coverage +coverage_report* \ No newline at end of file diff --git a/README.md b/README.md index 49ebe79..07363bc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # slune (= slurm + tune!) -A super simplistic way to perform hyperparameter tuning (or more generally launch jobs and save results) on a cluster using SLURM. Takes advantage of the fact that lots of jobs (including hyperparameter tuning) are embarrassingly parallel! With slune you can divide your compute into lots of separately scheduled jobs meaning that each small job can get running on your cluster more quickly, speeding up your workflow! Often significantly! +A super simplistic python package for performing hyperparameter tuning (or more generally launching jobs and saving results) on a cluster using SLURM. Takes advantage of the fact that lots of jobs (including hyperparameter tuning) are embarrassingly parallel! With slune you can divide your compute into lots of separately scheduled jobs meaning that each small job can get running on your cluster more quickly, speeding up your workflow! Often significantly! Slune is super-easy to use! We have helper functions which can execute everything you need done for you. Letting you speed up your work without wasting time. diff --git a/coverage_report.txt b/coverage_report.txt deleted file mode 100644 index e69de29..0000000 From 4b1cac7691505f9521c292948a28447ad33b8608 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 19:03:22 +0000 Subject: [PATCH 08/12] Edited toml to include coverage setup --- .github/workflows/python-package.yml | 2 +- pyproject.toml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7e11e97..fb3e4e8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -43,7 +43,7 @@ jobs: run: | cd $GITHUB_WORKSPACE pwd - python -m pytest --cov=src/slune tests/ > coverage_report.txt + python -m pytest > coverage_report.txt - name: Extract coverage percentage id: extract-coverage diff --git a/pyproject.toml b/pyproject.toml index 43f69bb..d3c7dd8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,4 +31,7 @@ addopts = "-ra -q" python_classes = ["Test", "Describe"] python_functions = ["test_", "it_", "and_", "but_", "they_"] python_files = ["test_*.py",] -testpaths = ["tests", "integration"] \ No newline at end of file +testpaths = ["tests", "integration"] + +[tool.coverage.run] +source = ["src/slune"] From 20121d35e619aac06ec107b82722480cd91a41e4 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 19:05:50 +0000 Subject: [PATCH 09/12] Didn't commit new changes --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d3c7dd8..00ddae7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,4 +34,6 @@ python_files = ["test_*.py",] testpaths = ["tests", "integration"] [tool.coverage.run] -source = ["src/slune"] +source = ["src/slune"] # Adjust this to match your package source path +branch = true +omit = ["tests/*", "integration/*"] # Adjust as needed \ No newline at end of file From 911f70ca8d82a8c5ec3332f3e3dea1241f89a84f Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 19:07:57 +0000 Subject: [PATCH 10/12] Added commands for debugging --- .github/workflows/python-package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index fb3e4e8..0724f4f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -48,6 +48,8 @@ jobs: - name: Extract coverage percentage id: extract-coverage run: | + pwd + ls less coverage_report.txt COVERAGE_PERCENTAGE=$(grep -oP 'TOTAL.*?\K\d+(?=%)' coverage_report.txt) echo "::set-output name=coverage::$COVERAGE_PERCENTAGE" From 275c09c65e6cb1c56cb50214202bc3d9305d1ca6 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 19:13:47 +0000 Subject: [PATCH 11/12] Create more detailed report --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0724f4f..2c66c4c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -43,7 +43,7 @@ jobs: run: | cd $GITHUB_WORKSPACE pwd - python -m pytest > coverage_report.txt + python -m pytest --cov-report=term-missing > coverage_report.txt - name: Extract coverage percentage id: extract-coverage From 6882a2c30426c7a9a1b46a7650af62786c115116 Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 27 Nov 2023 19:19:32 +0000 Subject: [PATCH 12/12] Coverage output should now be verbose --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2c66c4c..711b470 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -43,7 +43,7 @@ jobs: run: | cd $GITHUB_WORKSPACE pwd - python -m pytest --cov-report=term-missing > coverage_report.txt + coverage run --module pytest --verbose && coverage report --show-missing > coverage_report.txt - name: Extract coverage percentage id: extract-coverage