MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / test_job_array_cancel

Function test_job_array_cancel

tests/test_array.py:147–167  ·  view source on GitHub ↗
(hq_env: HqEnv)

Source from the content-addressed store, hash-verified

145
146
147def 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
170def test_array_reporting_state_after_worker_lost(hq_env: HqEnv):

Callers

nothing calls this directly

Calls 10

list_jobsFunction · 0.85
commandMethod · 0.80
sleepMethod · 0.80
get_row_valueMethod · 0.80
get_column_valueMethod · 0.80
check_column_valueMethod · 0.80
start_serverMethod · 0.45
start_workerMethod · 0.45
splitMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected