From 977d881abdf7a15da5110096a32aa2191453f289 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Fri, 26 Jul 2024 16:49:08 +0000 Subject: [PATCH] build based on aba58a7 --- dev/index.html | 24 ++++++++++++------------ dev/messages/index.html | 2 +- dev/no_handler_available/index.html | 2 +- dev/process/index.html | 2 +- dev/search/index.html | 2 +- dev/stop_process/index.html | 2 +- dev/supervisor/index.html | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) 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.intensityConstant

Maximun numbers of restart in period seconds.

source
Visor.RequestType

A response value is expected when a Request message is pushed to the target process inbox.

source
Visor.SupervisorResyncType

Trigger a supervisor resync

source
Visor.add_nodeMethod
add_node(supervisor::Supervisor, proc::Supervised)

Add supervised proc to the children's collection of the controlling supervisor.

source
Visor.add_processesMethod
add_processes(
+9
Visor.RequestType

A response value is expected when a Request message is pushed to the target process inbox.

source
Visor.add_nodeMethod
add_node(supervisor::Supervisor, proc::Supervised)

Add supervised proc to the children's collection of the controlling supervisor.

source
Visor.add_processesMethod
add_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.

source
Visor.callMethod
call(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.

source
Visor.callMethod
call(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)])
source
Visor.callMethod
call(target::Supervised, request::Any; timeout::Real=-1)

Send a request to target process and wait for a response.

source
Visor.castMethod
cast(name::String, message::Any)

Send a message to process with full name without waiting for a response.

source
Visor.castMethod
cast(process::Supervised, message)

The message value is sent to target process without waiting for a response.

