You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/17 22:49:59 UTC

[GitHub] [arrow-ballista] Dandandan opened a new pull request, #380: Use dedicated executor in execution loop

Dandandan opened a new pull request, #380:
URL: https://github.com/apache/arrow-ballista/pull/380

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
    # Rationale for this change
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   # What changes are included in this PR?
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] tfeda commented on a diff in pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
tfeda commented on code in PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#discussion_r999633316


##########
ballista/executor/src/execution_loop.rs:
##########
@@ -162,7 +165,7 @@ async fn run_received_tasks<T: 'static + AsLogicalPlan, U: 'static + AsExecution
         task_id, job_id, stage_id, stage_attempt_num, partition_id, task_attempt_num
     );
     info!("Received task {}", task_identity);
-    available_tasks_slots.fetch_sub(1, Ordering::SeqCst);
+    let permit = available_task_slots.clone().acquire_owned().await.unwrap();

Review Comment:
   Sorry about that, I didn't see the first check above. The problem I described wouldn't happen.
   
   Another option is to pass the permit from the first check into `run_received_tasks()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] Dandandan commented on pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
Dandandan commented on PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#issuecomment-1285327527

   Merged it in after some good testing to reduce the open PRs


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] tfeda commented on a diff in pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
tfeda commented on code in PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#discussion_r999607167


##########
ballista/executor/src/execution_loop.rs:
##########
@@ -162,7 +165,7 @@ async fn run_received_tasks<T: 'static + AsLogicalPlan, U: 'static + AsExecution
         task_id, job_id, stage_id, stage_attempt_num, partition_id, task_attempt_num
     );
     info!("Received task {}", task_identity);
-    available_tasks_slots.fetch_sub(1, Ordering::SeqCst);
+    let permit = available_task_slots.clone().acquire_owned().await.unwrap();

Review Comment:
   I'd be careful acquiring a permit _after_ retrieving a task from the scheduler. I'm imagining a scenario where the executor retrieves a task to execute, but then that task sits waiting for a permit to open up. could we move this call up to `poll_loop`, before `scheduler.poll_work()` is called?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] tfeda commented on a diff in pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
tfeda commented on code in PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#discussion_r999633316


##########
ballista/executor/src/execution_loop.rs:
##########
@@ -162,7 +165,7 @@ async fn run_received_tasks<T: 'static + AsLogicalPlan, U: 'static + AsExecution
         task_id, job_id, stage_id, stage_attempt_num, partition_id, task_attempt_num
     );
     info!("Received task {}", task_identity);
-    available_tasks_slots.fetch_sub(1, Ordering::SeqCst);
+    let permit = available_task_slots.clone().acquire_owned().await.unwrap();

Review Comment:
   Sorry about that, I didn't see the first check above. The problem I described wouldn't happen.
   
   Another option is to pass the permit from the first check into `run_received_tasks()`, and then you wouldn't need this check.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] Dandandan merged pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
Dandandan merged PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] Dandandan commented on a diff in pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
Dandandan commented on code in PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#discussion_r999658311


##########
ballista/executor/src/execution_loop.rs:
##########
@@ -162,7 +165,7 @@ async fn run_received_tasks<T: 'static + AsLogicalPlan, U: 'static + AsExecution
         task_id, job_id, stage_id, stage_attempt_num, partition_id, task_attempt_num
     );
     info!("Received task {}", task_identity);
-    available_tasks_slots.fetch_sub(1, Ordering::SeqCst);
+    let permit = available_task_slots.clone().acquire_owned().await.unwrap();

Review Comment:
   https://github.com/apache/arrow-ballista/issues/400



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] tfeda commented on a diff in pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
tfeda commented on code in PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#discussion_r999633316


##########
ballista/executor/src/execution_loop.rs:
##########
@@ -162,7 +165,7 @@ async fn run_received_tasks<T: 'static + AsLogicalPlan, U: 'static + AsExecution
         task_id, job_id, stage_id, stage_attempt_num, partition_id, task_attempt_num
     );
     info!("Received task {}", task_identity);
-    available_tasks_slots.fetch_sub(1, Ordering::SeqCst);
+    let permit = available_task_slots.clone().acquire_owned().await.unwrap();

Review Comment:
   Sorry about that, I didn't see the first check above. The problem I described wouldn't happen.
   
   Another option is to pass the permit from the first check into `run_received_tasks()`, and then you wouldn't need this check. I think you would replace the `available_task_slots` argument with an [OwnedSemaphorePermit](https://docs.rs/tokio/latest/tokio/sync/struct.OwnedSemaphorePermit.html).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] Dandandan commented on a diff in pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
Dandandan commented on code in PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#discussion_r999657737


##########
ballista/executor/src/execution_loop.rs:
##########
@@ -162,7 +165,7 @@ async fn run_received_tasks<T: 'static + AsLogicalPlan, U: 'static + AsExecution
         task_id, job_id, stage_id, stage_attempt_num, partition_id, task_attempt_num
     );
     info!("Received task {}", task_identity);
-    available_tasks_slots.fetch_sub(1, Ordering::SeqCst);
+    let permit = available_task_slots.clone().acquire_owned().await.unwrap();

Review Comment:
   Yeah I did something like that, but after polling.
   
   I would prefer to see if we can keep it like this (acquiring+release before poll instead of acquiring directly), as I want to add the possibility to retrieve multiple tasks from the scheduler based on `semaphore.available_permits()` (and then acquire those permits later based on the nr. of tasks that are returned from the scheduler).
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] Dandandan commented on a diff in pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
Dandandan commented on code in PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#discussion_r999657737


##########
ballista/executor/src/execution_loop.rs:
##########
@@ -162,7 +165,7 @@ async fn run_received_tasks<T: 'static + AsLogicalPlan, U: 'static + AsExecution
         task_id, job_id, stage_id, stage_attempt_num, partition_id, task_attempt_num
     );
     info!("Received task {}", task_identity);
-    available_tasks_slots.fetch_sub(1, Ordering::SeqCst);
+    let permit = available_task_slots.clone().acquire_owned().await.unwrap();

Review Comment:
   Yeah I did something like that, but after polling.
   
   I would prefer to see if we can keep it like this (acquiring+release before poll instead of acquiring directly), as I want to add the possibility to retrieve multiple tasks from the scheduler based on `semaphore.available_permits()` (and then acquire those permits later based on the nr. of tasks that are returned).
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-ballista] Dandandan commented on a diff in pull request #380: Pull-based execution loop improvements

Posted by GitBox <gi...@apache.org>.
Dandandan commented on code in PR #380:
URL: https://github.com/apache/arrow-ballista/pull/380#discussion_r999615078


##########
ballista/executor/src/execution_loop.rs:
##########
@@ -162,7 +165,7 @@ async fn run_received_tasks<T: 'static + AsLogicalPlan, U: 'static + AsExecution
         task_id, job_id, stage_id, stage_attempt_num, partition_id, task_attempt_num
     );
     info!("Received task {}", task_identity);
-    available_tasks_slots.fetch_sub(1, Ordering::SeqCst);
+    let permit = available_task_slots.clone().acquire_owned().await.unwrap();

Review Comment:
   I can't see whether that happens, as we also wait until there is a slot available before polling (so at this point there should be at least one available.
   
   But I can see if I can make it not need the first check at all.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org