Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RemoteChannel iterable #33555

Closed
wants to merge 3 commits into from
Closed

Make RemoteChannel iterable #33555

wants to merge 3 commits into from

Conversation

tkf
Copy link
Member

@tkf tkf commented Oct 15, 2019

Being an iterator is one of the nice features of Channel. Can RemoteChannel have it?

close #31177

@kshyatt kshyatt added iteration Involves iteration or the iteration protocol parallelism Parallel or distributed computation labels Oct 15, 2019
@ararslan ararslan added the needs news A NEWS entry is required for this change label Oct 17, 2019
@tkf tkf mentioned this pull request Dec 15, 2019
@jonas-schulze
Copy link
Contributor

bump 🙂

@StefanKarpinski StefanKarpinski added the triage This should be discussed on a triage call label Sep 27, 2020
@StefanKarpinski
Copy link
Member

Seems like something we should clearly do. The only issue is the implementation. Does this approach seem good to you, @JeffBezanson?

@tkf tkf removed the needs news A NEWS entry is required for this change label Sep 27, 2020
@StefanKarpinski
Copy link
Member

Is this ready to go, @tkf?

try
return (take!(c), nothing)
catch e
if isa(e, InvalidStateException) && e.state == :closed
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isa(e, InvalidStateException) is not enough.

We'd need to handle the case when the channel is a reference

julia> ch = RemoteChannel(workers()[end])
RemoteChannel{Channel{Any}}(2, 1, 8)

julia> put!(ch, 1)
RemoteChannel{Channel{Any}}(2, 1, 8)

julia> close(ch)

julia> take!(ch)
1

julia> err = try
           take!(ch)
       catch err
           err
       end
RemoteException(2, CapturedException(InvalidStateException("Channel is closed.", :closed), Any[(check_channel_state at channels.jl:170 [inlined], 1), (take_buffered at channels.jl:388, 1), (take! at channels.jl:383, 1), (take! at remotecall.jl:599,
 1), (take_ref at remotecall.jl:610, 1), (#106 at process_messages.jl:278, 1), (run_work_thunk at process_messages.jl:63, 1)
, (macro expansion at process_messages.jl:278 [inlined], 1), (#105 at task.jl:411, 1)]))

@tkf tkf marked this pull request as draft August 19, 2021 22:16
@tkf
Copy link
Member Author

tkf commented Aug 23, 2021

#41966 is an alternative solution to this

@vtjnash
Copy link
Member

vtjnash commented Nov 12, 2021

Replaced by (included in) #41966

@vtjnash vtjnash closed this Nov 12, 2021
@oscardssmith oscardssmith removed the triage This should be discussed on a triage call label Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iteration Involves iteration or the iteration protocol parallelism Parallel or distributed computation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iterate RemoteChannels
8 participants