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.

◆ ~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 Salsa::NodeManager::mConsumers.

Referenced by Salsa::NodeZyre::init().

◆ 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 Salsa::NodeManager::mFeeders.

Referenced by Salsa::NodeZyre::init().

◆ addTask()

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

◆ addTaskSlot()

◆ 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 Salsa::NodeManager::mWorkers.

Referenced by Salsa::NodeZyre::init().

◆ clusterAlias() [1/2]

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

Returns Cluster alias.

Definition at line 88 of file NodeManager.hh.

References Salsa::NodeManager::mClusterAlias.

◆ clusterAlias() [2/2]

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

Sets Cluster alias.

Definition at line 86 of file NodeManager.hh.

References Salsa::NodeManager::mClusterAlias.

Referenced by Salsa::NodeZyre::init().

◆ consumer()

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

◆ feeder()

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

◆ finishedJobTimeout() [1/2]

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

Returns finished job timeout.

Definition at line 55 of file NodeManager.hh.

References Salsa::NodeManager::mFinishedJobTimeout.

Referenced by Salsa::NodeZyre::init().

◆ finishedJobTimeout() [2/2]

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

Sets finished job timeout.

Definition at line 57 of file NodeManager.hh.

References Salsa::NodeManager::mFinishedJobTimeout.

◆ getConsoleOutput()

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

Get console output.

Definition at line 21 of file Object.hh.

References Salsa::Object::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 Salsa::NodeManager::mActiveJobs, and Salsa::NodeManager::mJobs.

Referenced by Salsa::Feeder::onWhisper().

◆ 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::TaskPool::handlePipe(), and Salsa::NodeManager::mpTaskPool.

Referenced by Salsa::NodeZyre::exec().

◆ hasJobs()

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

Returns if jobs are active

Definition at line 521 of file NodeManager.cc.

References Salsa::NodeManager::mActiveJobs.

Referenced by Salsa::Feeder::onEnter().

◆ haveMoreTasks() [1/2]

bool Salsa::NodeManager::haveMoreTasks ( )
virtualinherited

Sets no more tasks to any job

Definition at line 567 of file NodeManager.cc.

References Salsa::NodeManager::job(), Salsa::NodeManager::mActiveJobs, and Salsa::NodeManager::mJobs.

Referenced by Salsa::Feeder::onExit().

◆ 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 Salsa::TaskPool::find(), and Salsa::NodeManager::mJobs.

◆ job()

◆ 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 Salsa::NodeManager::jobs(), and Salsa::NodeManager::mJobs.

Referenced by Salsa::NodeManager::jobs(), and Salsa::Consumer::onExit().

◆ 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.

Referenced by Salsa::Consumer::onWhisper().

◆ nSlots()

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

◆ 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().

Referenced by Salsa::NodeZyre::exec().

◆ 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().

Referenced by Salsa::NodeZyre::exec().

◆ 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().

Referenced by Salsa::NodeZyre::exec().

◆ print()

◆ publish()

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

◆ publisher() [1/2]

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

Returns publisher

Definition at line 617 of file NodeManager.cc.

References Salsa::NodeManager::mpPublisher.

◆ publisher() [2/2]

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

Sets publisher

Definition at line 609 of file NodeManager.cc.

References Salsa::NodeManager::mpPublisher.

Referenced by Salsa::NodeZyre::init().

◆ resultTask()

◆ 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(), mpNodeZyre, Salsa::NodeZyre::socketExternal(), Salsa::Job::submitterSocketID(), and Salsa::Job::submitterSocketIndex().

◆ 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 Salsa::Object::mspConsoleLogger.

◆ taskPool()

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

Get NM's task pool.

Returns task pool

Definition at line 513 of file NodeManager.cc.

References Salsa::NodeManager::mpTaskPool.

Referenced by Salsa::Worker::onWhisper().

◆ terminateAllJobs()

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

◆ terminateFinishedJobs()

bool Salsa::NodeManager::terminateFinishedJobs ( )
virtualinherited

◆ terminateJob()

◆ worker()

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

Member Data Documentation

◆ mActiveJobs

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

◆ mClusterAlias

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

◆ 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 Salsa::NodeManager::addConsumer(), Salsa::NodeManager::consumer(), and Salsa::NodeManager::print().

◆ mFeeders

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

◆ mFinishedJobs

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

◆ mFinishedJobTimeout

uint64_t Salsa::NodeManager::mFinishedJobTimeout
protectedinherited

◆ mJobs

◆ mpNodeZyre

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

Current zyre node.

Definition at line 34 of file NodeManagerZyre.hh.

Referenced by addTaskSlot(), and resultTaskToExternal().

◆ mpPublisher

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

◆ mpTaskPool

◆ 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 Salsa::Object::getConsoleOutput(), and Salsa::Object::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 Salsa::NodeManager::addWorker(), Salsa::NodeManager::print(), and Salsa::NodeManager::worker().


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