Skip to content

Commit aa2858e

Browse files
move method to beside other remotecall_pool
1 parent e4bd504 commit aa2858e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/workerpool.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ function remotecall_pool(rc_f, f, pool::AbstractWorkerPool, args...; kwargs...)
135135
end
136136
end
137137

138+
function remotecall_pool(rc_f, f, pool::CachingPool, args...; kwargs...)
139+
worker = take!(pool)
140+
f_ref = get(pool.map_obj2ref, (worker, f), (f, RemoteChannel(worker)))
141+
isa(f_ref, Tuple) && (pool.map_obj2ref[(worker, f)] = f_ref[2]) # Add to tracker
142+
143+
try
144+
rc_f(exec_from_cache, worker, f_ref, args...; kwargs...)
145+
finally
146+
put!(pool, worker)
147+
end
148+
end
149+
138150
# Specialization for remotecall. We have to wait for the Future it returns
139151
# before putting the worker back in the pool.
140152
function remotecall_pool(rc_f::typeof(remotecall), f, pool::AbstractWorkerPool, args...; kwargs...)
@@ -388,15 +400,3 @@ function exec_from_cache(f_ref::Tuple{Function, RemoteChannel}, args...; kwargs.
388400
put!(f_ref[2], f_ref[1]) # Cache locally
389401
f_ref[1](args...; kwargs...)
390402
end
391-
392-
function remotecall_pool(rc_f, f, pool::CachingPool, args...; kwargs...)
393-
worker = take!(pool)
394-
f_ref = get(pool.map_obj2ref, (worker, f), (f, RemoteChannel(worker)))
395-
isa(f_ref, Tuple) && (pool.map_obj2ref[(worker, f)] = f_ref[2]) # Add to tracker
396-
397-
try
398-
rc_f(exec_from_cache, worker, f_ref, args...; kwargs...)
399-
finally
400-
put!(pool, worker)
401-
end
402-
end

0 commit comments

Comments
 (0)