GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Metrics Reporting Webserver

Typedefs

typedef boost::function
< std::pair< std::string,
std::string >std::map
< std::string, std::string > &)> 
graphlab::http_redirect_callback_type

Functions

void graphlab::add_metric_server_callback (std::string page, http_redirect_callback_type callback)
 This is used to map a URL on the mtrics server to a processing function.
void graphlab::launch_metric_server ()
 Starts the metrics reporting server.
void graphlab::stop_metric_server ()
 Stops the metrics reporting server if one is started.
void graphlab::stop_metric_server_on_eof ()
 Waits for a ctrl-D on machine 0, and stops the metrics reporting server if one is started.

Detailed Description


Typedef Documentation

typedef boost::function<std::pair<std::string, std::string>std::map<std::string, std::string>&)> graphlab::http_redirect_callback_type

The callback type used for add_metric_server_callback() See add_metric_server_callback() for details.

Definition at line 42 of file metrics_server.hpp.


Function Documentation

void graphlab::add_metric_server_callback ( std::string  page,
http_redirect_callback_type  callback 
)

This is used to map a URL on the mtrics server to a processing function.

The processing function must have the prototype

std::pair<std::string, std::string> callback(std::map<std::string, std::string>&)

The processing function takes a map of GET variables to their corresponding values, and returns a pair of strings. (content_type, content)

  • content type is the http content_type header. For instance text/plain or text/html.
  • content is the actual body

For instance: The builtin 404 handler looks like this:

std::pair<std::string, std::string>
four_oh_four(std::map<std::string, std::string>& varmap) {
return std::make_pair(std::string("text/html"),
std::string("Page Not Found"));
}
Note:
The callbacks are only processed on machine 0 since only machine 0 launches the server.
Parameters:
pageThe page to map. For instance page = "a.html" will be shown on http://[server]/a.html
callbackThe callback function to use to process the page

Definition at line 198 of file metrics_server.cpp.

void graphlab::launch_metric_server ( )

Starts the metrics reporting server.

The function may be called by all machines simultaneously since it only does useful work on machine 0. Only machine 0 will launch the web server.

Definition at line 205 of file metrics_server.cpp.

void graphlab::stop_metric_server ( )

Stops the metrics reporting server if one is started.

The function may be called by all machines simultaneously since it only does useful work on machine 0.

Definition at line 224 of file metrics_server.cpp.

void graphlab::stop_metric_server_on_eof ( )

Waits for a ctrl-D on machine 0, and stops the metrics reporting server if one is started.

The function may be called by all machines simultaneously since it only does useful work on machine 0. It waits for the stdin stream to close (when the user hit ctrl-d), then shuts down the server.

Definition at line 231 of file metrics_server.cpp.