Visor.intensity
— ConstantMaximun numbers of restart in period seconds.
diff --git a/dev/index.html b/dev/index.html index 19d9af1..8aacfcb 100644 --- a/dev/index.html +++ b/dev/index.html @@ -128,9 +128,9 @@ 6 7 ^C8 -9
Visor.intensity
Visor.Request
Visor.SupervisorResync
Visor.add_node
Visor.add_processes
Visor.call
Visor.call
Visor.cast
Visor.cast
Visor.from
Visor.hassupervised
Visor.ifrestart
Visor.isrequest
Visor.isshutdown
Visor.isshutdown
Visor.process
Visor.process
Visor.receive
Visor.reply
Visor.resync
Visor.setname
Visor.setroot
Visor.setsupervisor
Visor.shutdown
Visor.shutdown
Visor.startup
Visor.startup
Visor.supervise
Visor.supervise
Visor.supervisor
Visor.@isshutdown
Visor.intensity
— ConstantMaximun numbers of restart in period seconds.
Visor.Request
— TypeA response value is expected when a Request message is pushed to the target process inbox.
Visor.SupervisorResync
— TypeTrigger a supervisor resync
Visor.add_node
— Methodadd_node(supervisor::Supervisor, proc::Supervised)
Add supervised proc
to the children's collection of the controlling supervisor
.
Visor.add_processes
— Methodadd_processes(
+9
Visor.intensity
Visor.Request
Visor.SupervisorResync
Visor.add_node
Visor.add_processes
Visor.call
Visor.call
Visor.cast
Visor.cast
Visor.from
Visor.hassupervised
Visor.ifrestart
Visor.isrequest
Visor.isshutdown
Visor.isshutdown
Visor.process
Visor.process
Visor.receive
Visor.reply
Visor.resync
Visor.setname
Visor.setroot
Visor.setsupervisor
Visor.shutdown
Visor.shutdown
Visor.startup
Visor.startup
Visor.supervise
Visor.supervise
Visor.supervisor
Visor.@isshutdown
Visor.intensity
— ConstantMaximun numbers of restart in period seconds.
Visor.Request
— TypeA response value is expected when a Request message is pushed to the target process inbox.
Visor.SupervisorResync
— TypeTrigger a supervisor resync
Visor.add_node
— Methodadd_node(supervisor::Supervisor, proc::Supervised)
Add supervised proc
to the children's collection of the controlling supervisor
.
Visor.add_processes
— Methodadd_processes(
svisor::Supervisor, processes; intensity, period, strategy, terminateif::Symbol=:empty
-)::Supervisor
Setup hierarchy relationship between supervisor and supervised list of processes and configure supervisor behavior.
Visor.call
— Methodcall(name::String, request::Any; timeout::Real=3)
Send a request
to the process identified by full name
and wait for a response.
If timeout
is equal to -1 then waits forever, otherwise if a response is not received in timeout
seconds an ErrorException
is raised.
The message sent to the target task is a Request
struct that contains the request and a channel for sending back the response.
using Visor
+)::Supervisor
Setup hierarchy relationship between supervisor and supervised list of processes and configure supervisor behavior.
Visor.call
— Methodcall(name::String, request::Any; timeout::Real=3)
Send a request
to the process identified by full name
and wait for a response.
If timeout
is equal to -1 then waits forever, otherwise if a response is not received in timeout
seconds an ErrorException
is raised.
The message sent to the target task is a Request
struct that contains the request and a channel for sending back the response.
using Visor
function server(task)
for msg in task.inbox
@@ -147,56 +147,56 @@
shutdown()
end
-supervise([process(server), process(requestor)])
Visor.call
— Methodcall(target::Supervised, request::Any; timeout::Real=-1)
Send a request
to target
process and wait for a response.
Visor.cast
— Methodcast(name::String, message::Any)
Send a message
to process with full name
without waiting for a response.
Visor.cast
— Methodcast(process::Supervised, message)
The message
value is sent to target
process without waiting for a response.
Visor.from
— Methodfrom(name::String)::Supervised
Return the supervised node identified by full name
.
Given for example the process mytask
supervised by mysupervisor
:
supervisor("mysupervisor", [process(mytask)])
then the full name of mytask
process is mysupervisor.mytask
.
Visor.hassupervised
— Methodhassupervised(name::String)
Determine whether the supervised identified by name
exists.
Visor.ifrestart
— Methodifrestart(fn, process)
Call the no-argument function fn
if the process
restarted.
The function fn
is not executed at the first start of process
.
Visor.isrequest
— Methodisrequest(message)
Return true if message is a Request
.
Visor.isshutdown
— Methodisshutdown(msg)
Returns true
if message msg
is a shutdown command.
Visor.isshutdown
— Methodfunction isshutdown(process::Supervised)
Returns true
if process has a shutdown command in its inbox.
As a side effect remove messages from process inbox until a shutdown
request is found.
Visor.process
— Methodprocess(id, fn;
+supervise([process(server), process(requestor)])
Visor.call
— Methodcall(target::Supervised, request::Any; timeout::Real=-1)
Send a request
to target
process and wait for a response.
Visor.cast
— Methodcast(name::String, message::Any)
Send a message
to process with full name
without waiting for a response.
Visor.cast
— Methodcast(process::Supervised, message)
The message
value is sent to target
process without waiting for a response.
Visor.from
— Methodfrom(name::String)::Supervised
Return the supervised node identified by full name
.
Given for example the process mytask
supervised by mysupervisor
:
supervisor("mysupervisor", [process(mytask)])
then the full name of mytask
process is mysupervisor.mytask
.
Visor.hassupervised
— Methodhassupervised(name::String)
Determine whether the supervised identified by name
exists.
Visor.ifrestart
— Methodifrestart(fn, process)
Call the no-argument function fn
if the process
restarted.
The function fn
is not executed at the first start of process
.
Visor.isrequest
— Methodisrequest(message)
Return true if message is a Request
.
Visor.isshutdown
— Methodisshutdown(msg)
Returns true
if message msg
is a shutdown command.
Visor.isshutdown
— Methodfunction isshutdown(process::Supervised)
Returns true
if process has a shutdown command in its inbox.
As a side effect remove messages from process inbox until a shutdown
request is found.
Visor.process
— Methodprocess(id, fn;
args=(),
namedargs=(;),
force_interrupt_after::Real=1.0,
stop_waiting_after::Real=Inf,
debounce_time=NaN,
thread=false,
- restart=:transient)::ProcessSpec
Declare a supervised task that may be forcibly interrupted.
id
is the process name and fn
is the task function.
process
returns only a specification: the task function has to be started with supervise
.
See process
online docs for more details.
Visor.process
— Methodprocess(fn;
+ restart=:transient)::ProcessSpec
Declare a supervised task that may be forcibly interrupted.
id
is the process name and fn
is the task function.
process
returns only a specification: the task function has to be started with supervise
.
See process
online docs for more details.
Visor.process
— Methodprocess(fn;
args=(),
namedargs=(;),
force_interrupt_after::Real=1.0,
stop_waiting_after::Real=Inf,
debounce_time=NaN,
thread=false,
- restart=:transient)::ProcessSpec
The process name is set equals to string(fn)
.
Visor.receive
— Methodfunction receive(fn::Function, pd::Process)
Execute fn(msg)
for every message msg
delivered to the pd
Process.
Return if a Shutdown
control message is received.
Visor.reply
— Methodreply(request::Request, response::Any)
Send the response
to the call
method that issued the request
.
Visor.resync
— Methodresync(supervisor)
Restart processes previously stopped by supervisor policies.
Return true if all supervised processes terminated.
Visor.setname
— Methodsetname(process::Process, new_name::AbstractString)
Change the process name
Visor.setroot
— Methodsetroot(;
+ restart=:transient)::ProcessSpec
The process name is set equals to string(fn)
.
Visor.receive
— Methodfunction receive(fn::Function, pd::Process)
Execute fn(msg)
for every message msg
delivered to the pd
Process.
Return if a Shutdown
control message is received.
Visor.reply
— Methodreply(request::Request, response::Any)
Send the response
to the call
method that issued the request
.
Visor.resync
— Methodresync(supervisor)
Restart processes previously stopped by supervisor policies.
Return true if all supervised processes terminated.
Visor.setname
— Methodsetname(process::Process, new_name::AbstractString)
Change the process name
Visor.setroot
— Methodsetroot(;
intensity::Int=1,
period::Int=5,
strategy::Symbol=:one_for_one,
terminateif::Symbol=:empty,
handler::Union{Nothing,Function}=nothing,
-)
Setup root supervisor settings.
Visor.setsupervisor
— Methodsetsupervisor(sv::Supervisor;
+)
Setup root supervisor settings.
Visor.setsupervisor
— Methodsetsupervisor(sv::Supervisor;
intensity::Int=1,
period::Int=5,
strategy::Symbol=:one_for_one,
terminateif::Symbol=:empty,
handler::Union{Nothing,Function}=nothing,
-)
Setup supervisor settings.
Visor.shutdown
— Functionshutdown(node)
Try to shutdown a process or a supervisor.
If node
is a supervisor it first attempts to shutdown all children nodes and then it stop the supervisor. If some process refuse to shutdown the node
supervisor is not stopped.
Visor.shutdown
— Methodshutdown()
Shutdown all supervised nodes.
Visor.startup
— Methodstartup(proc::Supervised)
Start the supervised process defined by proc
as children of the root supervisor.
Visor.startup
— Methodstartup(supervisor::Supervisor, proc::Supervised)
Start the supervised process defined by proc
as child of supervisor
.
julia> using Visor
+)
Setup supervisor settings.
Visor.shutdown
— Functionshutdown(node)
Try to shutdown a process or a supervisor.
If node
is a supervisor it first attempts to shutdown all children nodes and then it stop the supervisor. If some process refuse to shutdown the node
supervisor is not stopped.
Visor.shutdown
— Methodshutdown()
Shutdown all supervised nodes.
Visor.startup
— Methodstartup(proc::Supervised)
Start the supervised process defined by proc
as children of the root supervisor.
Visor.startup
— Methodstartup(supervisor::Supervisor, proc::Supervised)
Start the supervised process defined by proc
as child of supervisor
.
julia> using Visor
julia> foo(self) = println("foo process started");
julia> main(self) = startup(self.supervisor, process(foo));
julia> supervise([process(main)]);
-foo process started
Visor.supervise
— Methodsupervise(processes::Vector{<:Supervised};
+foo process started
Visor.supervise
— Methodsupervise(processes::Vector{<:Supervised};
intensity::Int=1,
period::Int=5,
strategy::Symbol=:one_for_one,
terminateif::Symbol=:empty,
handler::Union{Nothing, Function}=nothing,
wait::Bool=true)::Supervisor
The root supervisor start a family of supervised processes
.
Return the root supervisor or wait for supervisor termination if wait
is true.
Arguments
intensity::Int
: maximum number of restarts allowed in period
seconds.period::Int
: time interval that controls the restart intensity.strategy::Symbol
: defines the restart strategy::one_for_one
: only the terminated task is restarted.:one_for_all
: if a child task terminates, all other tasks are terminated, and then all children, including the terminated one, are restarted.:rest_for_one
: if a child task terminates, the rest of the children tasks (that is, the child tasks after the terminated process in start order) are terminated. Then the terminated child task and the rest of the child tasks are restarted.:one_terminate_all
: if a child task terminates then the remaining tasks will be concurrently terminated (the startup order is not respected).terminateif::Symbol
::empty
: terminate the supervisor when all child tasks terminate.:shutdown
: the supervisor terminate at shutdown.handler
: a callback function with prototype fn(process, event)
invoked when process events occurs:when process tasks throws exception and when a process terminate because of a ProcessFatal
reason.
wait::Bool
: wait for supervised nodes termination. children = [process(worker, args=(15,"myid"))]
- supervise(children)
Visor.supervise
— Methodsupervise(proc::Supervised;
+ supervise(children)
Visor.supervise
— Methodsupervise(proc::Supervised;
intensity::Int=1,
period::Int=5,
strategy::Symbol=:one_for_one,
terminateif::Symbol=:empty,
handler::Union{Nothing, Function}=nothing,
- wait::Bool=true)::Supervisor
The root supervisor start a supervised process defined by proc
.
Visor.supervisor
— Functionsupervisor(id, processes; intensity=1, period=5, strategy=:one_for_one, terminateif=:empty)::SupervisorSpec
Declare a supervisor of one or more processes
.
processes
may be a Process
or an array of Process
.
julia> using Visor
+ wait::Bool=true)::Supervisor
The root supervisor start a supervised process defined by proc
.
Visor.supervisor
— Functionsupervisor(id, processes; intensity=1, period=5, strategy=:one_for_one, terminateif=:empty)::SupervisorSpec
Declare a supervisor of one or more processes
.
processes
may be a Process
or an array of Process
.
julia> using Visor
julia> mytask(pd) = ();
julia> supervisor("mysupervisor", process(mytask))
-mysupervisor
```jldoctest julia> using Visor
julia> tsk1(pd) = ();
julia> tsk2(pd) = ();
julia> supervisor("mysupervisor", [process(tsk1), process(tsk2)]) mysupervisor
See Supervisor documentation for more details.
Visor.@isshutdown
— Macro@isshutdown process_descriptor
-@isshutdown msg
Break the loop if a shutdown control message is received.
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 26 July 2024. Using Julia version 1.10.4.