-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
struct RemoteFetcher end | ||
function stream_fetch_values!(::Type{RemoteFetcher}, T, store_ref::Chunk{Store_remote}, buffer::Blocal, id::UInt) where {Store_remote, Blocal} | ||
if store_ref.handle.owner == myid() | ||
store = fetch(store_ref)::Store_remote | ||
while !isfull(buffer) | ||
value = take!(store, id)::T | ||
put!(buffer, value) | ||
thunk_id = STREAM_THUNK_ID[] | ||
@dagdebug thunk_id :stream "fetching values" | ||
@label fetch_values | ||
# FIXME: Pass buffer free space | ||
# TODO: It would be ideal if we could wait on store.lock, but get unlocked during migration | ||
values = MemPool.access_ref(store_ref.handle, id, T, Store_remote, thunk_id) do store, id, T, Store_remote, thunk_id | ||
if !isopen(store) | ||
throw(InvalidStateException("Stream is closed", :closed)) | ||
end | ||
else | ||
thunk_id = STREAM_THUNK_ID[] | ||
values = remotecall_fetch(store_ref.handle.owner, store_ref.handle, id, T, Store_remote) do store_ref, id, T, Store_remote | ||
STREAM_THUNK_ID[] = thunk_id | ||
store = MemPool.poolget(store_ref)::Store_remote | ||
values = T[] | ||
while !isempty(store, id) | ||
value = take!(store, id)::T | ||
push!(values, value) | ||
end | ||
return values | ||
end::Vector{T} | ||
for value in values | ||
put!(buffer, value) | ||
@dagdebug thunk_id :stream "trying to fetch values at $(myid())" | ||
store::Store_remote | ||
in_store = store | ||
STREAM_THUNK_ID[] = thunk_id | ||
values = T[] | ||
while !isempty(store, id) | ||
value = take!(store, id)::T | ||
push!(values, value) | ||
end | ||
return values | ||
end::Vector{T} | ||
if isempty(values) | ||
@goto fetch_values | ||
end | ||
|
||
@dagdebug thunk_id :stream "fetched $(length(values)) values" | ||
for value in values | ||
put!(buffer, value) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters