salsa 0.7.1
Loading...
Searching...
No Matches
Salsa::NodeManagerZyre Class Reference

NodeManagerZyre class. More...

#include <NodeManagerZyre.hh>

Inheritance diagram for Salsa::NodeManagerZyre:
Salsa::NodeManager Salsa::Object

Public Member Functions

 NodeManagerZyre (NodeZyre *pNodeZyre)
 
virtual ~NodeManagerZyre ()
 
virtual void resultTaskToExternal (Job *job, TaskInfo *task)
 Handle return of task and send it to external client.
 
virtual SocketonEnter (std::string self, std::string fromType, Message *pMsg, std::vector< std::string > &out)
 
virtual SocketonExit (std::string self, Message *pMsg, std::vector< std::string > &out)
 
virtual SocketonWhisper (std::string self, Message *pMsg, std::vector< std::string > &out)
 
virtual bool handleTaskPool (void *pPool)
 
virtual void addTaskSlot ()
 
virtual void runTask (TaskState *pTaskState, std::string wk, std::string upstream)
 Run task interface.
 
virtual bool sendWhisper (Socket *pSocket, std::string to, std::vector< std::string > &vect)
 
void print (std::string opt="") const
 
void addConsumer (std::string uuid, std::shared_ptr< Socket > s)
 
void addFeeder (std::string uuid, std::shared_ptr< Socket > s)
 
void addWorker (std::string uuid, std::shared_ptr< Socket > s)
 
void addTask (TaskInfo *taskInfo, std::string cuuid, std::string fuuid, Salsa::Job::EQueueType t=Salsa::Job::pending)
 
std::shared_ptr< Feederfeeder (std::string uuid) const
 
std::shared_ptr< Consumerconsumer (std::string uuid) const
 
std::shared_ptr< Workerworker (std::string uuid) const
 
Jobjob (std::string uuid)
 
TaskPooltaskPool ()
 Get NM's task pool.
 
bool hasJobs () const
 
virtual bool terminateFinishedJobs ()
 
uint64_t finishedJobTimeout () const
 Returns finished job timeout.
 
void finishedJobTimeout (uint64_t t)
 Sets finished job timeout.
 
int32_t nSlots (double mult=1.0) const
 
void jobs (std::string clientUUID, std::vector< std::string > &jobs) const
 
TaskInfo * getNextTask ()
 
virtual void resultTask (TaskInfo *task)
 
virtual void noMoreTasks (std::string jobUUID)
 
virtual bool haveMoreTasks ()
 
virtual bool haveMoreTasks (std::string jobUUID)
 
virtual void terminateJob (std::string uuid)
 
virtual void terminateAllJobs (bool finishedonly=false)
 
virtual void publisher (Publisher *p)
 
virtual Publisherpublisher () const
 
virtual bool publish (std::string id, bool force=false) const
 
void clusterAlias (std::string n)
 Sets Cluster alias.
 
std::string clusterAlias ()
 Returns Cluster alias.
 

Static Public Member Functions

static std::shared_ptr< spdlog::logger > getConsoleOutput ()
 Get console output.
 
static void setConsoleLevel (spdlog::level::level_enum level)
 Sets console log level.
 

Protected Attributes

std::string mClusterAlias {"local"}
 Cluster alias.
 
std::map< std::string, Job * > mJobs {}
 List of jobs.
 
std::vector< std::string > mActiveJobs {}
 List of active jobs.
 
std::vector< std::string > mFinishedJobs {}
 List of finished jobs.
 
uint64_t mFinishedJobTimeout
 Finished job timeout in seconds.
 
std::map< std::string, std::shared_ptr< Worker > > mWorkers {}
 List of Workers.
 
std::map< std::string, std::shared_ptr< Consumer > > mConsumers {}
 List of Consumers.
 
std::map< std::string, std::shared_ptr< Feeder > > mFeeders {}
 List of Feeders.
 
TaskPoolmpTaskPool = nullptr
 Task pool.
 
PublishermpPublisher = nullptr
 Publisher.
 

Private Attributes

NodeZyrempNodeZyre = nullptr
 Current zyre node.
 

Static Private Attributes

static std::shared_ptr< spdlog::logger > mspConsoleLogger = spdlog::stdout_color_mt("salsa")
 Pointer to spd logger.
 

Detailed Description

Constructor & Destructor Documentation

◆ NodeManagerZyre()

Salsa::NodeManagerZyre::NodeManagerZyre ( NodeZyre * pNodeZyre)

Constructor

Definition at line 8 of file NodeManagerZyre.cc.

