salsa 0.7.1
|
Base salsa TaskPool class. More...
#include <TaskPool.hh>
Public Member Functions | |
TaskPool (NodeManager *pNM) | |
virtual | ~TaskPool () |
void | add (void *p, TaskState *t) |
TaskState * | find (void *p) const |
TaskState * | findById (uint32_t id) const |
TaskState * | findFreeTask () const |
void | changeState (uint32_t id, TaskState::EState state) |
uint32_t | nSlotFree () |
bool | terminateJob (Job *pJob) |
bool | handlePipe (void *pPipe) |
void | print (bool verbose=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< void *, TaskState * > | mTasks {} |
List of task slots. | |
NodeManager * | mpNodeManager = nullptr |
Node manager. | |
Static Private Attributes | |
static std::shared_ptr< spdlog::logger > | mspConsoleLogger = spdlog::stdout_color_mt("salsa") |
Pointer to spd logger. | |
Base salsa TaskPool class.
Definition at line 18 of file TaskPool.hh.
Salsa::TaskPool::TaskPool | ( | NodeManager * | pNM | ) |
Constructor
Definition at line 7 of file TaskPool.cc.
|
virtual |
void Salsa::TaskPool::add | ( | void * | p, |
TaskState * | t ) |
Adds Task EState
Definition at line 24 of file TaskPool.cc.
References Salsa::TaskState::id(), and mTasks.
Referenced by Salsa::NodeManagerZyre::addTaskSlot().
void Salsa::TaskPool::changeState | ( | uint32_t | id, |
TaskState::EState | state ) |
Change state for task with id
Definition at line 87 of file TaskPool.cc.
References mTasks.
Referenced by Salsa::Worker::onWhisper().
TaskState * Salsa::TaskPool::find | ( | void * | p | ) | const |
Returns TaskState /param p pointer
Definition at line 35 of file TaskPool.cc.
References mTasks.
Referenced by handlePipe(), and Salsa::NodeManager::haveMoreTasks().
TaskState * Salsa::TaskPool::findById | ( | uint32_t | id | ) | const |
Returns task state by id
Definition at line 48 of file TaskPool.cc.
References mTasks.
Referenced by Salsa::Worker::onWhisper().
TaskState * Salsa::TaskPool::findFreeTask | ( | ) | const |
Find avail slot in task pool
Definition at line 61 of file TaskPool.cc.
References mTasks.
Referenced by handlePipe(), and Salsa::Worker::onWhisper().
|
inlinestaticinherited |
Get console output.
Definition at line 21 of file Object.hh.
References Salsa::Object::mspConsoleLogger.
Referenced by Salsa::ConfigZyre::apply().
bool Salsa::TaskPool::handlePipe | ( | void * | pPipe | ) |
Handle pipe
Definition at line 142 of file TaskPool.cc.
References Salsa::TaskState::executor(), find(), findFreeTask(), Salsa::TaskExecutor::handlePipe(), Salsa::TaskState::id(), Salsa::NodeManager::job(), mpNodeManager, Salsa::TaskState::pid(), Salsa::TaskExecutor::pipe(), print(), Salsa::Job::removeTask(), Salsa::NodeManager::sendWhisper(), Salsa::TaskState::state(), Salsa::TaskState::task(), and Salsa::NodeManager::worker().
Referenced by Salsa::NodeManagerZyre::handleTaskPool(), and Salsa::TaskExecutorFake::run().
uint32_t Salsa::TaskPool::nSlotFree | ( | ) |
void Salsa::TaskPool::print | ( | bool | verbose = false | ) | const |
Prints task pool info
Definition at line 128 of file TaskPool.cc.
References mTasks.
Referenced by handlePipe(), Salsa::Worker::onWhisper(), and Salsa::NodeManager::print().
|
inlinestaticinherited |
Sets console log level.
Definition at line 29 of file Object.hh.
References Salsa::Object::mspConsoleLogger.
bool Salsa::TaskPool::terminateJob | ( | Job * | pJob | ) |
Kill all tasks from pJob
Definition at line 99 of file TaskPool.cc.
References mTasks, Salsa::Job::print(), and Salsa::Job::tasks().
Referenced by Salsa::NodeManager::terminateJob(), and Salsa::NodeManager::~NodeManager().
|
protected |
|
staticprivateinherited |
Pointer to spd logger.
Definition at line 32 of file Object.hh.
Referenced by Salsa::Object::getConsoleOutput(), and Salsa::Object::setConsoleLevel().
|
protected |
List of task slots.
Definition at line 37 of file TaskPool.hh.
Referenced by add(), changeState(), find(), findById(), findFreeTask(), nSlotFree(), print(), terminateJob(), and ~TaskPool().