Skip to content

Commit

Permalink
tentative work-around for daemonization madness
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Mar 16, 2018
1 parent 61c2df4 commit 1e47d8f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
2 changes: 2 additions & 0 deletions include/wrench/services/compute/batch/BatchService.h
Expand Up @@ -91,6 +91,8 @@ namespace wrench {
unsigned int batsched_port;
#endif

bool clean_exit = false;

//Configuration to create randomness in measurement period initially
unsigned long random_interval = 10;

Expand Down
37 changes: 21 additions & 16 deletions src/wrench/services/compute/batch/BatchService.cpp
Expand Up @@ -509,6 +509,7 @@ namespace wrench {
}

WRENCH_INFO("Batch Service on host %s terminated!", S4U_Simulation::getHostName().c_str());
this->clean_exit = true;
return 0;
}

Expand Down Expand Up @@ -954,9 +955,11 @@ namespace wrench {
*/
void BatchService::cleanup() {

this->setStateToDown();
WRENCH_INFO("Failing current standard jobs");
this->failCurrentStandardJobs(std::shared_ptr<FailureCause>(new ServiceIsDown(this)));
if (this->clean_exit) {
this->setStateToDown();
WRENCH_INFO("Failing current standard jobs");
this->failCurrentStandardJobs(std::shared_ptr<FailureCause>(new ServiceIsDown(this)));
}

// //remove standard job alarms
// std::vector<std::unique_ptr<Alarm>>::iterator it;
Expand Down Expand Up @@ -1018,19 +1021,21 @@ namespace wrench {
#endif


if (this->supports_pilot_jobs) {
for (auto & job : this->running_jobs) {
if ((job)->getWorkflowJob()->getType() == WorkflowJob::PILOT) {
PilotJob *p_job = (PilotJob *) ((job)->getWorkflowJob());
BatchService *cs = (BatchService *) p_job->getComputeService();
if (cs == nullptr) {
throw std::runtime_error(
"BatchService::terminate(): can't find compute service associated to pilot job");
}
try {
cs->stop();
} catch (wrench::WorkflowExecutionException &e) {
// ignore
if (this->clean_exit) {
if (this->supports_pilot_jobs) {
for (auto &job : this->running_jobs) {
if ((job)->getWorkflowJob()->getType() == WorkflowJob::PILOT) {
PilotJob *p_job = (PilotJob *) ((job)->getWorkflowJob());
BatchService *cs = (BatchService *) p_job->getComputeService();
if (cs == nullptr) {
throw std::runtime_error(
"BatchService::terminate(): can't find compute service associated to pilot job");
}
try {
cs->stop();
} catch (wrench::WorkflowExecutionException &e) {
// ignore
}
}
}
}
Expand Down

0 comments on commit 1e47d8f

Please sign in to comment.