Open dioptre opened 8 years ago
You can try sleep(10^6)
at the end of the file, Reactive will continue to work.
I think it's a bug mate, Can you please check @shashi?
julia> using Reactive
julia> @spawnat 4 begin global fp = fps(17) global x = Signal(time()) global y = Signal(time()) map(fp) do push!(x, time()) end map(x) do push!(y,time()) end end RemoteRef{Channel{Any}}(4,1,224)
julia> fetch(@spawnat 4 y) Signal{Float64}(1.456912808737102e9, nactions=0)
julia> fetch(@spawnat 4 y) Signal{Float64}(1.456912813205085e9, nactions=0)
julia> fetch(@spawnat 4 y) Signal{Float64}(1.456912813205085e9, nactions=0)
julia> fetch(@spawnat 4 y) Signal{Float64}(1.456912813205085e9, nactions=0)
I tried
while true
sleep(2^64)
end
and it didnt work either :(
What you thinking @shashi ?
julia> fetch(@spawnat 4 signals["processing"].actions) 2-element Array{Reactive.Action,1}: Reactive.Action(WeakRef(_<:Int64),(anonymous function)) Reactive.Action(WeakRef(nothing),(anonymous function))
Does that look normal with the "nothing"?
Wow I think I've found what might be going on, and I'm not sure why it feels so buggy - but I've made a pretty comprehensive test list for people wanting to use signals without them disappearing mysteriously or breaking across threads/processes. Would love to know your thoughts @shashi .
Testing "map" seems to be where it breaks....
Weirdly the general rule looks like you can use functions in context and variables from outside context only.
addprocs(1)
using Reactive
wait(@spawnat 2 begin
function runxy()
push!(a, 0)
push!(a, 1)
@spawnat 1 print("KAKA")
end
function runkk()
@spawnat 1 print("FDFDS")
end
global x = 5
global y = Signal(0)
end)
@spawnat 2 begin
function runxz()
push!(a, 0)
push!(a, 1)
@spawnat 1 print("FAFA")
end
function rungt(t)
ptt = t + 9
xtt = 7
@spawnat 1 print(xtt + ptt) #YES
end
function runxa(t)
@spawnat 1 print(t) #YES
end
function runxb()
runxy() #NO
end
#global runonce = false
global a = Signal(0)
global c = droprepeats(a)
global b = filter(a->a==1,0,c)
map(b) do _
begin
#Basically anything evaluated in this context breaks
#if _ == 1 #NO
#if y.value == 0 #YES
if x === 5 #YES
#if a.value == 1 #NO
#if runonce == true #NO
# tt = "hi" #NO
@spawnat 1 print("hi") #tt) #"hi" is YES tt is NO
#@spawnat 4 runxy() #NO
#runxy() #NO
#@spawnat 4 runxz() #NO
#runxz() #YES - recursive ;p
#runxa(_) #YES
#runxb() #NO
#runkk() #NO
#runxx() #NO
rungt(_) #YES
end
end
end
push!(a, 0)
push!(a, 1)
function runxx()
push!(a, 0)
push!(a, 1)
@spawnat 1 print(t) #YES
end
end
#runxx() = ()
@spawnat 2 push!(a, 0)
@spawnat 2 push!(a, 1)
#remotecall_fetch(runxx,2) #NO
@async (@spawnat 2 push!(a,0))
@async (@spawnat 2 push!(a,1))
#@spawnat 2 runxx() #NO
Is this the same problem that has caused the mc.jl example in Escher.jl to break?: [https://github.com/shashi/Escher.jl/issues/137]
No it's not
I'm trying to keep a .jl process running when i run julia xxxx.jl with the signals running Ie s = fps(3) then a map(s) ...
But julia always exits, is there something to help me keep the process alive?
Thanks A