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/06 15:52:25 UTC

[GitHub] [arrow] westonpace commented on a diff in pull request #14257: ARROW-17853: [Python][CI] Timeout in test_dataset.py::test_write_dataset_s3_put_only

westonpace commented on code in PR #14257:
URL: https://github.com/apache/arrow/pull/14257#discussion_r989220819


##########
cpp/src/arrow/util/async_util.cc:
##########
@@ -98,13 +98,53 @@ class FifoQueue : public AsyncTaskScheduler::Queue {
   std::list<std::unique_ptr<Task>> tasks_;
 };
 
+class AlreadyFailedScheduler : public AsyncTaskScheduler {
+ public:
+  explicit AlreadyFailedScheduler(Status failure_reason,
+                                  FnOnce<Status(Status)> finish_callback)
+      : failure_reason_(std::move(failure_reason)),
+        finish_callback_(std::move(finish_callback)) {}
+  bool AddTask(std::unique_ptr<Task> task) override { return false; }
+  void End() override {
+    std::ignore = std::move(finish_callback_)(failure_reason_);
+    self.reset();
+  }
+  Future<> OnFinished() const override {
+    DCHECK(false) << "You should not rely on sub-scheduler's OnFinished.  Use a "
+                     "finished callback when creating the sub-scheduler instead";
+    return Future<>::MakeFinished(Status::UnknownError("Unreachable code encountered"));
+  }
+  AsyncTaskScheduler* MakeSubScheduler(FnOnce<Status(Status)> finish_callback,
+                                       Throttle* throttle,
+                                       std::unique_ptr<Queue> queue) override {
+    return AlreadyFailedScheduler::Make(failure_reason_, std::move(finish_callback));
+  }

Review Comment:
   I'm moving the finish callback passed in and not `finish_callback_` (which is the finish callback for the parent scheduler).  That being said, the very first scheduler doesn't have a finish callback by design.



-- 
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