TaskBunny v0.0.1-dev.6 TaskBunny.WorkerSupervisor

Worker supervisor for TaskBunny.

It supervises all Workers with one_for_one strategy.

It will receive all jobs that need workers when started and will start a worker for each job.

Summary

Functions

Similar to graceful_halt/2 but gets pid from module name

Halts the job pocessing on workers gracefully. It makes workers to stop processing new jobs and waits for jobs currently running to finish

Types

jobs()
jobs() :: [{host :: atom, job :: atom, concurrenct :: integer}]

Functions

graceful_halt(timeout)

Similar to graceful_halt/2 but gets pid from module name.

graceful_halt(pid, timeout)
graceful_halt(pid | nil, integer) :: :ok | {:error, any}
graceful_halt(pid, integer) :: :ok | {:error, any}

Halts the job pocessing on workers gracefully. It makes workers to stop processing new jobs and waits for jobs currently running to finish.

Note it doesn’t terminate any worker processes. The worker and worker supervisor processes will continue existing but won’t consume any new messages. To resume it, terminate the worker supervisor then main supervisor will start new processes.

start_link(jobs, name \\ __MODULE__)
start_link(jobs, atom) :: {:ok, pid} | {:error, term}