(hq_env: HqEnv, tmp_path)
| 379 | |
| 380 | |
| 381 | def test_restore_dependencies1(hq_env: HqEnv, tmp_path): |
| 382 | journal_path = os.path.join(tmp_path, "my.journal") |
| 383 | hq_env.start_server(args=["--journal", journal_path]) |
| 384 | hq_env.start_worker(cpus=2) |
| 385 | tmp_path.joinpath("sleep_time").write_text("100") |
| 386 | tmp_path.joinpath("job.toml").write_text( |
| 387 | """ |
| 388 | [[task]] |
| 389 | id = 1 |
| 390 | command = ["touch", "a"] |
| 391 | |
| 392 | [[task]] |
| 393 | id = 2 |
| 394 | command = ["bash", "-c", "sleep `cat sleep_time` && touch b"] |
| 395 | |
| 396 | [[task]] |
| 397 | id = 3 |
| 398 | command = ["touch", "c"] |
| 399 | deps = [1, 2] |
| 400 | """ |
| 401 | ) |
| 402 | hq_env.command(["job", "submit-file", "job.toml"]) |
| 403 | wait_for_task_state(hq_env, 1, [1, 2, 3], ["finished", "running", "waiting"]) |
| 404 | hq_env.stop_server() |
| 405 | assert os.path.isfile("a") |
| 406 | assert not os.path.isfile("b") |
| 407 | assert not os.path.isfile("c") |
| 408 | os.unlink("a") |
| 409 | |
| 410 | tmp_path.joinpath("sleep_time").write_text("0") |
| 411 | |
| 412 | hq_env.start_server(args=["--journal", journal_path]) |
| 413 | hq_env.start_worker() |
| 414 | wait_for_job_state(hq_env, 1, "FINISHED") |
| 415 | |
| 416 | assert not os.path.isfile("a") |
| 417 | assert os.path.isfile("b") |
| 418 | assert os.path.isfile("c") |
| 419 | |
| 420 | |
| 421 | def test_restore_dependencies2(hq_env: HqEnv, tmp_path): |
nothing calls this directly
no test coverage detected