Created
January 14, 2024 21:59
-
-
Save thmsmlr/ed85efa73dc8ee2857fc20c3814e62d5 to your computer and use it in GitHub Desktop.
Kino Background Daemon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
child_spec = Task.child_spec(fn -> | |
IO.puts(""" | |
I am doing daemon things for my Livebook. | |
If I re-evaluate the cell, this task will be terminated and restart with the new version of the code. | |
If the task ever terminates, the Supervisor will automatically restart it. | |
Useful for running things in the background that don't need to directly interact with your notebook. | |
""") | |
Process.sleep(5000) | |
end) | |
Kino.start_child(%{child_spec | restart: :permanent}) | |
Kino.nothing() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment