JANA2
C++ framework for multi-threaded data processing
JScheduler Class Reference

Scheduler assigns Arrows to Workers in a first-come-first-serve manner, not unlike OpenMP's schedule dynamic. More...

#include <JScheduler.h>

Collaboration diagram for JScheduler:
[legend]

Classes

struct  ArrowState
 
struct  TopologyState
 

Public Types

enum class  TopologyStatus {
  Uninitialized ,
  Running ,
  Pausing ,
  Draining ,
  Paused ,
  Finalized
}
 
enum class  ArrowStatus {
  Uninitialized ,
  Active ,
  Draining ,
  Inactive ,
  Finalized
}
 

Public Member Functions

 JScheduler (std::shared_ptr< JTopologyBuilder > topology)
 Constructor. Note that a Scheduler operates on a vector of Arrow*s.
 
JArrownext_assignment (uint32_t worker_id, JArrow *assignment, JArrowMetrics::Status result)
 Lets a Worker ask the Scheduler for another assignment. More...
 
void last_assignment (uint32_t worker_id, JArrow *assignment, JArrowMetrics::Status result)
 Lets a Worker tell the scheduler that he is shutting down and won't be working on his assignment any more. More...
 
JArrowcheckout (size_t arrow_index)
 Lets a Worker, test case, or user request a specific arrow. More...
 
void initialize_topology ()
 
void drain_topology ()
 
void run_topology (int nthreads)
 
void request_topology_pause ()
 
void achieve_topology_pause ()
 
void finish_topology ()
 
TopologyStatus get_topology_status ()
 
TopologyState get_topology_state ()
 
void summarize_arrows (std::vector< ArrowSummary > &summaries)
 

Public Attributes

JLogger logger
 Logger is public so that somebody else can configure it.
 

Detailed Description

Scheduler assigns Arrows to Workers in a first-come-first-serve manner, not unlike OpenMP's schedule dynamic.

Member Function Documentation

◆ checkout()

JArrow * JScheduler::checkout ( size_t  arrow_index)

Lets a Worker, test case, or user request a specific arrow.

Returns nullptr if arrow can not be checked up because it's no longer active or because it's already at its max parallelism.

◆ last_assignment()

void JScheduler::last_assignment ( uint32_t  worker_id,
JArrow assignment,
JArrowMetrics::Status  result 
)

Lets a Worker tell the scheduler that he is shutting down and won't be working on his assignment any more.

The scheduler is thus free to reassign the arrow to one of the remaining workers.

References logger.

Referenced by JWorker::loop().

◆ next_assignment()

JArrow * JScheduler::next_assignment ( uint32_t  worker_id,
JArrow assignment,
JArrowMetrics::Status  result 
)

Lets a Worker ask the Scheduler for another assignment.

If no assignments make sense, Scheduler returns nullptr, which tells that Worker to idle until his next checkin. If next_assignment() makes any changes to internal Scheduler state or to any of its arrows, it must be synchronized.

References logger.

Referenced by JWorker::loop().


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