Allow graph executor tuning from config
This commit is contained in:
parent
53afc006c3
commit
a32f86fca1
@ -6,6 +6,10 @@
|
||||
"graphs": [
|
||||
{
|
||||
"name": "person_shoe_two_stage_balanced",
|
||||
"executor": {
|
||||
"batch_size": 2,
|
||||
"run_budget": 8
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "in",
|
||||
@ -139,6 +143,7 @@
|
||||
"type": "publish",
|
||||
"role": "filter",
|
||||
"enable": true,
|
||||
"cpu_affinity": [7],
|
||||
"codec": "h264",
|
||||
"fps": 30,
|
||||
"bitrate_kbps": 2000,
|
||||
|
||||
@ -199,7 +199,14 @@ bool EffectiveQueueForEdge(const ParsedEdge& e, const SimpleJson* from_node_queu
|
||||
class Graph::Executor {
|
||||
public:
|
||||
explicit Executor(Graph& g)
|
||||
: g_(g), batch_size_(DefaultGraphBatchSize()), run_budget_(DefaultGraphRunBudget()) {}
|
||||
: g_(g), batch_size_(DefaultGraphBatchSize()), run_budget_(DefaultGraphRunBudget()) {
|
||||
if (const SimpleJson* exec = g_.graph_cfg_.Find("executor"); exec && exec->IsObject()) {
|
||||
const int batch = exec->ValueOr<int>("batch_size", static_cast<int>(batch_size_));
|
||||
const int budget = exec->ValueOr<int>("run_budget", static_cast<int>(run_budget_));
|
||||
if (batch > 0 && batch <= 1024) batch_size_ = static_cast<size_t>(batch);
|
||||
if (budget > 0 && budget <= 4096) run_budget_ = static_cast<size_t>(budget);
|
||||
}
|
||||
}
|
||||
|
||||
bool Start() {
|
||||
Stop();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user