salsa  0.4.0
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. More...
 
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. More...
 
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. More...
 
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 void publish (std::string id, bool force=false) const
 

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

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 55 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 64 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 73 of file NodeManager.cc.

References Salsa::NodeManager::mWorkers.

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

◆ getNextTask()

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

Return Next task from job

Definition at line 258 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 519 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 565 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 593 of file NodeManager.cc.

References 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 527 of file NodeManager.cc.

References Salsa::NodeManager::mJobs.

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

◆ noMoreTasks()

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

Sets no more tasks to job with jobuuid

Definition at line 552 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()

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

◆ publisher() [1/2]

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

Sets publisher

Definition at line 607 of file NodeManager.cc.

References Salsa::NodeManager::mpPublisher.

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

◆ publisher() [2/2]

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

Returns publisher

Definition at line 615 of file NodeManager.cc.

References Salsa::NodeManager::mpPublisher.

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

◆ taskPool()

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

Get NM's task pool.

Returns task pool

Definition at line 511 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

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