(hq_env: HqEnv, tmp_path)
| 207 | |
| 208 | |
| 209 | def test_explain_deps(hq_env: HqEnv, tmp_path): |
| 210 | hq_env.start_server() |
| 211 | hq_env.start_workers(2, cpus=4) |
| 212 | |
| 213 | tmp_path.joinpath("job.toml").write_text( |
| 214 | """ |
| 215 | [[task]] |
| 216 | id = 0 |
| 217 | command = ["sleep", "0"] |
| 218 | |
| 219 | [[task]] |
| 220 | id = 1 |
| 221 | command = ["sleep", "100"] |
| 222 | |
| 223 | [[task]] |
| 224 | id = 2 |
| 225 | command = ["sleep", "1"] |
| 226 | deps = [0, 1] |
| 227 | """ |
| 228 | ) |
| 229 | hq_env.command(["job", "submit-file", "job.toml"]) |
| 230 | wait_for_task_state(hq_env, 1, [0, 1, 2], ["finished", "running", "waiting"]) |
| 231 | hq_env.command(["job", "submit-file", "job.toml"]) |
| 232 | r = hq_env.command(["task", "explain", "1", "2"]) |
| 233 | assert r == snapshot( |
| 234 | """Task 1@2 is not ready to run, because 1/2 dependencies are not finished. |
| 235 | The task can run on 2 workers: 1-2 |
| 236 | +-----------+----------+---------+------+----------+---------+ |
| 237 | | Worker Id | Runnable | Variant | Type | Provides | Request | |
| 238 | +-----------+----------+---------+------+----------+---------+ |
| 239 | | 1 | Yes | 0 | cpus | 4 | 1 | |
| 240 | | 2 | Yes | 0 | cpus | 4 | 1 | |
| 241 | +-----------+----------+---------+------+----------+---------+ |
| 242 | """ |
| 243 | ) |
nothing calls this directly
no test coverage detected