next up previous contents
Next: Future Work Up: A complete example of Previous: A complete example of   Contents

Hostname based Round-Robin plugin scheduler.

#include "GlobalSchedulers.hh"
#include "UserScheduler.hh"
#include "est_internal.hh"
#include <map>

std::map<std::string, unsigned int> hostCounter;

class HostnameRR : public UserScheduler {
  static const char* stName;

  void init();

  static char* serialize(HostnameRR* GS);
  static HostnameRR* deserialize(const char* serializedScheduler);
  /* Overriden aggregate method to schedule jobs with the SRA policy. */
  int aggregate(corba_response_t* aggrResp, size_t max_srv,
		const size_t nb_responses, const corba_response_t* responses);

using namespace std;

const char* HostnameRR::stName="UserGS";

HostnameRR::~HostnameRR() {


HostnameRR::HostnameRR() {
  this->name = this->stName;
  this->nameLength = strlen(this->name);

int HostnameRR::aggregate(corba_response_t* aggrResp, size_t max_srv,
			    const size_t nb_responses,
			    const corba_response_t* responses)
  ServerList::iterator itSeD;
  unsigned int nbUsage=0;
  corba_server_estimation_t selected;

  cout << "******************** HostnameRR ********************" << endl;
  ServerList candidates = CORBA_to_STL(responses, nb_responses);

  for (itSeD=candidates.begin(); itSeD!=candidates.end(); ++itSeD)
    // We select the SeD by its host usage.
    if (hostCounter[HOSTNAME(*itSeD)]<=nbUsage)


  return 0;


The DIET Team - Ven 18 nov 2011 18:13:39 PST