ERLANG AND OTP SUPERVISORS
• Task exception was never retrieved – Oops!
init(_Args) -"
SupFlags = #%strategy =' one_for_one, intensity =' 1, period =' 5},
ChildSpecs = [#%id =' myapp,
start =' {myapp, start_myapp, []},
restart =' permanent,
shutdown =' brutal_kill,
type =' worker,
modules =' [myapp]}],
{ok, {SupFlags, ChildSpecs}}.
32 North Bay Python 2024 – Noah Kantrowitz – @
[email protected]
Another interesting blend of language features and frameworks is
Erlang's Open Telephony Platform or OTP, specifically the Supervisor
system. Erlang programs internally are, to use Python terms, a series
of async tasks all running in parallel. We can certainly do this in
Python but when one of those tasks crashes, it's often difficult to
sort out how to respond exactly. OTP applies similar concepts from
server and container management to individual tasks within a
complex application. We can set the supervisor system to restart
failed tasks automatically, customize exactly how that restart works,
and even build dependency trees where one failed task should kick a
whole pile of other tasks to ensure consistency. This is how Erlang
builds incredibly high uptime systems like phone switches without
requiring magical programmers who never write bugs.