(number: int)
| 205 | raise ValueError("Start independent runs outside an active execution session") |
| 206 | |
| 207 | async def run_one(number: int) -> RunResult: |
| 208 | flow = WharfDemoFlow(tracing=True) |
| 209 | output, error = "", None |
| 210 | try: |
| 211 | result = await flow.kickoff_async( |
| 212 | inputs={"topic": topic, "run_number": number} |
| 213 | ) |
| 214 | if not isinstance(result, str): |
| 215 | raise TypeError("Expected the Flow to return a summary string") |
| 216 | output = result |
| 217 | except Exception as exc: |
| 218 | error = f"{type(exc).__name__}: {exc}" |
| 219 | return RunResult( |
| 220 | run_number=number, |
| 221 | execution_uuid=flow.state.execution_uuid, |
| 222 | trace_id=flow.state.trace_id, |
| 223 | output=output, |
| 224 | error=error, |
| 225 | ) |
| 226 | |
| 227 | return await asyncio.gather(*(run_one(number) for number in range(1, runs + 1))) |
| 228 |
no test coverage detected