Hi, I'm trying to figure out how to best represent my existing CI pipeline in Dagger, which consists of several build / test / deploy steps, some of which should ideally run in parallel because they are heavily I/O-bound. As a toy example, let me use my Python pipeline from #1379046207527325746 message which defines the following convenience @function:
@function
async def run_pyproject_pipeline(self, pyproject_dir: FilteredPyProjectDir) -> None:
"""
Run the given Python project through a set of standard CI jobs.
"""
await self.check_formatting(pyproject_dir)
await self.lint(pyproject_dir)
await self.typecheck(pyproject_dir)
await self.run_unit_tests(pyproject_dir)
Here, the formatting/lint/typecheck/test @functions are executed one after the other. However, I would like to execute them in parallel. The standard way to do that using Python asyncio would be something like
@function
async def run_pyproject_pipeline(self, pyproject_dir: FilteredPyProjectDir) -> None:
"""
Run the given Python project through a set of standard CI jobs.
"""
await asyncio.wait([
asyncio.create_task(self.check_formatting(pyproject_dir)),
asyncio.create_task(self.lint(pyproject_dir)),
asyncio.create_task(self.typecheck(pyproject_dir)),
asyncio.create_task(self.run_unit_tests(pyproject_dir)),
])
This seems to work but it does mess up Dagger's command line output. What is the recommended way to have a given Dagger function execute several subtasks in parallel?