liveBook · Manning

Asyncio process.terminate

As explained in Python Concurrency with asyncio

asyncio process.terminate is a non-blocking method that sends SIGTERM to the represented subprocess.

asyncio process.terminate is a non-blocking Process method that sends SIGTERM to a subprocess. Use it when waiting for the subprocess exceeds an allowed timeout, then await process.wait() to collect completion. section 13.1

How Python Concurrency with asyncio covers it

How deep it goes
Demonstrates termination in runnable timeout-handling code but does not detail signal delivery internals.
Examples
Uses a three-second sleep subprocess, a one-second wait_for timeout, and a resulting status output of -15.
What it assumes
Assumes familiarity with asyncio coroutines, subprocess creation, and awaiting Process.wait().
What you can do after
Operate/configure it by terminating a subprocess after asyncio.wait_for raises asyncio.TimeoutError, then awaiting its final status.
How it connects
Connects Process termination with asyncio subprocess creation, asyncio.wait_for, process.wait(), and SIGTERM.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Python Concurrency with asyncio. The section links point to the parts of the book it draws on.