quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbdeshm...@apache.org
Subject [2/2] incubator-quickstep git commit: HPF can schedule work from lower priority levels.
Date Fri, 15 Jul 2016 21:52:37 GMT
HPF can schedule work from lower priority levels.

- If highest priority level doesn't have work and we have some free
  cycles, we will schedule work from lower priority levels.
- We will probe priority levels in decreasing order to see if there is
  any work to be scheduled.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/eea56033
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/eea56033
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/eea56033

Branch: refs/heads/scheduler++
Commit: eea560336e29d15a4611f7ae4910c878a2e6bd0d
Parents: 8caae5a
Author: Harshad Deshmukh <hbdeshmukh@apache.org>
Authored: Fri Jul 15 16:38:46 2016 -0500
Committer: Harshad Deshmukh <hbdeshmukh@apache.org>
Committed: Fri Jul 15 16:38:46 2016 -0500

----------------------------------------------------------------------
 query_execution/Learner.hpp                |  4 ++++
 query_execution/PriorityPolicyEnforcer.cpp | 15 +++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/eea56033/query_execution/Learner.hpp
----------------------------------------------------------------------
diff --git a/query_execution/Learner.hpp b/query_execution/Learner.hpp
index 36f1509..8f63c19 100644
--- a/query_execution/Learner.hpp
+++ b/query_execution/Learner.hpp
@@ -169,6 +169,10 @@ class Learner {
     }
   }
 
+  inline const std::set<std::size_t>& getSetOfPriorityLevels() const {
+    return priority_levels_set_;
+  }
+
   /**
    * @brief Randomly pick a priority level.
    *

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/eea56033/query_execution/PriorityPolicyEnforcer.cpp
----------------------------------------------------------------------
diff --git a/query_execution/PriorityPolicyEnforcer.cpp b/query_execution/PriorityPolicyEnforcer.cpp
index 9bfe979..e0290f1 100644
--- a/query_execution/PriorityPolicyEnforcer.cpp
+++ b/query_execution/PriorityPolicyEnforcer.cpp
@@ -229,18 +229,21 @@ void PriorityPolicyEnforcer::getWorkerMessagesHPF(std::vector<std::unique_ptr<Wo
   // been collected.
   DCHECK(worker_messages->empty());
   if (learner_->hasActiveQueries()) {
+    const std::set<std::size_t> &priority_set = learner_->getSetOfPriorityLevels();
     std::unordered_map<std::size_t, bool> finished_queries_ids;
-    const int chosen_priority_level = learner_->getHighestPriorityLevel();
-    if (chosen_priority_level == kInvalidPriorityLevel) {
-      DLOG(INFO) << "No valid priority level chosen";
+    auto priority_set_reverse_it = priority_set.rbegin();
+    if (priority_set.empty()) {
+      DLOG(INFO) << "No priority level available";
       return;
     }
-    while (worker_messages->size() < FLAGS_max_msgs_per_dispatch_round) {
-      WorkerMessage *next_worker_message = getNextWorkerMessageFromPriorityLevel(chosen_priority_level,
&finished_queries_ids);
+    while (worker_messages->size() < FLAGS_max_msgs_per_dispatch_round && priority_set_reverse_it
!= priority_set.rend()) {
+      WorkerMessage *next_worker_message = getNextWorkerMessageFromPriorityLevel(*priority_set_reverse_it,
&finished_queries_ids);
       if (next_worker_message != nullptr) {
         worker_messages->push_back(std::unique_ptr<WorkerMessage>(next_worker_message));
       } else {
-        break;
+        // No work orders available in the current priority level, check the
+        // next largest priority level.
+        ++priority_set_reverse_it;
       }
     }
     for (auto finished_qid_pair : finished_queries_ids) {


Mime
View raw message