Moved client- and server-settings to CMAKE-config.
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1248 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -34,20 +34,20 @@ bool JobClient::connectToServer()
|
||||
memcpy(&serv_addr.sin_addr.s_addr, m_server_ent->h_addr, m_server_ent->h_length);
|
||||
serv_addr.sin_port = htons(m_server_port);
|
||||
|
||||
int retries = RETRY_COUNT;
|
||||
int retries = CLIENT_RETRY_COUNT;
|
||||
while(true) {
|
||||
if(connect(m_sockfd, (sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
|
||||
perror("[Client@connect()]");
|
||||
if(retries > 0) {
|
||||
// Wait RAND_BACKOFF_TSTART to RAND_BACKOFF_TEND seconds:
|
||||
int delay = rand() % (RAND_BACKOFF_TEND-RAND_BACKOFF_TSTART) + RAND_BACKOFF_TSTART;
|
||||
// Wait CLIENT_RAND_BACKOFF_TSTART to RAND_BACKOFF_TEND seconds:
|
||||
int delay = rand() % (CLIENT_RAND_BACKOFF_TEND-CLIENT_RAND_BACKOFF_TSTART) + CLIENT_RAND_BACKOFF_TSTART;
|
||||
cout << "[Client] Retrying to connect to server in ~" << delay << "s..." << endl;
|
||||
sleep(delay);
|
||||
usleep(rand() % 1000000);
|
||||
--retries;
|
||||
continue;
|
||||
}
|
||||
cout << "[Client] Unable to reconnect (tried " << RETRY_COUNT << " times); "
|
||||
cout << "[Client] Unable to reconnect (tried " << CLIENT_RETRY_COUNT << " times); "
|
||||
<< "I'll give it up!" << endl;
|
||||
return false; // finally: unable to connect, give it up :-(
|
||||
}
|
||||
|
||||
@ -1,26 +1,16 @@
|
||||
/**
|
||||
* \brief The Minion's JobClient requests ExperimentData and returns results.
|
||||
*
|
||||
* \author Martin Hoffmann
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __JOB_CLIENT_H__
|
||||
#define __JOB_CLIENT_H__
|
||||
#define __JOB_CLIENT_H__
|
||||
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "SocketComm.hpp"
|
||||
#include "controller/ExperimentData.hpp"
|
||||
#include "jobserver/messagedefs/FailControlMessage.pb.h"
|
||||
|
||||
// FIXME This should be part of a "client config" (?).
|
||||
#define RAND_BACKOFF_TSTART 3
|
||||
#define RAND_BACKOFF_TEND 8
|
||||
#define RETRY_COUNT 3
|
||||
#include "config/FailConfig.hpp"
|
||||
|
||||
namespace fi {
|
||||
|
||||
@ -28,6 +18,7 @@ namespace fi {
|
||||
* \class JobClient
|
||||
*
|
||||
* \brief Manages communication with JobServer
|
||||
* The Minion's JobClient requests ExperimentData and returns results.
|
||||
*
|
||||
*/
|
||||
class JobClient {
|
||||
@ -63,10 +54,6 @@ namespace fi {
|
||||
bool sendResult(ExperimentData& result);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif // __JOB_CLIENT_H__
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
// Author: Martin Hoffmann, Richard Hellwig, Adrian Böckenkamp
|
||||
// Date: 07.10.11
|
||||
|
||||
// <iostream> needs to be included before *.pb.h, otherwise ac++/Puma chokes on the latter
|
||||
#include <iostream>
|
||||
|
||||
@ -17,6 +14,7 @@
|
||||
#include "jobserver/messagedefs/FailControlMessage.pb.h"
|
||||
#include "SocketComm.hpp"
|
||||
#include "controller/Minion.hpp"
|
||||
|
||||
#ifndef __puma
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/date_time.hpp>
|
||||
@ -32,7 +30,9 @@ void JobServer::addParam(ExperimentData* exp){
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SERVER_PERFORMANCE_MEASURE
|
||||
volatile unsigned JobServer::m_DoneCount = 0;
|
||||
#endif
|
||||
|
||||
ExperimentData *JobServer::getDone()
|
||||
{
|
||||
@ -58,12 +58,12 @@ ExperimentData *JobServer::getDone()
|
||||
#ifdef SERVER_PERFORMANCE_MEASURE
|
||||
void JobServer::measure()
|
||||
{
|
||||
cout << "\n[Server] Logging throughput in \"" << PERFORMANCE_LOG_PATH << "\"..." << endl;
|
||||
ofstream m_file(PERFORMANCE_LOG_PATH, std::ios::trunc); // overwrite existing perf-logs
|
||||
cout << "\n[Server] Logging throughput in \"" << SERVER_PERF_LOG_PATH << "\"..." << endl;
|
||||
ofstream m_file(SERVER_PERF_LOG_PATH, std::ios::trunc); // overwrite existing perf-logs
|
||||
if(!m_file.is_open()) {
|
||||
cerr << "[Server] Perf-logging has been enabled"
|
||||
<< "but I was not able to write the log-file \""
|
||||
<< PERFORMANCE_LOG_PATH << "\"." << endl;
|
||||
<< SERVER_PERF_LOG_PATH << "\"." << endl;
|
||||
exit(1);
|
||||
}
|
||||
unsigned counter = 0;
|
||||
@ -73,9 +73,9 @@ void JobServer::measure()
|
||||
while(!m_finish) {
|
||||
// Format: 1st column (seconds)[TAB]2nd column (throughput)
|
||||
m_file << counter << "\t" << (m_DoneCount - diff) << endl;
|
||||
counter += PERFORMANCE_STEPPING_SEC;
|
||||
counter += SERVER_PERF_STEPPING_SEC;
|
||||
diff = m_DoneCount;
|
||||
sleep(PERFORMANCE_STEPPING_SEC);
|
||||
sleep(SERVER_PERF_STEPPING_SEC);
|
||||
}
|
||||
// NOTE: Summing up the values written in the 2nd column does not
|
||||
// necessarily yield the number of completed experiments/jobs
|
||||
|
||||
@ -1,39 +1,28 @@
|
||||
/**
|
||||
* \brief The JobServer supplies the Minions with ExperimentData's
|
||||
* and receives the result data.
|
||||
*
|
||||
* \author Martin Hoffmann, Richard Hellwig, Adrian Böckenkamp
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __JOB_SERVER_H__
|
||||
#define __JOB_SERVER_H__
|
||||
#define __JOB_SERVER_H__
|
||||
|
||||
#include "controller/Minion.hpp"
|
||||
#include "util/SynchronizedQueue.hpp"
|
||||
#include "util/SynchronizedCounter.hpp"
|
||||
#include "util/SynchronizedMap.hpp"
|
||||
#include "config/FailConfig.hpp"
|
||||
|
||||
#include <list>
|
||||
#ifndef __puma
|
||||
#include <boost/thread.hpp>
|
||||
#endif
|
||||
|
||||
// TODO: This should be part of a "server-config".
|
||||
#define SERVER_PERFORMANCE_MEASURE
|
||||
#define PERFORMANCE_LOG_PATH "perf.dat"
|
||||
#define PERFORMANCE_STEPPING_SEC 1
|
||||
|
||||
namespace fi {
|
||||
|
||||
class CommThread;
|
||||
|
||||
/**
|
||||
* \class JobServer
|
||||
* Manages the campaigns parameter distributions.
|
||||
* The Campaign Controller can add experiment parameter sets,
|
||||
* which the Jobserver will distribute to requesting clients.
|
||||
* The campaign controller can wait for all results, or a timeout.
|
||||
* The server supplies the Minions with ExperimentData's and receives the result data.
|
||||
*
|
||||
* Manages the campaigns parameter distributions. The Campaign Controller can add
|
||||
* experiment parameter sets, which the Jobserver will distribute to requesting
|
||||
* clients. The campaign controller can wait for all results, or a timeout.
|
||||
*/
|
||||
class JobServer
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user