File monitor_service.hpp

This file implements a monitoring service, where clients push updates towards to head node, which then presents the user with up-to-date information about the progress.

Author

Benjamin Lindner ben@benlabs.net

Version

See VERSION in CMakeLists.txt

Copyright

GNU General Public License

Enums

enum MonitorTag

Defines communication tags between client/server

Values:

enumerator MONITOR_HANGUP
enumerator MONITOR_UPDATE
enumerator MONITOR_RESET
enumerator MONITOR_SAMPLINGFACTOR
class MonitorService
#include <monitor_service.hpp>

Server side code which implements buffered status updates for monitoring the progress of a calculation.

Public Functions

MonitorService(boost::asio::io_context &io_service, double from, double to)
inline boost::asio::ip::tcp::endpoint get_endpoint()
void reset()
void hangup()
void run()

Private Functions

void listener()
void update()
void print()
void reset_timer()
void reset_state()

Private Members

boost::asio::io_context &m_io_service
boost::asio::ip::tcp::acceptor m_acceptor
double m_from
double m_to
double m_current
Timer m_timer
std::string m_timerlabel
boost::thread *m_listener
bool m_listener_status
std::queue<double> update_thresholds
size_t samplingfactor_
class MonitorClient
#include <monitor_service.hpp>

Client side code which implements buffered status updates for monitoring the progress of a calculation.

Public Functions

MonitorClient(boost::asio::ip::tcp::endpoint server)
void reset_server()
void set_samplingfactor(size_t samplingfactor)
void set_samplingfactor_server(size_t samplingfactor)
void update(size_t rank, double progress)

Private Members

boost::asio::ip::tcp::endpoint m_endpoint
std::queue<double> update_thresholds
boost::posix_time::ptime lastupdate_
size_t samplingfactor_