Examine Running Processes and Stop the Supervisors
We examine the which_children function of the supervisor and learn to stop them.
We'll cover the following
The which_children
function
We can get more information about running child processes by using which_children/1
. This function returns a list of tuples. Each tuple has four elements:
-
It contains the child process’s ID, which could be
:undefined
for dynamically started processes. -
It contains the child process’s PID or the
:restarting
value when the process is in the middle of a restart. -
It contains the process’s type, either
:worker
or:supervisor
. -
It also contains the module implementation, which is returned in a list.
Just like count_children/1
, which_children/1
is also implemented in the DynamicSupervisor
and Supervisor
modules.
Examine how our job process is started
Get hands-on with 1300+ tech skills courses.