How to determine the number of elements in RemoteChannel?

#1

Hi Community!

The simple Cannel show the current number of elements directly:

B = Channel(2)
put!(B,"one")
put!(B,"two")
B

Channel{Any}(sz_max:2,sz_curr:2)

the sz_curr is current numbers of elements in channel.

In case of RemoteChannel I can’t see something like sz_curr:

jobs = RemoteChannel(()->Channel{Any}(100));
put!(jobs,"one")
put!(jobs,"two")
jobs

RemoteChannel{Channel{Any}}(1, 1, 4)

so it prints only type of RemoteChannel.

How to see current numbers of elements in RemoteChannel?

0 Likes

#2

As I understand it, since RemoteChannel is essentially a reference to a Channel{Any}(1), the number of values it has stored is either 0 or 1. You can distinguish between these two cases using isready.

0 Likes

#3

I try for understand how to view numbers of elements for logging purposes. Anyway, in case of Channel it is really clean. But RemoteChannel is a black box. For example in RemoteChannel{Channel{Any}}(1, 1, 4) the (1, 1, 4) is not informative at all.

0 Likes

#4

Moved it to Parallel/Distributed

0 Likes