source
Visor.fromMethod
from(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.

source
Visor.ifrestartMethod
ifrestart(fn, process)

Call the no-argument function fn if the process restarted.

The function fn is not executed at the first start of process.

source
Visor.isshutdownMethod
function 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.

source
Visor.processMethod
process(id, fn;
+supervise([process(server), process(requestor)])
source
Visor.callMethod
call(target::Supervised, request::Any; timeout::Real=-1)

Send a request to target process and wait for a response.

source
Visor.castMethod
cast(name::String, message::Any)

Send a message to process with full name without waiting for a response.

source
Visor.castMethod
cast(process::Supervised, message)

The message value is sent to target process without waiting for a response.

source
Visor.fromMethod
from(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.

source
Visor.ifrestartMethod
ifrestart(fn, process)

Call the no-argument function fn if the process restarted.

The function fn is not executed at the first start of process.

source
Visor.isshutdownMethod
function 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.

source
Visor.processMethod
process(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.

source
Visor.processMethod
process(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.

source
Visor.processMethod
process(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).

source
Visor.receiveMethod
function 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.

source
Visor.replyMethod
reply(request::Request, response::Any)

Send the response to the call method that issued the request.

source
Visor.resyncMethod
resync(supervisor)

Restart processes previously stopped by supervisor policies.

Return true if all supervised processes terminated.

source
Visor.setnameMethod
setname(process::Process, new_name::AbstractString)

Change the process name

source
Visor.setrootMethod
setroot(;
+        restart=:transient)::ProcessSpec

The process name is set equals to string(fn).

source
Visor.receiveMethod
function 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.

source
Visor.replyMethod
reply(request::Request, response::Any)

Send the response to the call method that issued the request.

source
Visor.resyncMethod
resync(supervisor)

Restart processes previously stopped by supervisor policies.

Return true if all supervised processes terminated.

source
Visor.setnameMethod
setname(process::Process, new_name::AbstractString)

Change the process name

source
Visor.setrootMethod
setroot(;
     intensity::Int=1,
     period::Int=5,
     strategy::Symbol=:one_for_one,
     terminateif::Symbol=:empty,
     handler::Union{Nothing,Function}=nothing,
-)

Setup root supervisor settings.

source
Visor.setsupervisorMethod
setsupervisor(sv::Supervisor;
     intensity::Int=1,
     period::Int=5,
     strategy::Symbol=:one_for_one,
     terminateif::Symbol=:empty,
     handler::Union{Nothing,Function}=nothing,
-)

Setup supervisor settings.

source
Visor.shutdownFunction
shutdown(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.

source
Visor.startupMethod
startup(proc::Supervised)

Start the supervised process defined by proc as children of the root supervisor.

source
Visor.startupMethod
startup(supervisor::Supervisor, proc::Supervised)

Start the supervised process defined by proc as child of supervisor.

julia> using Visor
+)

Setup supervisor settings.

source
Visor.shutdownFunction
shutdown(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.

source
Visor.startupMethod
startup(proc::Supervised)

Start the supervised process defined by proc as children of the root supervisor.

source
Visor.startupMethod
startup(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
source
Visor.superviseMethod
supervise(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)
source
Visor.superviseMethod
supervise(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.

source
Visor.supervisorFunction
supervisor(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.

source
Visor.supervisorFunction
supervisor(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.

source
Visor.@isshutdownMacro
@isshutdown process_descriptor
-@isshutdown msg

Break the loop if a shutdown control message is received.

source
+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.

source
Visor.@isshutdownMacro
@isshutdown process_descriptor
+@isshutdown msg

Break the loop if a shutdown control message is received.

source
diff --git a/dev/messages/index.html b/dev/messages/index.html index 59966af..3ae466e 100644 --- a/dev/messages/index.html +++ b/dev/messages/index.html @@ -37,4 +37,4 @@ @info "server($request)=$response" end -supervise([process(server), process(requestor)]); +supervise([process(server), process(requestor)]); diff --git a/dev/no_handler_available/index.html b/dev/no_handler_available/index.html index e53eb38..3ac795b 100644 --- a/dev/no_handler_available/index.html +++ b/dev/no_handler_available/index.html @@ -48,4 +48,4 @@ end supervise([process(main)]);
doing something
-^Cgot Visor.ProcessInterrupt("main"): clean shutdown ...
+^Cgot Visor.ProcessInterrupt("main"): clean shutdown ... diff --git a/dev/process/index.html b/dev/process/index.html index e5472db..977b2a3 100644 --- a/dev/process/index.html +++ b/dev/process/index.html @@ -16,4 +16,4 @@ stop_waiting_after::Real=Inf, debounce_time::Real=NaN, thread::Bool=false, - restart::Symbol=:transient)

Where:

+ restart::Symbol=:transient)

Where:

diff --git a/dev/search/index.html b/dev/search/index.html index 38d1b16..f91167b 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · Visor.jl

Loading search...

    +Search · Visor.jl

    Loading search...

      diff --git a/dev/stop_process/index.html b/dev/stop_process/index.html index effe3d3..3796c30 100644 --- a/dev/stop_process/index.html +++ b/dev/stop_process/index.html @@ -59,4 +59,4 @@ [uncooperative] working ... [uncooperative] working ... [uncooperative] interrupted by Visor.ProcessInterrupt("uncooperative") -[uncooperative] DONE +[uncooperative] DONE diff --git a/dev/supervisor/index.html b/dev/supervisor/index.html index 580a765..21b8792 100644 --- a/dev/supervisor/index.html +++ b/dev/supervisor/index.html @@ -44,4 +44,4 @@ [tsk2]: do something ... [tsk2]: do something ... [main]: step 4 -[main]: step 5

      The strategy option defines the restart policy and it is one of:

      The design of the restart strategies :one_for_one, :one_for_all and :rest_for_one follows Erlang behavoir, see Erlang documentation for a comprehensive explanation.

      The strategy :one_terminate_all terminate all supervised processes as soon as the first one terminate, either normally or by an exception.

      Finally there can be two types of life span for supervisor: :permanent and :transient.

      The :transient supervisor terminates when there are left no children to supervise, whereas the :permanent supervisor may outlives its supervised children.

      The wait option controls if supervise blocks or return control. In the latter case the caller have to wait for supervision termination.

      +[main]: step 5

      The strategy option defines the restart policy and it is one of:

      The design of the restart strategies :one_for_one, :one_for_all and :rest_for_one follows Erlang behavoir, see Erlang documentation for a comprehensive explanation.

      The strategy :one_terminate_all terminate all supervised processes as soon as the first one terminate, either normally or by an exception.

      Finally there can be two types of life span for supervisor: :permanent and :transient.

      The :transient supervisor terminates when there are left no children to supervise, whereas the :permanent supervisor may outlives its supervised children.

      The wait option controls if supervise blocks or return control. In the latter case the caller have to wait for supervision termination.