Try<Nothing> QoSCorrectionObserver::doQosDecision() { if (contentions.get().empty() || ResourceUsageHelper::getRevocableExecutors(usage.get()).empty()) { SERENITY_LOG(INFO) << "Empty contentions received."; emptyContentionsReceived(); // Produce empty corrections and contentions produceResultsAndClearConsumedData(); return Nothing(); } if (iterationCooldownCounter.isSome()) { SERENITY_LOG(INFO) << "QoS Correction observer is in cooldown phase"; cooldownPhase(); // Produce empty corrections and contentions produceResultsAndClearConsumedData(); return Nothing(); } Try<QoSCorrections> corrections = newContentionsReceived(); if (corrections.isError()) { SERENITY_LOG(INFO) << "corrections returned error: " << corrections.error(); // Produce empty corrections and contentions produceResultsAndClearConsumedData(); return Error(corrections.error()); } if (corrections.get().empty()) { SERENITY_LOG(INFO) << "Strategy didn't found aggressors"; // Strategy didn't found aggressors. // Passing contentions to next QoS Controller. produceResultsAndClearConsumedData(QoSCorrections(), this->contentions.get()); return Nothing(); } // Strategy has pointed aggressors, so don't pass // current contentions to next QoS Controller. iterationCooldownCounter = this->cooldownIterations; produceResultsAndClearConsumedData(corrections.get(), Contentions()); return Nothing(); }
Try<Nothing> QoSCorrectionObserver::correctAgent() { // Consumer base code ensures we have needed information here. if (!this->currentContentions.isSome() || !this->currentUsage.isSome()) return Nothing(); // Allowed to interpret contention using different algorithms. Try<QoSCorrections> corrections = this->revStrategy->decide(ageFilter, this->currentContentions.get(), this->currentUsage.get()); if (corrections.isError()) { // In case of Error produce empty corrections. produce(QoSCorrections()); } else { produce(corrections.get()); } this->currentContentions = None(); this->currentUsage = None(); return Nothing(); }