You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by MaGuoWei <ma...@outlook.com> on 2015/08/19 05:45:10 UTC

A Question About Execution Schedule

Hi,guysThere are some codes in scheduleForExecution Function in Execution.java:
   1.  SlotAllocationFuture future = scheduler.scheduleQueued(toSchedule);   2. 	 future.setFutureAction(new SlotAllocationFutureAction() {......})
When scheduler  finds some slot between line1 and line 2 the scheduler can't get the future action.
Please let me know If I am wrong .
Thanks. 		 	   		  

RE: A Question About Execution Schedule

Posted by MaGuoWei <ma...@outlook.com>.
Thanks Till!
> Date: Wed, 19 Aug 2015 09:31:49 +0200
> Subject: Re: A Question About Execution Schedule
> From: trohrmann@apache.org
> To: dev@flink.apache.org
> 
> Hi MaGuoWei,
> 
> this is not a problem. If you look at the implementation of
> SlotAllocationFuture.setFutureAction, you’ll see that the method is
> synchronized on a lock which is also used to complete the future.
> Furthermore, you’ll see that the slot variable is checked upon setting an
> action and if it’s set the action will immediately be executed. Thus, if in
> between calls 1 and 2 the future was completed, then the slot variable
> would be set and thus also the action would be executed.
> 
> Cheers,
> Till
> ​
> 
> On Wed, Aug 19, 2015 at 5:45 AM, MaGuoWei <ma...@outlook.com> wrote:
> 
> > Hi,guysThere are some codes in scheduleForExecution Function in
> > Execution.java:
> >    1.  SlotAllocationFuture future =
> > scheduler.scheduleQueued(toSchedule);   2.
> > future.setFutureAction(new SlotAllocationFutureAction() {......})
> > When scheduler  finds some slot between line1 and line 2 the scheduler
> > can't get the future action.
> > Please let me know If I am wrong .
> > Thanks.
 		 	   		  

Re: A Question About Execution Schedule

Posted by Till Rohrmann <tr...@apache.org>.
Hi MaGuoWei,

this is not a problem. If you look at the implementation of
SlotAllocationFuture.setFutureAction, you’ll see that the method is
synchronized on a lock which is also used to complete the future.
Furthermore, you’ll see that the slot variable is checked upon setting an
action and if it’s set the action will immediately be executed. Thus, if in
between calls 1 and 2 the future was completed, then the slot variable
would be set and thus also the action would be executed.

Cheers,
Till
​

On Wed, Aug 19, 2015 at 5:45 AM, MaGuoWei <ma...@outlook.com> wrote:

> Hi,guysThere are some codes in scheduleForExecution Function in
> Execution.java:
>    1.  SlotAllocationFuture future =
> scheduler.scheduleQueued(toSchedule);   2.
> future.setFutureAction(new SlotAllocationFutureAction() {......})
> When scheduler  finds some slot between line1 and line 2 the scheduler
> can't get the future action.
> Please let me know If I am wrong .
> Thanks.