23 #include <aspect/logging.h>
24 #include <config/config.h>
25 #include <core/threading/mutex.h>
26 #include <execution_time_estimator/aspect/execution_time_estimator.h>
27 #include <plugins/mongodb/aspect/mongodb_conncreator.h>
29 #include <bsoncxx/builder/basic/document.hpp>
39 friend class ::ExecutionTimeEstimatorLookupEstimatorThread;
44 const std::string & cfg_prefix,
48 std::pair<SkillerInterface::SkillStatusEnum, std::string>
execute(
const Skill &skill)
override;
51 bsoncxx::builder::basic::document get_skill_query(
const Skill &skill)
const;
56 constexpr
static char logger_name_[] =
"LookupEstimator";
57 constexpr
static char skill_name_field_[] =
"name";
58 constexpr
static char duration_field_[] =
"duration";
61 mongocxx::client * mongodb_client_lookup_;
66 const std::string instance_;
67 const std::string database_;
68 const std::string collection_;
70 const std::map<std::string, bool> skill_match_args;
Get estimates for skill execution times from samples of a mongodb database.
Interface for configuration handling.
A configurable property that is skill-specific and may have a default value.
A structured representation of a skill.
An abstract estimator for the execution time of a skill.
Estimate the execution time of skills by drawing a random sample from a set of possible values stored...
LookupEstimator(MongoDBConnCreator *mongo_connection_manager, Configuration *config, const std::string &cfg_prefix, Logger *logger)
Constructor.
float get_execution_time(const Skill &skill) override
Get the estimated execution time for the given skill string.
bool can_provide_exec_time(const Skill &skill) const override
Check if this estimator can give an estimate for a given skill.
std::pair< SkillerInterface::SkillStatusEnum, std::string > execute(const Skill &skill) override
Let the estimator know that we are executing this skill, so it can apply possible side effects.
Interface for a MongoDB connection creator.
Mutex mutual exclusion lock.
SkillStatusEnum
This determines the current status of skill execution.
Fawkes library namespace.