After reading the following post ( 
https://groups.google.com/forum/#!searchin/julia-users/addprocs$20output$20SlurmManager/julia-users/VNjshcRJYR8/uJz0FkkQAAAJ
 
) I decided to try the following

function run_slurm(f::Function;num_workers = 5)

    addprocs(SlurmManager(num_workers), partition="quick", t="00:01:00")

    @everywhere f

    output = []
    for i in workers()
        out = fetch(@spawnat i f())
        push!(output, out)
    end

    for i in workers()
        rmprocs(i)
    end

    return output
end

run_slurm() do
 return (gethostname(), getpid())
end

but it looks like i get the following error:

UndefVarError: f not defined

I've been looking into trying to get the definition and redefining it using 
something like the following, but i'm lost as to how i could use this

julia> lambda_info = eval(code_lowered(f,())[1])
AST(:($(Expr(:lambda, Any[symbol("#self#")], Any[Any[Any[symbol("#self#"),:
Any,0]],Any[],0], :(begin  # none, line 1:
        return (top(tuple))((Main.gethostname)(),(Main.getpid)())
    end)))))

>From 
(https://stackoverflow.com/questions/14124456/access-the-ast-for-generic-functions-in-julia)
 
I've tried the following with no luck.

julia> ccall(:jl_uncompress_ast, Any, (Any, Any), lambda_info, lambda_info.
ast)
35

Reply via email to