Fawkes API Fawkes Development Version
fawkes::LookupEstimator Class Reference

Estimate the execution time of skills by drawing a random sample from a set of possible values stored in a mongodb database. More...

Inheritance diagram for fawkes::LookupEstimator:

Public Member Functions

 LookupEstimator (MongoDBConnCreator *mongo_connection_manager, Configuration *config, const std::string &cfg_prefix, Logger *logger)
 Constructor. More...
 
float get_execution_time (const Skill &skill) override
 Get the estimated execution time for the given skill string. More...
 
bool can_provide_exec_time (const Skill &skill) const override
 Check if this estimator can give an estimate for a given skill. More...
 
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. More...
 
- Public Member Functions inherited from fawkes::ExecutionTimeEstimator
 ExecutionTimeEstimator (Configuration *config, const ::std::string &cfg_prefix)
 Constructor. More...
 
virtual ~ExecutionTimeEstimator ()=default
 Destructor. More...
 
virtual float get_execution_time (const Skill &skill)=0
 Get the estimated execution time for the given skill string. More...
 
virtual bool can_execute (const Skill &skill)
 Check if this estimator is both allowed and able to give an estimate for a given skill. More...
 
virtual std::pair< SkillerInterface::SkillStatusEnum, std::string > execute (const Skill &skill)
 Let the estimator know that we are executing this skill, so it can apply possible side effects. More...
 

Friends

class ::ExecutionTimeEstimatorLookupEstimatorThread
 Friend the ExecutionTimeEstimatorLookupEstimatorThread so that only it can access init. More...
 

Additional Inherited Members

- Protected Member Functions inherited from fawkes::ExecutionTimeEstimator
std::map< std::string, Skillget_skills_from_config (const std::string &path) const
 Load skill descriptions from a yaml config. More...
 
virtual bool can_provide_exec_time (const Skill &skill) const =0
 Check if this estimator can give an estimate for a given skill. More...
 
template<typename T >
get_property (const Property< T > &property) const
 Get the current property value for active_whitelist_entry_. More...
 
- Protected Attributes inherited from fawkes::ExecutionTimeEstimator
Configuration *const config_
 Config to obtain common configurables. More...
 
const std::string cfg_prefix_
 Config prefix of the estimator. More...
 
const float speed_
 Config estimator-specific speedup factor. More...
 
std::map< std::string, Skill >::const_iterator active_whitelist_entry_
 Points to the whitelist entry that matches the skill to execute. More...
 
const std::map< std::string, Skillwhitelist_
 Whitelist of skills that the estimator is allowed to process. More...
 
const std::map< std::string, Skillblacklist_
 Blacklist of skills that the estimator must not process. More...
 

Detailed Description

Estimate the execution time of skills by drawing a random sample from a set of possible values stored in a mongodb database.

Definition at line 36 of file lookup_estimator.h.

Constructor & Destructor Documentation

◆ LookupEstimator()

fawkes::LookupEstimator::LookupEstimator ( MongoDBConnCreator mongo_connection_manager,
Configuration config,
const std::string &  cfg_prefix,
Logger logger 
)

Constructor.

Parameters
mongo_connection_managerThe mongodb manager to connect to a lookup collection
configThe config to retrieve database related info and the skills to estimates
cfg_prefixThe config prefix under which the estimator-specific configurations are found
loggerThe logger to inform about client connection status

Definition at line 49 of file lookup_estimator.cpp.

References fawkes::MongoDBConnCreator::create_client(), and fawkes::Logger::log_info().

Member Function Documentation

◆ can_provide_exec_time()

bool fawkes::LookupEstimator::can_provide_exec_time ( const Skill skill) const
overridevirtual

Check if this estimator can give an estimate for a given skill.

Parameters
skillThe skill object to check.
Returns
true if this estimator can give an execution time estimate for the given skill.

Implements fawkes::ExecutionTimeEstimator.

Definition at line 74 of file lookup_estimator.cpp.

References fawkes::Logger::log_error(), and fawkes::ExecutionTimeEstimator::Skill::skill_name.

◆ execute()

std::pair< SkillerInterface::SkillStatusEnum, std::string > fawkes::LookupEstimator::execute ( const Skill skill)
overridevirtual

Let the estimator know that we are executing this skill, so it can apply possible side effects.

Parameters
skillThe skill to execute
Returns
skill status after simulated execution along with an error description in case the skill fails

Reimplemented from fawkes::ExecutionTimeEstimator.

Definition at line 151 of file lookup_estimator.cpp.

◆ get_execution_time()

float fawkes::LookupEstimator::get_execution_time ( const Skill skill)
overridevirtual

Get the estimated execution time for the given skill string.

Parameters
skillThe skill object to compute the execution time for.
Returns
The execution time in seconds.

Implements fawkes::ExecutionTimeEstimator.

Definition at line 98 of file lookup_estimator.cpp.

References fawkes::ExecutionTimeEstimator::get_property(), fawkes::Logger::log_error(), fawkes::ExecutionTimeEstimator::Skill::skill_name, and fawkes::ExecutionTimeEstimator::speed_.

Friends And Related Function Documentation

◆ ::ExecutionTimeEstimatorLookupEstimatorThread

Friend the ExecutionTimeEstimatorLookupEstimatorThread so that only it can access init.

Definition at line 39 of file lookup_estimator.h.


The documentation for this class was generated from the following files: