# \[ANN\] Announcing Visor.jl

**URL:** <https://discourse.julialang.org/t/ann-announcing-visor-jl/106158>\
**Category:** Package Announcements\
**Created:** [November 13, 2023, 4:56pm UTC](https://discourse.julialang.org/t/ann-announcing-visor-jl/106158 "2023-11-13T16:56:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![attdona](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/attdona/32/15859_2.png) [@attdona](https://discourse.julialang.org/u/attdona)\
**Post date:** [November 13, 2023, 4:56pm UTC](https://discourse.julialang.org/t/ann-announcing-visor-jl/106158/1 "2023-11-13T16:56:33Z")

</div>

Hello Everyone

I’m glad to announce a first draft version of [Visor](https://github.com/cardo-org/Visor.jl): a tasks supervisor for Julia.

The starting motivation [sparkled some years ago](https://discourse.julialang.org/t/looking-for-the-correct-way-to-do-a-clean-julia-process-shutdown/46691) around the “apparently simple” goal of controlling the shutdown of multi-tasks applications.

`Visor` is influenced by [Erlang Supervisor](https://www.erlang.org/doc/design_principles/sup_princ.html#supervision-principles) design principles with the aims to be as simple as possible.

Just to be an idea this is an extract from the README:

`demo.jl`:

```julia
using Visor

# The only requirement for a task driven by Visor is that the first argument is
# a descriptor representing the supervised task, in this case `pd` is the 
# descriptor of the `printer` process.
function printer(pd, device)
    println("(re)starting printer driver")
    receive(pd) do msg
        device.jobcount += 1
        print("processing $msg ... ")
        if device.jobcount === 3
            # unexpected printer failure 
            error("printer service panic error: $msg not printed")
        end
        println("done")
    end
end

function controller(pd)
    # The from(name) function returns a Visor task object from process name.
    # The default name is the name of process task.  
    printer_process = from("printer")
    for i in 1:8
        # send a one-way message to the printer process.
        cast(printer_process, "job-$i")
    end
end

# needed for simulating a printer failure:
# when jobcount is equal to 3
mutable struct PrinterStatus
    jobcount::Int
end

supervise([process(printer; args=(PrinterStatus(0),)), process(controller)])

```

```bash
myhost:~/$ julia demo.jl
(re)starting printer driver
processing job-1 ... done
processing job-2 ... done
processing job-3 ... ┌ Error: [printer] exception: ErrorException("printer service panick error: job-3 not printed")
└ @ Visor .../Visor.jl:1107
(re)starting printer driver
processing job-3 ... done
processing job-4 ... done
processing job-5 ... done
processing job-6 ... done
processing job-7 ... done
processing job-8 ... done
^C
myhost.~/$

```

Feedback welcome!

Attilio
