Skip to content

Commit

Permalink
larger runner for github actions test (#1665)
Browse files Browse the repository at this point in the history
* Parallel tests with timeout
* docs deploy permission
  • Loading branch information
bottler authored Dec 4, 2024
1 parent eb4c619 commit c66af15
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/every_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ jobs:
runs-on: ubuntu-latest
needs: install
if: github.event_name != 'pull_request'
permissions:
id-token: write
pages: write
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down Expand Up @@ -114,8 +117,7 @@ jobs:
black --version
black nevergrad --check --diff
pytests:
# runs-on: ubuntu-latest-16-cores
runs-on: ubuntu-latest
runs-on: 8-core-ubuntu # 32GB RAM, 8 vCPUs
steps:
- uses: actions/setup-python@v5
with:
Expand All @@ -128,9 +130,9 @@ jobs:
pip install pytest
# run tests with no parallelism
pytest nevergrad -v --durations=20 --cov=nevergrad
# pytest nevergrad -v --durations=20 --timeout=100 --cov=nevergrad
# run in parallel using pytest-xdist
# pytest nevergrad -n auto -v --durations=20 --cov=nevergrad
pytest nevergrad -n auto -v --durations=20 --timeout=100 --cov=nevergrad
#pytest nevergrad -v --exitfirst --durations=20 --cov=nevergrad
9 changes: 5 additions & 4 deletions nevergrad/optimization/test_optimizerlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from . import base, es, experimentalvariants as xpvariants, optimizerlib as optlib
from .optimizerlib import NGOptBase, registry

# pylint: disable=too-many-boolean-expressions,too-many-branches

# decorators to be used when testing on Windows is unecessary
# or cumbersome
Expand Down Expand Up @@ -466,8 +467,8 @@ def save(self) -> None:
# sort and remove unused names
# then update recommendation file
names = sorted(x for x in self.recommendations.index if x in registry)
recom = self.recommendations.loc[names, :]
recom.iloc[:, :] = np.round(recom, 10)
recom = self.recommendations.loc[names]
recom = recom.round(10)
recom.to_csv(self.filepath)


Expand Down Expand Up @@ -733,7 +734,7 @@ def test_bo_init() -> None:
optimizer = my_opt(parametrization=arg, budget=10)
optimizer.minimize(np.abs)
# except NotUniqueError:
except Exception as e:
except Exception as e: # pylint: disable=broad-except
print(f"Problem {e} in Bayesian optimization.") # Anyway Bayesian Optimization is basically weak.


Expand Down Expand Up @@ -1256,7 +1257,7 @@ def f(x, xs=xs):
try:
other = ng.optimizers.registry[o](array, budget=b, num_workers=nw)
val = f(other.minimize(f).value)
except:
except: # pylint: disable=bare-except
print(f"crash in {o}")
val = float(1.0e7)
# print(o, val / vde)
Expand Down
1 change: 1 addition & 0 deletions requirements/bench.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pybullet>=3.2.2
glfw
mujoco
pySOT
pytest-timeout
pytest-xdist
poap
pytest-circleci-parallelized
Expand Down

0 comments on commit c66af15

Please sign in to comment.