salsa 0.7.1
|
NodeManagerZyre class. More...
#include <NodeManagerZyre.hh>
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 Socket * | onEnter (std::string self, std::string fromType, Message *pMsg, std::vector< std::string > &out) |
virtual Socket * | onExit (std::string self, Message *pMsg, std::vector< std::string > &out) |
virtual Socket * | onWhisper (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< Feeder > | feeder (std::string uuid) const |
std::shared_ptr< Consumer > | consumer (std::string uuid) const |
std::shared_ptr< Worker > | worker (std::string uuid) const |
Job * | job (std::string uuid) |
TaskPool * | taskPool () |
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 Publisher * | publisher () 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. | |
TaskPool * | mpTaskPool = nullptr |
Task pool. | |
Publisher * | mpPublisher = nullptr |
Publisher. | |
Private Attributes | |
NodeZyre * | mpNodeZyre = nullptr |
Current zyre node. | |
Static Private Attributes | |
static std::shared_ptr< spdlog::logger > | mspConsoleLogger = spdlog::stdout_color_mt("salsa") |
Pointer to spd logger. | |
NodeManagerZyre class.
Definition at line 17 of file NodeManagerZyre.hh.
Salsa::NodeManagerZyre::NodeManagerZyre | ( | NodeZyre * | pNodeZyre | ) |
Constructor
Definition at line 8 of file NodeManagerZyre.cc.
References mpNodeZyre, and Salsa::NodeManager::NodeManager().
|
virtual |
Destructor
Definition at line 14 of file NodeManagerZyre.cc.
|
inherited |
|
inherited |
|
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.
|
virtual |
Reserve task slot
Reimplemented from Salsa::NodeManager.
Definition at line 65 of file NodeManagerZyre.cc.
References Salsa::TaskState::executor(), mpNodeZyre, Salsa::NodeManager::mpTaskPool, Salsa::TaskExecutor::pipe(), Salsa::ActorZmq::SalsaActorForkFn(), and Salsa::TaskExecutor::taskState().
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Returns consumer /param uuid UUID
Definition at line 457 of file NodeManager.cc.
References mConsumers.
Referenced by onEnter(), onExit(), onWhisper(), and resultTask().
|
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().
|
inlineinherited |
Returns finished job timeout.
Definition at line 55 of file NodeManager.hh.
References mFinishedJobTimeout.
|
inlineinherited |
Sets finished job timeout.
Definition at line 57 of file NodeManager.hh.
References mFinishedJobTimeout.
|
inlinestaticinherited |
Get console output.
Definition at line 21 of file Object.hh.
References mspConsoleLogger.
Referenced by Salsa::ConfigZyre::apply().
|
inherited |
Return Next task from job
Definition at line 260 of file NodeManager.cc.
References mActiveJobs, and mJobs.
|
virtual |
Handle task pool
Reimplemented from Salsa::NodeManager.
Definition at line 120 of file NodeManagerZyre.cc.
References Salsa::NodeManager::mpTaskPool.
|
inherited |
|
virtualinherited |
Sets no more tasks to any job
Definition at line 567 of file NodeManager.cc.
References job(), mActiveJobs, and mJobs.
|
virtualinherited |
Sets no more tasks to job with jobuuid
Definition at line 595 of file NodeManager.cc.
References mJobs.
|
inherited |
Returns job /param uuid UUID
Definition at line 482 of file NodeManager.cc.
References mJobs.
Referenced by haveMoreTasks(), publish(), resultTask(), Salsa::NodeManagerZyre::resultTaskToExternal(), terminateAllJobs(), terminateFinishedJobs(), and ~NodeManager().
|
inherited |
|
virtualinherited |
Sets no more tasks to job with jobuuid
Definition at line 554 of file NodeManager.cc.
|
inherited |
Returns numer of slots
Definition at line 541 of file NodeManager.cc.
References feeder(), and mFeeders.
Referenced by resultTask().
|
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().
|
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().
|
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().
|
inherited |
Prints NodeManager information
Definition at line 32 of file NodeManager.cc.
References mConsumers, mFeeders, mJobs, mpTaskPool, and mWorkers.
Referenced by resultTask(), and terminateJob().
|
virtualinherited |
Publishes node manager state
Definition at line 625 of file NodeManager.cc.
References feeder(), job(), mClusterAlias, mJobs, and mpPublisher.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Handle result of pTask
Moving to finished jobs. They will be removed after some inactivity time
Definition at line 288 of file NodeManager.cc.
References Salsa::Job::consumer(), consumer(), Salsa::Job::feeder(), Salsa::Job::haveMoreTasks(), Salsa::Job::isFinished(), Salsa::Job::isTaskInQueue(), job(), mFinishedJobs, Salsa::Job::moveTask(), nSlots(), print(), Salsa::Job::removeTask(), resultTaskToExternal(), sendWhisper(), Salsa::Job::size(), and Salsa::Job::uuid().
|
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.
|
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().
|
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().
|
inlinestaticinherited |
|
inherited |
Get NM's task pool.
Returns task pool
Definition at line 513 of file NodeManager.cc.
References mpTaskPool.
|
virtualinherited |
Terminate all jobs
Definition at line 422 of file NodeManager.cc.
References job(), mFinishedJobs, mJobs, and terminateJob().
|
virtualinherited |
Clear finished jobs
Definition at line 391 of file NodeManager.cc.
References job(), mFinishedJobs, mFinishedJobTimeout, and terminateJob().
|
virtualinherited |
Cleans job
Definition at line 362 of file NodeManager.cc.
References mFeeders, mFinishedJobs, mJobs, mpTaskPool, and print().
Referenced by terminateAllJobs(), and terminateFinishedJobs().
|
inherited |
Returns worker /param uuid UUID
Definition at line 469 of file NodeManager.cc.
References mWorkers.
Referenced by onEnter(), onExit(), and onWhisper().
|
protectedinherited |
List of active jobs.
Definition at line 93 of file NodeManager.hh.
Referenced by addTask(), getNextTask(), hasJobs(), and haveMoreTasks().
|
protectedinherited |
Cluster alias.
Definition at line 91 of file NodeManager.hh.
Referenced by clusterAlias(), clusterAlias(), and publish().
|
protectedinherited |
List of Consumers.
Definition at line 97 of file NodeManager.hh.
Referenced by addConsumer(), consumer(), and print().
|
protectedinherited |
List of Feeders.
Definition at line 98 of file NodeManager.hh.
Referenced by addFeeder(), addTask(), feeder(), nSlots(), print(), and terminateJob().
|
protectedinherited |
List of finished jobs.
Definition at line 94 of file NodeManager.hh.
Referenced by resultTask(), terminateAllJobs(), terminateFinishedJobs(), and terminateJob().
|
protectedinherited |
Finished job timeout in seconds.
Definition at line 95 of file NodeManager.hh.
Referenced by finishedJobTimeout(), finishedJobTimeout(), NodeManager(), and terminateFinishedJobs().
|
protectedinherited |
List of jobs.
Definition at line 92 of file NodeManager.hh.
Referenced by addTask(), getNextTask(), haveMoreTasks(), haveMoreTasks(), job(), jobs(), print(), publish(), terminateAllJobs(), terminateJob(), and ~NodeManager().
|
private |
Current zyre node.
Definition at line 34 of file NodeManagerZyre.hh.
Referenced by addTaskSlot(), NodeManagerZyre(), and resultTaskToExternal().
|
protectedinherited |
Definition at line 100 of file NodeManager.hh.
Referenced by publish(), publisher(), publisher(), and ~NodeManager().
|
protectedinherited |
Task pool.
Definition at line 99 of file NodeManager.hh.
Referenced by addTaskSlot(), Salsa::NodeManagerZyre::addTaskSlot(), Salsa::NodeManagerZyre::handleTaskPool(), print(), taskPool(), terminateJob(), and ~NodeManager().
|
staticprivateinherited |
Pointer to spd logger.
Definition at line 32 of file Object.hh.
Referenced by getConsoleOutput(), and setConsoleLevel().
|
protectedinherited |
List of Workers.
Definition at line 96 of file NodeManager.hh.
Referenced by addWorker(), print(), and worker().