References mpNodeZyre, and Salsa::NodeManager::NodeManager().

◆ ~NodeManagerZyre()

Salsa::NodeManagerZyre::~NodeManagerZyre ( )
virtual

Destructor

Definition at line 14 of file NodeManagerZyre.cc.

Member Function Documentation

◆ addConsumer()

void Salsa::NodeManager::addConsumer ( std::string uuid,
std::shared_ptr< Socket > s )
inherited

Add consumer

Definition at line 57 of file NodeManager.cc.

References mConsumers.

◆ addFeeder()

void Salsa::NodeManager::addFeeder ( std::string uuid,
std::shared_ptr< Socket > s )
inherited

Add feeder

Definition at line 66 of file NodeManager.cc.

References mFeeders.

◆ addTask()

void Salsa::NodeManager::addTask ( TaskInfo * taskInfo,
std::string cuuid,
std::string fuuid,
Salsa::Job::EQueueType t = Salsa::Job::pending )
inherited

Adds task

subscribe to all clients

Definition at line 228 of file NodeManager.cc.

References Salsa::Job::addTask(), Salsa::Job::consumer(), Salsa::Job::feeder(), feeder(), mActiveJobs, mFeeders, and mJobs.

◆ addTaskSlot()

void Salsa::NodeManagerZyre::addTaskSlot ( )
virtual

◆ addWorker()

void Salsa::NodeManager::addWorker ( std::string uuid,
std::shared_ptr< Socket > s )
inherited

Add worker

Definition at line 75 of file NodeManager.cc.

References mWorkers.

◆ clusterAlias() [1/2]

std::string Salsa::NodeManager::clusterAlias ( )
inlineinherited

Returns Cluster alias.

Definition at line 88 of file NodeManager.hh.

References mClusterAlias.

◆ clusterAlias() [2/2]

void Salsa::NodeManager::clusterAlias ( std::string n)
inlineinherited

Sets Cluster alias.

Definition at line 86 of file NodeManager.hh.

References mClusterAlias.

◆ consumer()

std::shared_ptr< Consumer > Salsa::NodeManager::consumer ( std::string uuid) const
inherited

Returns consumer /param uuid UUID

Definition at line 457 of file NodeManager.cc.

References mConsumers.

Referenced by onEnter(), onExit(), onWhisper(), and resultTask().

◆ feeder()

std::shared_ptr< Feeder > Salsa::NodeManager::feeder ( std::string uuid) const
inherited

Returns uuid is feeder /param uuid UUID

Definition at line 443 of file NodeManager.cc.

References mFeeders.

Referenced by addTask(), nSlots(), onEnter(), onExit(), onWhisper(), and publish().

◆ finishedJobTimeout() [1/2]

uint64_t Salsa::NodeManager::finishedJobTimeout ( ) const
inlineinherited

Returns finished job timeout.

Definition at line 55 of file NodeManager.hh.

References mFinishedJobTimeout.

◆ finishedJobTimeout() [2/2]

void Salsa::NodeManager::finishedJobTimeout ( uint64_t t)
inlineinherited

Sets finished job timeout.

Definition at line 57 of file NodeManager.hh.

References mFinishedJobTimeout.

◆ getConsoleOutput()

static std::shared_ptr< spdlog::logger > Salsa::Object::getConsoleOutput ( )
inlinestaticinherited

Get console output.

Definition at line 21 of file Object.hh.

References mspConsoleLogger.

Referenced by Salsa::ConfigZyre::apply().

◆ getNextTask()

TaskInfo * Salsa::NodeManager::getNextTask ( )
inherited

Return Next task from job

Definition at line 260 of file NodeManager.cc.

References mActiveJobs, and mJobs.

◆ handleTaskPool()

bool Salsa::NodeManagerZyre::handleTaskPool ( void * pPool)
virtual

Handle task pool

Reimplemented from Salsa::NodeManager.

Definition at line 120 of file NodeManagerZyre.cc.

References Salsa::NodeManager::mpTaskPool.

◆ hasJobs()

bool Salsa::NodeManager::hasJobs ( ) const
inherited

Returns if jobs are active

Definition at line 521 of file NodeManager.cc.

References mActiveJobs.

◆ haveMoreTasks() [1/2]

bool Salsa::NodeManager::haveMoreTasks ( )
virtualinherited

Sets no more tasks to any job

Definition at line 567 of file NodeManager.cc.

References job(), mActiveJobs, and mJobs.

◆ haveMoreTasks() [2/2]

bool Salsa::NodeManager::haveMoreTasks ( std::string jobUUID)
virtualinherited

Sets no more tasks to job with jobuuid

