Commit 8d268132 authored by Dainius Simelevicius's avatar Dainius Simelevicius
Browse files

references #279: updating jobcontrol jobtable periodically

parent f595e585
// $Id$
/*************************************************************************
* XDAQ Components for Distributed Data Acquisition *
* Copyright (C) 2000-2017, CERN. *
* Copyright (C) 2000-2021, CERN. *
* All rights reserved. *
* Authors: J. Gutleber, L. Orsini and D. Simelevicius *
* *
......@@ -20,7 +18,7 @@
#define WORKSUITE_JOBCONTROL_VERSION_MAJOR 2
#define WORKSUITE_JOBCONTROL_VERSION_MINOR 7
#define WORKSUITE_JOBCONTROL_VERSION_PATCH 3
#define WORKSUITE_JOBCONTROL_VERSION_PATCH 4
#undef WORKSUITE_JOBCONTROL_PREVIOUS_VERSIONS
......
// $Id$
/*************************************************************************
* XDAQ Components for Distributed Data Acquisition *
* Copyright (C) 2000-2017, CERN. *
* Copyright (C) 2000-2021, CERN. *
* All rights reserved. *
* Authors: L. Orsini, D. Simelevicius *
* *
......@@ -225,8 +223,6 @@ jobcontrol::Application::Application (xdaq::ApplicationStub *s)
settings_.setProperty("autorefresh", "0");
}
bool jobcontrol::Application::workerLoopJob(toolbox::task::WorkLoop* wl)
{
......@@ -299,6 +295,9 @@ bool jobcontrol::Application::workerLoopJob(toolbox::task::WorkLoop* wl)
"Unknown Exception in workerLoopJob.");
}
//Notify monitoring data change
this->updateJobTable();
// release
mutex_.give();
......@@ -555,9 +554,6 @@ void jobcontrol::Application::doWatchdog ()
(*iter)._notified = true; // flag notified true to avoid multiple notifications
//-- notify monitoring data change
this->updateJobTable();
std::list<std::string> names;
names.push_back("jobTable");
......@@ -1280,8 +1276,7 @@ int jobcontrol::Application::stringToInt(const std::string s) {
xoap::MessageReference jobcontrol::Application::killExec(
xoap::MessageReference msg)
{
{
xoap::MessageReference reply;
try
{
......@@ -1493,12 +1488,6 @@ xoap::MessageReference jobcontrol::Application::killExec(
reply = createStandardReplyMsg(msgString);
// -- notify monitoring data change
// take
mutex_.take();
this->updateJobTable();
// give
mutex_.give();
std::list<std::string> names;
names.push_back("jobTable");
try
......@@ -1878,12 +1867,6 @@ void jobcontrol::Application::killAllProcs()
iter = procKillList.begin();
for (; iter != procKillList.end(); iter++)
killByPid(((*iter)._pid));
// -- notify monitoring data change
mutex_.take();
this->updateJobTable();
mutex_.give();
std::list<std::string> names;
names.push_back("jobTable");
......@@ -2249,11 +2232,9 @@ xoap::MessageReference jobcontrol::Application::createCrashNotificationMsg(const
xoap::exception::Exception,
"Unknown exception on createCrashNotificationMsg method: failed to create reply message.");
}
}
}
void jobcontrol::Application::killByPid( int pid )
{
_ExecuteCommandData ecd;
ecd._command = stop;
......@@ -2294,12 +2275,9 @@ void jobcontrol::Application::killByPid( int pid )
const std::string msg = "Exception in killByPid while submit workerLoopActionSignature_.\n";
LOG4CPLUS_ERROR(this->getApplicationLogger(), msg << xcept::stdformat_exception_history(e));
}
}
void jobcontrol::Application::killByPidInWorkLoop( int pid )
{
LOG4CPLUS_DEBUG(this->getApplicationLogger(), "Called the killByPidInWorkLoop for pid=" + intToString(pid) );
try
......@@ -2453,7 +2431,6 @@ void jobcontrol::Application::killByPidInWorkLoop( int pid )
return;
}
/**
* kill routine
**/
......@@ -2718,9 +2695,8 @@ void jobcontrol::Application::exportParams()
}
void jobcontrol::Application::updateJobTable()
void jobcontrol::Application::updateJobTable()
{
monitorInfoSpace_->lock();
try
......@@ -2811,10 +2787,8 @@ void jobcontrol::Application::updateJobTable()
}
monitorInfoSpace_->unlock();
// std::cout << "<<< updateJobTable exit" << std::endl;
}
void jobcontrol::Application::StartCommand( _ExecuteCommandData &ecd )
{
......@@ -3013,9 +2987,6 @@ void jobcontrol::Application::StartCommand( _ExecuteCommandData &ecd )
LOG4CPLUS_ERROR(this->getApplicationLogger(), msg << xcept::stdformat_exception_history(e));
}
// -- notify monitoring data change
this->updateJobTable();
std::list<std::string> names;
try
......@@ -3345,7 +3316,6 @@ void jobcontrol::Application::getLogFile (xgi::Input *in, xgi::Output *out)
void jobcontrol::Application::processKillWebPage (xgi::Input *in, xgi::Output *out)
{
try
{
cgicc::Cgicc cgi(in);
......@@ -3387,7 +3357,6 @@ void jobcontrol::Application::processKillWebPage (xgi::Input *in, xgi::Output *o
// redirect to the default web page
redirectToDefaultWebPage(out);
}
void jobcontrol::Application::processKillAllWebPage (xgi::Input *in, xgi::Output *out)
......@@ -3405,55 +3374,14 @@ void jobcontrol::Application::processKillAllWebPage (xgi::Input *in, xgi::Output
// redirect to the default web page
redirectToDefaultWebPage(out);
}
void jobcontrol::Application::actionPerformed (xdata::Event& e)
{
try
{
if ( e.type() == "urn:xdata-event:ItemGroupRetrieveEvent" )
{
xdata::ItemGroupRetrieveEvent & event = dynamic_cast<xdata::ItemGroupRetrieveEvent&>(e);
if ( event.infoSpace()->name().find("urn:jobcontrol") != std::string::npos )
{
mutex_.take();
this->updateJobTable();
mutex_.give();
}
}
}
catch (xcept::Exception &e)
{
mutex_.give();
const std::string msg = "Exception in actionPerformed.";
LOG4CPLUS_ERROR(this->getApplicationLogger(), msg << xcept::stdformat_exception_history(e));
}
catch (std::exception &e)
{
mutex_.give();
const std::string msg = "Exception in actionPerformed.";
LOG4CPLUS_ERROR(this->getApplicationLogger(), msg << e.what());
}
catch (...)
{
mutex_.give();
LOG4CPLUS_ERROR(this->getApplicationLogger(), "Unknown Exception in actionPerformed .");
}
}
xoap::MessageReference jobcontrol::Application::postSOAP
(
xoap::MessageReference message,
std::string url
)
{
}
xoap::MessageReference jobcontrol::Application::postSOAP(xoap::MessageReference message, std::string url)
{
bool setSOAPAction = false;
DOMNode* command;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment