I'm trying to execute an anonymous function on a worker from within a
module:
getCores(pid) = remotecall_fetch(pid, ()->CPU_CORES)
module Banana
export getCores2
getCores2(pid) = remotecall_fetch(pid, ()->CPU_CORES)
end
Firstly, is using anonymous function,()->CPU_CORES, as above a good way to
return a global variable from a worker?
I can execute getCores successfully, but getCores2 fails:
Is it possible to "escape" the anonymous function in some way?
julia> getCores(2)
4
julia> using Banana
julia> getCores2(2)
WARNING: Module Banana not defined on process 2
fatal error on 2: ERROR: UndefVarError: Banana not defined
in deserialize at serialize.jl:504
in handle_deserialize at serialize.jl:465
in deserialize at serialize.jl:696
in deserialize_datatype at serialize.jl:651
in handle_deserialize at serialize.jl:465
in deserialize_expr at serialize.jl:627
in handle_deserialize at serialize.jl:458
in deserialize_expr at serialize.jl:627
in handle_deserialize at serialize.jl:458
in deserialize_expr at serialize.jl:627
in handle_deserialize at serialize.jl:458
in deserialize at serialize.jl:556
in handle_deserialize at serialize.jl:465
in deserialize at serialize.jl:538
in handle_deserialize at serialize.jl:465
in deserialize at serialize.jl:696
in deserialize_datatype at serialize.jl:651
in handle_deserialize at serialize.jl:465
in message_handler_loop at multi.jl:863
in process_tcp_streams at multi.jl:852
in anonymous at task.jl:63
Worker 2 terminated.ERROR: ProcessExitedException()
in yieldto at task.jl:71
in wait at task.jl:371
in wait at task.jl:286
in wait at channels.jl:93
in take! at channels.jl:82
in take! at multi.jl:804
in remotecall_fetch at multi.jl:730
in getCores2 at none:3
ERROR (unhandled task failure): EOFError: read end of file
Julia>