Skip to content

Commit

Permalink
Beaker DOS fix (#315)
Browse files Browse the repository at this point in the history
* Maximum 50 concurrent requests

* Doc fixes

* Changelog

* Don't murder Beaker

* Formatting
  • Loading branch information
dirkgr authored Jun 16, 2022
1 parent 8b75591 commit 80c90ca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed non-deterministic behavior in `TorchTrainStep`.
- Fixed bug in `BeakerWorkspace` where `.step_info(step)` would raise a `KeyError` if the step hasn't been registered as part of a run yet.
- Fixed a bug in `BeakerWorkspace` where it would send too many requests to the beaker service.


## [v0.9.0](https://github.com/allenai/tango/releases/tag/v0.9.0) - 2022-06-01

Expand Down
14 changes: 5 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Thanks for considering contributing! Please read this document to learn the vari
First, do [a quick search](https://github.com/allenai/tango/issues) to see whether your issue has already been reported.
If your issue has already been reported, please comment on the existing issue.

Otherwise, open [a new GitHub issue](https://github.com/allenai/tango/issues). Be sure to include a clear title
and description. The description should include as much relevant information as possible. The description should
explain how to reproduce the erroneous behavior as well as the behavior you expect to see. Ideally you would include a
Otherwise, open [a new GitHub issue](https://github.com/allenai/tango/issues). Be sure to include a clear title
and description. The description should include as much relevant information as possible. The description should
explain how to reproduce the erroneous behavior as well as the behavior you expect to see. Ideally you would include a
code sample or an executable test case demonstrating the expected behavior.

### Do you have a suggestion for an enhancement or new feature?

We use GitHub issues to track feature requests. Before you create an feature request:
We use GitHub issues to track feature requests. Before you create a feature request:

* Make sure you have a clear idea of the enhancement you would like. If you have a vague idea, consider discussing
it first on a GitHub issue.
Expand Down Expand Up @@ -109,7 +109,7 @@ When you're ready to contribute code to address an open issue, please follow the

<details><summary>Expand details 👇</summary><br/>

Commiting directly to the main branch of your fork is not recommended. It will be easier to keep your fork clean if you work on a seperate branch for each contribution you intend to make.
Committing directly to the main branch of your fork is not recommended. It will be easier to keep your fork clean if you work on a separate branch for each contribution you intend to make.

You can create a new branch with

Expand Down Expand Up @@ -147,10 +147,6 @@ When you're ready to contribute code to address an open issue, please follow the

pytest -v tests/a/b_test.py

Our CI will automatically check that test coverage stays above a certain threshold (around 90%). To check the coverage locally in this example, you could run

pytest -v --cov tango.a.b tests/a/b_test.py

If your contribution involves additions to any public part of the API, we require that you write docstrings
for each function, method, class, or module that you add.
See the [Writing docstrings](#writing-docstrings) section below for details on the syntax.
Expand Down
8 changes: 6 additions & 2 deletions tango/integrations/beaker/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ def registered_runs(self) -> Dict[str, Run]:

runs: Dict[str, Run] = {}

with concurrent.futures.ThreadPoolExecutor() as executor:
with concurrent.futures.ThreadPoolExecutor(
max_workers=3, thread_name_prefix="BeakerWorkspace.registered_runs()-"
) as executor:
run_futures = []
for dataset in self.beaker.workspace.datasets(
match=Constants.RUN_DATASET_PREFIX, results=False
Expand Down Expand Up @@ -292,7 +294,9 @@ def _get_run_from_dataset(self, dataset: Dataset) -> Optional[Run]:

import concurrent.futures

with concurrent.futures.ThreadPoolExecutor() as executor:
with concurrent.futures.ThreadPoolExecutor(
max_workers=3, thread_name_prefix="BeakerWorkspace._get_run_from_dataset()-"
) as executor:
step_info_futures = []
for step_name, unique_id in steps_info.items():
step_info_futures.append(executor.submit(self.step_info, unique_id))
Expand Down

0 comments on commit 80c90ca

Please sign in to comment.