Definition at line 595 of file NodeManager.cc.

References mJobs.

◆ job()

Job * Salsa::NodeManager::job ( std::string uuid)
inherited

◆ jobs()

void Salsa::NodeManager::jobs ( std::string clientUUID,
std::vector< std::string > & jobs ) const
inherited

Returns list of jobs

Definition at line 529 of file NodeManager.cc.

References jobs(), and mJobs.

Referenced by jobs().

◆ noMoreTasks()

void Salsa::NodeManager::noMoreTasks ( std::string jobUUID)
virtualinherited

Sets no more tasks to job with jobuuid

Definition at line 554 of file NodeManager.cc.

◆ nSlots()

int32_t Salsa::NodeManager::nSlots ( double mult = 1.0) const
inherited

Returns numer of slots

Definition at line 541 of file NodeManager.cc.

References feeder(), and mFeeders.

Referenced by resultTask().

◆ onEnter()

Socket * Salsa::NodeManagerZyre::onEnter ( std::string self,
std::string fromType,
Message * pMsg,
std::vector< std::string > & out )
virtual

On ENTER event

Reimplemented from Salsa::NodeManager.

Definition at line 21 of file NodeManagerZyre.cc.

References Salsa::NodeManager::onEnter(), sendWhisper(), and Salsa::Message::uuid().

◆ onExit()

Socket * Salsa::NodeManagerZyre::onExit ( std::string self,
Message * pMsg,
std::vector< std::string > & out )
virtual

On EXIT event

Reimplemented from Salsa::NodeManager.

Definition at line 37 of file NodeManagerZyre.cc.

References Salsa::NodeManager::onExit(), sendWhisper(), and Salsa::Message::uuid().

◆ onWhisper()

Socket * Salsa::NodeManagerZyre::onWhisper ( std::string self,
Message * pMsg,
std::vector< std::string > & out )
virtual

On WHISPER event

Reimplemented from Salsa::NodeManager.

Definition at line 51 of file NodeManagerZyre.cc.

References Salsa::NodeManager::onWhisper(), sendWhisper(), and Salsa::Message::uuid().

◆ print()

void Salsa::NodeManager::print ( std::string opt = "") const
inherited

Prints NodeManager information

Definition at line 32 of file NodeManager.cc.

References mConsumers, mFeeders, mJobs, mpTaskPool, and mWorkers.

Referenced by resultTask(), and terminateJob().

◆ publish()

bool Salsa::NodeManager::publish ( std::string id,
bool force = false ) const
virtualinherited

Publishes node manager state

Definition at line 625 of file NodeManager.cc.

References feeder(), job(), mClusterAlias, mJobs, and mpPublisher.

◆ publisher() [1/2]

Publisher * Salsa::NodeManager::publisher ( ) const
virtualinherited

Returns publisher

Definition at line 617 of file NodeManager.cc.

References mpPublisher.

◆ publisher() [2/2]

void Salsa::NodeManager::publisher ( Publisher * p)
virtualinherited

Sets publisher

Definition at line 609 of file NodeManager.cc.

References mpPublisher.

◆ resultTask()

void Salsa::NodeManager::resultTask ( TaskInfo * task)
virtualinherited

◆ resultTaskToExternal()

void Salsa::NodeManagerZyre::resultTaskToExternal ( Job * ,
TaskInfo *  )
virtual

Handle return of task and send it to external client.

Handle results of task and send info to external zmq

Reimplemented from Salsa::NodeManager.

Definition at line 101 of file NodeManagerZyre.cc.

References Salsa::NodeManager::job(), and mpNodeZyre.

◆ runTask()

void Salsa::NodeManagerZyre::runTask ( TaskState * ts,
std::string wk,
std::string upstream )
virtual

Run task interface.

Run task

Implements Salsa::NodeManager.

Definition at line 90 of file NodeManagerZyre.cc.

References Salsa::TaskState::executor(), Salsa::TaskExecutor::run(), and Salsa::TaskState::task().

◆ sendWhisper()

bool Salsa::NodeManagerZyre::sendWhisper ( Socket * pSocket,
std::string to,
std::vector< std::string > & vect )
virtual

Sends message via zyre whisper

Reimplemented from Salsa::NodeManager.

Definition at line 131 of file NodeManagerZyre.cc.

References Salsa::SocketZyre::zyre().

Referenced by onEnter(), onExit(), and onWhisper().

◆ setConsoleLevel()

static void Salsa::Object::setConsoleLevel ( spdlog::level::level_enum level)
inlinestaticinherited

Sets console log level.

Definition at line 29 of file Object.hh.

