cosmetics
Change-Id: Ifae805ae1e2dac95324e054af09a7b70f5d5b60c
This commit is contained in:
@ -20,7 +20,7 @@ bool DatabaseCampaign::run() {
|
||||
CommandLine &cmd = CommandLine::Inst();
|
||||
|
||||
cmd.addOption("", "", Arg::None, "USAGE: fail-server [options...]\n\n");
|
||||
CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help\t Print usage and exit");
|
||||
CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit");
|
||||
|
||||
Database::cmdline_setup();
|
||||
|
||||
@ -29,11 +29,11 @@ bool DatabaseCampaign::run() {
|
||||
if (!cb_commandline_init()) return false;
|
||||
|
||||
CommandLine::option_handle VARIANT = cmd.addOption("v", "variant", Arg::Required,
|
||||
"-v/--variant\t Variant label (default: \"none\")");
|
||||
"-v/--variant \tVariant label (default: \"none\")");
|
||||
CommandLine::option_handle BENCHMARK = cmd.addOption("b", "benchmark", Arg::Required,
|
||||
"-b/--benchmark\t Benchmark label (default: \"none\")\n");
|
||||
"-b/--benchmark \tBenchmark label (default: \"none\")\n");
|
||||
CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required,
|
||||
"-p/--prune-method\t Which import method to use (default: basic)");
|
||||
"-p/--prune-method \tWhich import method to use (default: basic)");
|
||||
|
||||
if(!cmd.parse()) {
|
||||
log_send << "Error parsing arguments." << std::endl;
|
||||
|
||||
@ -40,7 +40,6 @@ boost::mutex CommThread::m_CommMutex;
|
||||
|
||||
ExperimentData *JobServer::getDone()
|
||||
{
|
||||
|
||||
#ifndef __puma
|
||||
if (m_undoneJobs.Size() == 0
|
||||
&& noMoreExperiments()
|
||||
@ -151,7 +150,7 @@ void JobServer::run()
|
||||
// TODO: Log-level?
|
||||
return;
|
||||
}
|
||||
cout << "JobServer listening...." << endl;
|
||||
cout << "JobServer listening ..." << endl;
|
||||
// TODO: Log-level?
|
||||
#ifndef __puma
|
||||
boost::thread* th;
|
||||
@ -248,43 +247,39 @@ void CommThread::sendPendingExperimentData(Minion& minion)
|
||||
ctrlmsg.set_run_id(m_js.m_runid);
|
||||
ctrlmsg.set_command(FailControlMessage::WORK_FOLLOWS);
|
||||
|
||||
for (i = 0; i < m_job_size ; i++) {
|
||||
if (m_js.m_undoneJobs.Dequeue_nb(temp_exp) == true) {
|
||||
// Got an element from queue, assign ID to workload and send to minion
|
||||
workloadID = m_js.m_counter.increment(); // increment workload counter
|
||||
temp_exp->setWorkloadID(workloadID); // store ID for identification when receiving result
|
||||
ctrlmsg.add_workloadid(workloadID);
|
||||
exp.push_back(temp_exp);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_js.m_runningJobs.insert(workloadID, temp_exp)) {
|
||||
cout << "!![Server]could not insert workload id: [" << workloadID << "] double entry?" << endl;
|
||||
}
|
||||
for (i = 0; i < m_job_size; i++) {
|
||||
if (m_js.m_undoneJobs.Dequeue_nb(temp_exp) == true) {
|
||||
// Got an element from queue, assign ID to workload and send to minion
|
||||
workloadID = m_js.m_counter.increment(); // increment workload counter
|
||||
temp_exp->setWorkloadID(workloadID); // store ID for identification when receiving result
|
||||
ctrlmsg.add_workloadid(workloadID);
|
||||
exp.push_back(temp_exp);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (exp.size() != 0) {
|
||||
ctrlmsg.set_job_size(exp.size());
|
||||
|
||||
cout << " >>[";
|
||||
for ( i = 0; i < exp.size() ; i++) {
|
||||
cout << " "<< ctrlmsg.workloadid(i) <<" ";
|
||||
}
|
||||
cout << "] " << flush;
|
||||
if (!m_js.m_runningJobs.insert(workloadID, temp_exp)) {
|
||||
cout << "!![Server]could not insert workload id: [" << workloadID << "] double entry?" << endl;
|
||||
}
|
||||
}
|
||||
if (exp.size() != 0) {
|
||||
ctrlmsg.set_job_size(exp.size());
|
||||
|
||||
cout << " >>[" << ctrlmsg.workloadid(0) << "+"
|
||||
<< exp.size() << "] \r" << flush;
|
||||
|
||||
if (SocketComm::sendMsg(minion.getSocketDescriptor(), ctrlmsg)) {
|
||||
for (i = 0; i < ctrlmsg.job_size() ; i++) {
|
||||
if (SocketComm::sendMsg(minion.getSocketDescriptor(), exp.front()->getMessage())) {
|
||||
exp.pop_front();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
if (SocketComm::sendMsg(minion.getSocketDescriptor(), ctrlmsg)) {
|
||||
for (i = 0; i < ctrlmsg.job_size(); i++) {
|
||||
if (SocketComm::sendMsg(minion.getSocketDescriptor(), exp.front()->getMessage())) {
|
||||
exp.pop_front();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef __puma
|
||||
// Prevent receiveExperimentResults from modifying (or indirectly, via
|
||||
@ -310,7 +305,7 @@ void CommThread::sendPendingExperimentData(Minion& minion)
|
||||
ctrlmsg.add_workloadid(workloadID); // set workload id
|
||||
ctrlmsg.set_job_size(1); // In 2nd priority the jobserver send only one job
|
||||
//cout << ">>[Server] Re-sending workload [" << workloadID << "]" << endl;
|
||||
cout << ">>R[" << workloadID << "] " << flush;
|
||||
cout << ">>R[" << workloadID << "] \r" << flush;
|
||||
if (SocketComm::sendMsg(minion.getSocketDescriptor(), ctrlmsg)) {
|
||||
SocketComm::sendMsg(minion.getSocketDescriptor(), temp_exp->getMessage());
|
||||
}
|
||||
@ -332,11 +327,10 @@ void CommThread::receiveExperimentResults(Minion& minion, FailControlMessage& ct
|
||||
{
|
||||
int i;
|
||||
ExperimentData* exp = NULL; // Get exp* from running jobs
|
||||
cout << " <<[ ";
|
||||
for (i = 0; i < ctrlmsg.workloadid_size(); i++) {
|
||||
cout << ctrlmsg.workloadid(i) << " ";
|
||||
if (ctrlmsg.workloadid_size() > 0) {
|
||||
cout << " <<[" << ctrlmsg.workloadid(0) << "+"
|
||||
<< ctrlmsg.workloadid_size() << "] \r" << flush;
|
||||
}
|
||||
cout << "] " << flush;
|
||||
#ifndef __puma
|
||||
// Prevent re-sending jobs in sendPendingExperimentData:
|
||||
// a) sendPendingExperimentData needs an intact job to serialize and send it.
|
||||
@ -346,8 +340,8 @@ void CommThread::receiveExperimentResults(Minion& minion, FailControlMessage& ct
|
||||
// already may cause breakage in sendPendingExperimentData (a).
|
||||
boost::unique_lock<boost::mutex> lock(m_CommMutex);
|
||||
#endif
|
||||
for (i = 0 ; i < ctrlmsg.workloadid_size() ; i++) {
|
||||
if (m_js.m_runningJobs.remove( ctrlmsg.workloadid(i), exp)) { // ExperimentData* found
|
||||
for (i = 0; i < ctrlmsg.workloadid_size(); i++) {
|
||||
if (m_js.m_runningJobs.remove(ctrlmsg.workloadid(i), exp)) { // ExperimentData* found
|
||||
// deserialize results, expect failures
|
||||
if (!SocketComm::rcvMsg(minion.getSocketDescriptor(), exp->getMessage())) {
|
||||
m_js.m_runningJobs.insert(ctrlmsg.workloadid(i), exp);
|
||||
|
||||
@ -112,21 +112,21 @@ public:
|
||||
*/
|
||||
ExperimentData* getDone();
|
||||
/**
|
||||
* The Campaign controller must signalize, that there will be no
|
||||
* more parameter sets. We need this, as we allow concurrent parameter
|
||||
* generation and distribution.
|
||||
* The Campaign controller must signal that there will be no more parameter
|
||||
* sets. We need this, as we allow concurrent parameter generation and
|
||||
* distribution.
|
||||
*/
|
||||
void setNoMoreExperiments() { m_noMoreExps = true; }
|
||||
/**
|
||||
* Checks whether there are no more experiment paremeter sets.
|
||||
* Checks whether there are no more experiment parameter sets.
|
||||
* @return \c true if no more parameter sets available, \c false otherwise
|
||||
* @see setNoMoreExperiments
|
||||
*/
|
||||
bool noMoreExperiments() const { return m_noMoreExps; }
|
||||
|
||||
/**
|
||||
* The Campaign Controller can signalize, that the jobserver can
|
||||
* stop listening for client connections.
|
||||
/**
|
||||
* The Campaign Controller may signal that the jobserver can stop listening
|
||||
* for client connections.
|
||||
*/
|
||||
void done() { m_finish = true; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user