adding precommit check (#930)

* adding precommit check

* run precommit

* Apply suggestions from code review

Co-authored-by: Zvi Baratz <z.baratz@gmail.com>

* apply precommit

---------

Co-authored-by: Zvi Baratz <z.baratz@gmail.com>
This commit is contained in:
Jirka Borovec
2023-02-28 17:29:07 +01:00
committed by GitHub
parent 2ff1035733
commit a340919458
3 changed files with 37 additions and 3 deletions

26
.github/workflows/pre-commit.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Code formatting
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
push:
branches: [main]
pull_request: {}
defaults:
run:
shell: bash
jobs:
pre-commit-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Set $PY environment variable
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/action@v3.0.0

View File

@@ -61,8 +61,15 @@ def load_config_predictor(estimator_name, task, location=None):
return predictor
def suggest_config(task, X, y, estimator_or_predictor, location=None, k=None, meta_feature_fn=meta_feature):
def suggest_config(
task,
X,
y,
estimator_or_predictor,
location=None,
k=None,
meta_feature_fn=meta_feature,
):
"""Suggest a list of configs for the given task and training data.
The returned configs can be used as starting points for AutoML.fit().

View File

@@ -281,7 +281,8 @@ class PySparkOvertimeMonitor:
def __enter__(self):
"""Enter the context manager.
This will start a monitor thread if spark is available and force_cancel is True."""
This will start a monitor thread if spark is available and force_cancel is True.
"""
if self._force_cancel and _have_spark:
self._monitor_daemon = threading.Thread(target=self._monitor_overtime)
# logger.setLevel("INFO")