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

Function test_submit_task_dir

tests/test_job.py:937–966  ·  view source on GitHub ↗
(hq_env: HqEnv, mode)

Source from the content-addressed store, hash-verified

935
936@pytest.mark.parametrize("mode", ["FINISHED", "FAILED", "CANCELED"])
937def test_submit_task_dir(hq_env: HqEnv, mode):
938 hq_env.start_server()
939 hq_env.start_worker()
940
941 hq_env.command(
942 [
943 "submit",
944 "--task-dir",
945 "--",
946 "bash",
947 "-c",
948 "echo $HQ_TASK_DIR; touch $HQ_TASK_DIR/xyz; sleep 2; {}".format("exit 1" if mode == "FAILED" else ""),
949 ]
950 )
951 wait_for_job_state(hq_env, 1, "RUNNING")
952
953 def file_created():
954 task_dir = read_file(default_task_output()).rstrip()
955 if task_dir is None:
956 return
957 return os.path.isfile(os.path.join(task_dir, "xyz"))
958
959 wait_until(file_created)
960 task_dir = read_file(default_task_output()).rstrip()
961
962 if mode == "CANCELED":
963 hq_env.command(["job", "cancel", "all"])
964
965 wait_for_job_state(hq_env, 1, mode)
966 assert not os.path.exists(task_dir)
967
968
969def test_custom_error_message(hq_env: HqEnv):

Callers

nothing calls this directly

Calls 8

wait_for_job_stateFunction · 0.85
read_fileFunction · 0.85
default_task_outputFunction · 0.85
commandMethod · 0.80
wait_untilFunction · 0.50
start_serverMethod · 0.45
start_workerMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected