Allow graph executor tuning from config
This commit is contained in:
parent
53afc006c3
commit
a32f86fca1
@ -6,6 +6,10 @@
|
|||||||
"graphs": [
|
"graphs": [
|
||||||
{
|
{
|
||||||
"name": "person_shoe_two_stage_balanced",
|
"name": "person_shoe_two_stage_balanced",
|
||||||
|
"executor": {
|
||||||
|
"batch_size": 2,
|
||||||
|
"run_budget": 8
|
||||||
|
},
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{
|
{
|
||||||
"id": "in",
|
"id": "in",
|
||||||
@ -139,6 +143,7 @@
|
|||||||
"type": "publish",
|
"type": "publish",
|
||||||
"role": "filter",
|
"role": "filter",
|
||||||
"enable": true,
|
"enable": true,
|
||||||
|
"cpu_affinity": [7],
|
||||||
"codec": "h264",
|
"codec": "h264",
|
||||||
"fps": 30,
|
"fps": 30,
|
||||||
"bitrate_kbps": 2000,
|
"bitrate_kbps": 2000,
|
||||||
|
|||||||
@ -199,7 +199,14 @@ bool EffectiveQueueForEdge(const ParsedEdge& e, const SimpleJson* from_node_queu
|
|||||||
class Graph::Executor {
|
class Graph::Executor {
|
||||||
public:
|
public:
|
||||||
explicit Executor(Graph& g)
|
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() {
|
bool Start() {
|
||||||
Stop();
|
Stop();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user