References mspConsoleLogger.

◆ taskPool()

TaskPool * Salsa::NodeManager::taskPool ( )
inherited

Get NM's task pool.

Returns task pool

Definition at line 513 of file NodeManager.cc.

References mpTaskPool.

◆ terminateAllJobs()

void Salsa::NodeManager::terminateAllJobs ( bool finishedonly = false)
virtualinherited

Terminate all jobs

Definition at line 422 of file NodeManager.cc.

References job(), mFinishedJobs, mJobs, and terminateJob().

◆ terminateFinishedJobs()

bool Salsa::NodeManager::terminateFinishedJobs ( )
virtualinherited

Clear finished jobs

Definition at line 391 of file NodeManager.cc.

References job(), mFinishedJobs, mFinishedJobTimeout, and terminateJob().

◆ terminateJob()

void Salsa::NodeManager::terminateJob ( std::string uuid)
virtualinherited

Cleans job

Definition at line 362 of file NodeManager.cc.

References mFeeders, mFinishedJobs, mJobs, mpTaskPool, and print().

Referenced by terminateAllJobs(), and terminateFinishedJobs().

◆ worker()

std::shared_ptr< Worker > Salsa::NodeManager::worker ( std::string uuid) const
inherited

Returns worker /param uuid UUID

Definition at line 469 of file NodeManager.cc.

References mWorkers.

Referenced by onEnter(), onExit(), and onWhisper().

Member Data Documentation

◆ mActiveJobs

std::vector<std::string> Salsa::NodeManager::mActiveJobs {}
protectedinherited

List of active jobs.

Definition at line 93 of file NodeManager.hh.

Referenced by addTask(), getNextTask(), hasJobs(), and haveMoreTasks().

◆ mClusterAlias

std::string Salsa::NodeManager::mClusterAlias {"local"}
protectedinherited

Cluster alias.

Definition at line 91 of file NodeManager.hh.

Referenced by clusterAlias(), clusterAlias(), and publish().

◆ mConsumers

std::map<std::string, std::shared_ptr<Consumer> > Salsa::NodeManager::mConsumers {}
protectedinherited

List of Consumers.

Definition at line 97 of file NodeManager.hh.

Referenced by addConsumer(), consumer(), and print().

◆ mFeeders

std::map<std::string, std::shared_ptr<Feeder> > Salsa::NodeManager::mFeeders {}
protectedinherited

List of Feeders.

Definition at line 98 of file NodeManager.hh.

Referenced by addFeeder(), addTask(), feeder(), nSlots(), print(), and terminateJob().

◆ mFinishedJobs

std::vector<std::string> Salsa::NodeManager::mFinishedJobs {}
protectedinherited

List of finished jobs.

Definition at line 94 of file NodeManager.hh.

Referenced by resultTask(), terminateAllJobs(), terminateFinishedJobs(), and terminateJob().

◆ mFinishedJobTimeout

uint64_t Salsa::NodeManager::mFinishedJobTimeout
protectedinherited

Finished job timeout in seconds.

Definition at line 95 of file NodeManager.hh.

Referenced by finishedJobTimeout(), finishedJobTimeout(), NodeManager(), and terminateFinishedJobs().

◆ mJobs

std::map<std::string, Job *> Salsa::NodeManager::mJobs {}
protectedinherited

◆ mpNodeZyre

NodeZyre* Salsa::NodeManagerZyre::mpNodeZyre = nullptr
private

Current zyre node.

Definition at line 34 of file NodeManagerZyre.hh.

Referenced by addTaskSlot(), NodeManagerZyre(), and resultTaskToExternal().

◆ mpPublisher

Publisher* Salsa::NodeManager::mpPublisher = nullptr
protectedinherited

Publisher.

Definition at line 100 of file NodeManager.hh.

Referenced by publish(), publisher(), publisher(), and ~NodeManager().

◆ mpTaskPool

TaskPool* Salsa::NodeManager::mpTaskPool = nullptr
protectedinherited

◆ mspConsoleLogger

std::shared_ptr< spdlog::logger > Salsa::Object::mspConsoleLogger = spdlog::stdout_color_mt("salsa")
staticprivateinherited

Pointer to spd logger.

Definition at line 32 of file Object.hh.

Referenced by getConsoleOutput(), and setConsoleLevel().

◆ mWorkers

std::map<std::string, std::shared_ptr<Worker> > Salsa::NodeManager::mWorkers {}
protectedinherited

List of Workers.

Definition at line 96 of file NodeManager.hh.

Referenced by addWorker(), print(), and worker().


The documentation for this class was generated from the following files: