Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Warnings #1072

Merged
merged 9 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: pip install pre-commit
- run: pre-commit --version
- run: pre-commit install
Expand All @@ -29,9 +29,9 @@ jobs:
toxenv: [pylint, doc8, docs]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
Expand All @@ -45,7 +45,7 @@ jobs:
needs: pretest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand All @@ -59,7 +59,7 @@ jobs:
mv build ..
cd ../../
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
Expand Down Expand Up @@ -92,9 +92,9 @@ jobs:
env:
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -104,7 +104,7 @@ jobs:
- name: Test with tox (and all extra dependencies)
run: tox -e py-all -- --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
Expand All @@ -123,10 +123,10 @@ jobs:
env:
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -138,7 +138,7 @@ jobs:
run: tox -e algo -- tests/unittests/algo/long/${{ matrix.algo }} --color=no

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
Expand All @@ -150,9 +150,9 @@ jobs:
needs: [pre-commit, pretest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
Expand All @@ -162,7 +162,7 @@ jobs:
- name: Test with tox
run: tox -e py -- --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
Expand All @@ -173,9 +173,9 @@ jobs:
needs: [pre-commit, pretest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Setup MongoDB
Expand All @@ -201,7 +201,7 @@ jobs:
- name: Test with tox
run: tox -e mongodb -- --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: backward
Expand All @@ -218,9 +218,9 @@ jobs:
env:
ORION_DB_TYPE: ${{ matrix.orion_db_type }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Setup MongoDB
Expand All @@ -246,7 +246,7 @@ jobs:
- name: Test with tox
run: tox -e backward-compatibility -- --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: backward
Expand All @@ -257,9 +257,9 @@ jobs:
needs: [test, backward-compatibility, test-long-algos, mongodb, test_no_extras, test-dashboard-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
Expand Down Expand Up @@ -341,9 +341,9 @@ jobs:
env:
ANACONDA_TOKEN: ${{ secrets.anaconda_token }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Build conda
Expand Down
2 changes: 1 addition & 1 deletion src/orion/core/cli/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def add_subparser(parser):

def main(args):
"""Starts an application server to serve http requests"""
app = falcon.API()
app = falcon.App()
resource = StaticResource(args)
app.add_sink(resource.on_get)

Expand Down
10 changes: 2 additions & 8 deletions src/orion/core/evc/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,7 @@ def _adapt_parent_trials(node, parent_trials_node, ids):
parent.item["trials"] = [
trial
for trial in parent.item["trials"]
if trial.compute_trial_hash(
trial, ignore_lie=True, ignore_experiment=True
)
not in node_ids
if trial.compute_trial_hash(trial, ignore_lie=True) not in node_ids
]

return node.item, parent_trials_node
Expand Down Expand Up @@ -266,10 +263,7 @@ def _adapt_children_trials(node, children_trials_nodes):
subchild.item["trials"] = [
trial
for trial in subchild.item["trials"]
if trial.compute_trial_hash(
trial, ignore_lie=True, ignore_experiment=True
)
not in ids
if trial.compute_trial_hash(trial, ignore_lie=True) not in ids
]

return node.item, children_trials_nodes
Expand Down
4 changes: 2 additions & 2 deletions src/orion/serving/benchmarks_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def on_get(self, req: Request, resp: Response):
benchmarks = self.storage.fetch_benchmark({})

response = build_benchmarks_response(benchmarks)
resp.body = json.dumps(response)
resp.text = json.dumps(response)

def on_get_benchmark(self, req: Request, resp: Response, name: str):
"""
Expand All @@ -44,4 +44,4 @@ def on_get_benchmark(self, req: Request, resp: Response, name: str):
)

response = build_benchmark_response(benchmark, assessment, task, algorithms)
resp.body = json.dumps(response)
resp.text = json.dumps(response)
6 changes: 3 additions & 3 deletions src/orion/serving/experiments_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def on_get(self, req: Request, resp: Response):
leaf_experiments = _find_latest_versions(experiments)

response = build_experiments_response(leaf_experiments)
resp.body = json.dumps(response)
resp.text = json.dumps(response)

def on_get_experiment(self, req: Request, resp: Response, name: str):
"""
Expand All @@ -47,7 +47,7 @@ def on_get_experiment(self, req: Request, resp: Response, name: str):
best_trial = _retrieve_best_trial(experiment)

response = build_experiment_response(experiment, status, algorithm, best_trial)
resp.body = json.dumps(response)
resp.text = json.dumps(response)

def on_get_experiment_status(self, req: Request, resp: Response, name: str):
"""
Expand All @@ -57,7 +57,7 @@ def on_get_experiment_status(self, req: Request, resp: Response, name: str):
verify_query_parameters(req.params, ["version"])
version = req.get_param_as_int("version")
experiment = retrieve_experiment(self.storage, name, version)
resp.body = json.dumps(experiment.stats.to_json())
resp.text = json.dumps(experiment.stats.to_json())


def _find_latest_versions(experiments):
Expand Down
8 changes: 6 additions & 2 deletions src/orion/serving/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def verify_query_parameters(parameters: dict, supported_parameters: list):
for parameter in parameters:
if parameter not in supported_parameters:
description = _compose_error_message(parameter, supported_parameters)
raise falcon.HTTPBadRequest(ERROR_INVALID_PARAMETER, description)
raise falcon.HTTPBadRequest(
title=ERROR_INVALID_PARAMETER, description=description
)


def verify_status(status):
Expand All @@ -51,7 +53,9 @@ def verify_status(status):
list(Trial.allowed_stati)
)

raise falcon.HTTPBadRequest(ERROR_INVALID_PARAMETER, description)
raise falcon.HTTPBadRequest(
title=ERROR_INVALID_PARAMETER, description=description
)


def _compose_error_message(key: str, supported_parameters: list):
Expand Down
8 changes: 4 additions & 4 deletions src/orion/serving/plots_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def on_get_lpi(self, req: Request, resp: Response, experiment_name: str):
experiment = ExperimentClient(
retrieve_experiment(self.storage, experiment_name), None
)
resp.body = experiment.plot.lpi().to_json()
resp.text = experiment.plot.lpi().to_json()

def on_get_parallel_coordinates(
self, req: Request, resp: Response, experiment_name: str
Expand All @@ -39,7 +39,7 @@ def on_get_parallel_coordinates(
experiment = ExperimentClient(
retrieve_experiment(self.storage, experiment_name), None
)
resp.body = experiment.plot.parallel_coordinates().to_json()
resp.text = experiment.plot.parallel_coordinates().to_json()

def on_get_partial_dependencies(
self, req: Request, resp: Response, experiment_name: str
Expand All @@ -52,7 +52,7 @@ def on_get_partial_dependencies(
experiment = ExperimentClient(
retrieve_experiment(self.storage, experiment_name), None
)
resp.body = experiment.plot.partial_dependencies().to_json()
resp.text = experiment.plot.partial_dependencies().to_json()

def on_get_regret(self, req: Request, resp: Response, experiment_name: str):
"""
Expand All @@ -62,4 +62,4 @@ def on_get_regret(self, req: Request, resp: Response, experiment_name: str):
experiment = ExperimentClient(
retrieve_experiment(self.storage, experiment_name), None
)
resp.body = experiment.plot.regret().to_json()
resp.text = experiment.plot.regret().to_json()
2 changes: 1 addition & 1 deletion src/orion/serving/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def on_get(self, req, resp):
"database": database,
}

resp.body = json.dumps(response, indent=4)
resp.text = json.dumps(response, indent=4)
4 changes: 2 additions & 2 deletions src/orion/serving/trials_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def on_get_trials_in_experiment(
trials = experiment.fetch_trials(with_ancestors)

response = build_trials_response(trials)
resp.body = json.dumps(response)
resp.text = json.dumps(response)

def on_get_trial_in_experiment(
self, req: Request, resp: Response, experiment_name: str, trial_id: str
Expand All @@ -57,4 +57,4 @@ def on_get_trial_in_experiment(
trial = retrieve_trial(experiment, trial_id)

response = build_trial_response(trial)
resp.body = json.dumps(response)
resp.text = json.dumps(response)
2 changes: 1 addition & 1 deletion src/orion/serving/webapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def middleware(self):
return MyCORSMiddleware(self)


class WebApi(falcon.API):
class WebApi(falcon.App):
"""
Main entry point into a Falcon-based app. An instance provides a callable WSGI interface and a
routing engine.
Expand Down
1 change: 0 additions & 1 deletion tests/unittests/algo/test_evolution_es.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def rung_4(space1: Space):
trial_hash = trial.compute_trial_hash(
trial,
ignore_fidelity=True,
ignore_experiment=True,
)
assert trial.objective is not None
results[trial_hash] = (trial.objective.value, trial)
Expand Down
1 change: 1 addition & 0 deletions tests/unittests/benchmark/task/profet/test_profet_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def test_mock_load_data_fixture_when_real_data_available(
assert min_c <= real_c.min() and min_c <= fake_c.min()
assert real_c.max() <= max_c and fake_c.max() <= max_c

@pytest.mark.filterwarnings("ignore:Checkpoint file")
@pytest.mark.timeout(30)
@pytest.mark.parametrize("device_str", _devices)
def test_attributes(
Expand Down
15 changes: 10 additions & 5 deletions tests/unittests/client/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ def make_runner(n_workers, max_trials_per_worker, pool_size=None):
runner.client.close()


def run_runner(reraise=False, executor=None):
def run_runner(reraise=False, executor=None, close_executor=True):
try:
count = 10
max_trials = 10
Expand All @@ -591,7 +591,10 @@ def set_is_done():
thread = Thread(target=set_is_done)
thread.start()

with executor:
if close_executor:
with executor:
runner.run()
else:
runner.run()

print("done")
Expand Down Expand Up @@ -675,11 +678,13 @@ def run(self):
def test_runner_inside_dask():
"""Runner can not execute inside a dask worker"""

executor = Dask()
with Dask() as executor:

future = executor.submit(run_runner, executor=executor, reraise=True)
future = executor.submit(
run_runner, executor=executor, reraise=True, close_executor=False
)

assert future.get() == 0
assert future.get() == 0


def test_custom_prepare_trial():
Expand Down
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ commands =
addopts = -ra -q --color=yes
norecursedirs = .* *.egg* config docs dist build
xfail_strict = True
rsyncdirs = src tests
bouthilx marked this conversation as resolved.
Show resolved Hide resolved
looponfailroots = src tests examples

# Coverage configuration
[coverage:run]
Expand Down