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

Supporting Python 3.11 #5

Merged
merged 3 commits into from
Oct 20, 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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,21 @@ Options:
--service-wait-time FLOAT How long to wait for a service to be up an
running (sec) [default: 3.0]
```

## Development

Make sure you install [pre-commit](https://pre-commit.com/#install) and run:

```shell
pre-commit install
```

For testing you can use e.g.

```shell
poetry run multi-start \
--backend \
--backend-dir ../another-project/src \
--backend-cmd "poetry run invoke dev" \
--backend-port 8080
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "multi-start"
version = "1.0.0"
version = "1.0.1"
description = "Run multiple services inside a docker container"
license = "BSD-3-Clause"
readme = "README.md"
Expand Down
15 changes: 9 additions & 6 deletions src/starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ async def start(
if nginx:
procs.append(await start_service(nginx))

tasks = [p.wait() for p in procs]
tasks.append(self._stop.wait())
await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)

logger.info("Shutting down all processes")
await asyncio.gather(*[stop_process(proc) for proc in procs])
try:
tasks = [asyncio.create_task(p.wait()) for p in procs]
tasks.append(asyncio.create_task(self._stop.wait()))
await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
finally:
logger.info("Shutting down all processes")
await asyncio.gather(
*[asyncio.create_task(stop_process(proc)) for proc in procs]
)