File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,13 @@ class ObjectsManager
118118 */
119119 void updateServiceDiscovery ();
120120
121+ /* *
122+ * \brief Remove all objects from the ServiceDiscovery.
123+ * Remove all objects from the ServiceDiscovery even though they still might be published by the task.
124+ * This is typically used at End of Activity.
125+ */
126+ void removeAllFromServiceDiscovery ();
127+
121128 private:
122129 std::unique_ptr<TObjArray> mMonitorObjects ;
123130 TaskConfig& mTaskConfig ;
Original file line number Diff line number Diff line change @@ -42,11 +42,11 @@ class ServiceDiscovery
4242 // / Stops the health thread and deregisteres from Consul health checks
4343 ~ServiceDiscovery ();
4444
45- // / Registeres list of online objects by sending HTTP PUT request to Consul server
45+ // / Registers list of online objects by sending HTTP PUT request to Consul server
4646 // / \param objects List of comma separated objects
4747 void _register (const std::string& objects);
4848
49- // / Deregisteres service
49+ // / Deregisters service
5050 void deregister ();
5151
5252 private:
Original file line number Diff line number Diff line change @@ -72,6 +72,15 @@ void ObjectsManager::updateServiceDiscovery()
7272 mUpdateServiceDiscovery = false ;
7373}
7474
75+ void ObjectsManager::removeAllFromServiceDiscovery ()
76+ {
77+ if (mServiceDiscovery == nullptr ) {
78+ return ;
79+ }
80+ mServiceDiscovery ->_register (" " );
81+ mUpdateServiceDiscovery = true ;
82+ }
83+
7584void ObjectsManager::stopPublishing (TObject* object)
7685{
7786 stopPublishing (object->GetName ());
Original file line number Diff line number Diff line change 2020#include < boost/property_tree/json_parser.hpp>
2121#include < boost/algorithm/string/split.hpp>
2222#include < boost/algorithm/string.hpp>
23+ #include " QualityControl/QcInfoLogger.h"
2324
2425namespace o2 ::quality_control::core
2526{
@@ -90,11 +91,13 @@ void ServiceDiscovery::_register(const std::string& objects)
9091 boost::property_tree::json_parser::write_json (ss, pt);
9192
9293 send (" /v1/agent/service/register" , ss.str ());
94+ QcInfoLogger::GetInstance () << " Registration to ServiceDiscovery" << AliceO2::InfoLogger::InfoLogger::endm;
9395}
9496
9597void ServiceDiscovery::deregister ()
9698{
9799 send (" /v1/agent/service/deregister/" + mId , " " );
100+ QcInfoLogger::GetInstance () << " Deregistration from ServiceDiscovery" << AliceO2::InfoLogger::InfoLogger::endm;
98101}
99102
100103void ServiceDiscovery::runHealthServer (unsigned int port)
Original file line number Diff line number Diff line change 1515
1616#include " QualityControl/TaskFactory.h"
1717
18- #include " QualityControl/QcInfoLogger.h"
1918#include " RootClassFactory.h"
2019
2120namespace o2 ::quality_control::core
Original file line number Diff line number Diff line change @@ -314,13 +314,15 @@ void TaskRunner::startOfActivity()
314314 Activity activity (mConfigFile ->get <int >(" qc.config.Activity.number" ),
315315 mConfigFile ->get <int >(" qc.config.Activity.type" ));
316316 mTask ->startOfActivity (activity);
317+ mObjectsManager ->updateServiceDiscovery ();
317318}
318319
319320void TaskRunner::endOfActivity ()
320321{
321322 Activity activity (mConfigFile ->get <int >(" qc.config.Activity.number" ),
322323 mConfigFile ->get <int >(" qc.config.Activity.type" ));
323324 mTask ->endOfActivity (activity);
325+ mObjectsManager ->removeAllFromServiceDiscovery ();
324326
325327 double rate = mTotalNumberObjectsPublished / mTimerTotalDurationActivity .getTime ();
326328 mCollector ->send ({ rate, " QC_task_Rate_objects_published_per_second_whole_run" });
You can’t perform that action at this time.
0 commit comments