Re: Should return the number of input or the number of output?

Part of this question has been partially discussed, as below.

On Mon, Mar 10, 2014 at 9:18 PM, Martin B.
[email protected]wrote:

OK, I admit I was unclear. Let’s try from scratch:

  • The return function from work() or general_work() is the amount of
    items that were produced.

Says, now I need to create a sink block, and I need to highly customize
its
built-in forecast() function.
Hence I have two choices:-
(i). Create this as a sink block, then explicitly overwrite its
forecast()
function in the body of the custom block.
(ii). Create this as a general block.

Question 1: Will option (i) above work?

Question 2: If a sink block is implemented as a general block, does it
still need to return noutput_items, or just return 0, or doesn’t matter
at
all ? (I guess it should return 0 because the sink block doesn’t
produce
any output)

Hi Activecat,

it’s a sink. As Martin said, keep it a sync block. Overriding forecast
doesn’t even make sense; why should the scheduler ask the block “I’d
like
to have 2000 output items from you, how much input do you need” if it’s
guaranteed to never produce output.

Maybe I’m getting something wrong, so why would you want to costumize
the
forecast function?

Greetings,
Marcus

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs