(hq_env: HqEnv)
| 145 | |
| 146 | |
| 147 | def test_job_array_cancel(hq_env: HqEnv): |
| 148 | hq_env.start_server() |
| 149 | hq_env.start_worker(cpus=4) |
| 150 | hq_env.command(["submit", "--array=0-9", "--", "sleep", "1"]) |
| 151 | time.sleep(1.6) |
| 152 | hq_env.command(["job", "cancel", "1"]) |
| 153 | time.sleep(0.4) |
| 154 | |
| 155 | table = hq_env.command(["job", "info", "1"], as_table=True) |
| 156 | states = table.get_row_value("State").split("\n") |
| 157 | assert "FINISHED (4)" in states |
| 158 | assert "CANCELED (6)" in states |
| 159 | |
| 160 | table = hq_env.command(["task", "list", "1"], as_table=True) |
| 161 | task_states = table.get_column_value("State") |
| 162 | c = collections.Counter(task_states) |
| 163 | assert c.get("FINISHED") == 4 |
| 164 | assert c.get("CANCELED") == 6 |
| 165 | |
| 166 | table = list_jobs(hq_env) |
| 167 | table.check_column_value("State", 0, "CANCELED") |
| 168 | |
| 169 | |
| 170 | def test_array_reporting_state_after_worker_lost(hq_env: HqEnv): |
nothing calls this directly
no test coverage detected