https://jacobzelko.com/01082023043553-julia-async-workflow/ #18
Replies: 2 comments 3 replies
-
|
Thanks for the post! There are clear advantages to the proposed workflow. However, there is no straightforward way to stop watching file changes if one does not need it anymore. For example, There is an example of a possible Rocket based implementation: using Rocket
using FileWatching
file_to_watch = "/Users/mykola/tmp/tmp.txt"
ticks = BehaviorSubject(Int, 1)
actor = (d) -> begin
watch_file(file_to_watch)
println("Change Detected $(file_to_watch)!")
next!(ticks, d+1)
end
subscription_to_file_changes = subscribe!(ticks |> async(1), actor)
for i in 1:15
println("Hi from the main flow $(i)! I can react on the file changes")
sleep(2)
end
unsubscribe!(subscription_to_file_changes) # pff! I don't care about the file anymore
for i in 1:5
println("Hi from the main flow $(i)!")
sleep(2)
endDuring the execution of the code above I add several lines into |
Beta Was this translation helpful? Give feedback.
-
|
Wow this is really cool! I need to spend some time to figure out a similar workflow for tests (while watching affected source code) using ReTest :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
https://jacobzelko.com/01082023043553-julia-async-workflow/
A thorough tutorial on how to use Julia for asynchronous workflows to do many things, at once!
https://jacobzelko.com/01082023043553-julia-async-workflow/
Beta Was this translation helpful? Give feedback.
All reactions