Skip to the content.

Priority placement: one orchestrator, three task classes, three objectives

What it shows

Not every workload should be optimized the same way, so this orchestrator picks its objective from the application type instead of learning one. In find_computing_node each eligible node is scored by a rule chosen for the task class. A Hard Real-time task maximizes the latency margin: with slack = max_latency - estimated_delay the score is -slack when the node can meet the deadline, and DEADLINE_MISS_PENALTY (1e6) plus the delay when it cannot, so a feasible node always wins and only an infeasible situation falls back to the fastest node. A Soft Real-time task minimizes the normalized delay, estimated_delay / max_latency. A Non Real-time task minimizes the estimated energy, max_consumption * compute_time / 3600, with a tiny delay * 1e-9 tiebreaker. The estimate in _estimated_delay covers the compute time scaled by the tasks already pending on the node, the device access latency, and the WAN latency when the destination is the cloud. results_returned only decrements the pending count, so this policy adapts to load in the moment rather than learning across tasks.

flowchart TD
    task["Task"] --> type{"task type?"}
    type -->|Hard Real-time| hard["maximize slack, else 1e6+delay"]
    type -->|Soft Real-time| soft["min delay/latency"]
    type -->|Non Real-time| norm["min estimated energy"]
    hard --> pick["Lowest score node"]
    soft --> pick
    norm --> pick
    pick --> est["_estimated_delay: compute*(1+pending) + access + wan"]
    est --> run["Execute"]
    run --> pop["results_returned: pending -= 1"]
    pop --> task
    classDef rules fill:#cfe8ff,stroke:#333;
    class hard,soft,norm rules;

The scenario

settings/ runs one scenario, once, on a fixed seed, on the same topology as the ant colony and multi-objective examples:

Run it

From the repository root, after pip install -e .:

python examples/priority_placement/priority_placement.py

No-install variant:

PYTHONPATH=src python examples/priority_placement/priority_placement.py

What to look for

PRIORITY_AWARE           devices= 300 tasks= 16870 ok= 12279 avg_delay=0.1809   cloud=   23 edge=13370 mist= 3477 energy=72.5979

Give the non real-time rule a transfer-aware estimate, or restrict the cloud placement, to stop the 0-of-23 outcome.

Files

Where to go next