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

Function test_submit_python_prologue

tests/pyapi/test_function.py:29–44  ·  view source on GitHub ↗
(hq_env: HqEnv)

Source from the content-addressed store, hash-verified

27
28
29def test_submit_python_prologue(hq_env: HqEnv):
30 init_sh = Path("init.sh")
31 init_sh.write_text("""export ABC=xyz""")
32
33 hq_env.start_server()
34 hq_env.start_worker()
35 client = Client(hq_env.server_dir, python_env=PythonEnv(prologue=f"source {init_sh.resolve()}"))
36
37 def body():
38 print(os.environ.get("ABC"))
39
40 job = Job()
41 job.function(body, stdout="out")
42 submitted_job = client.submit(job)
43 wait_for_job_state(hq_env, submitted_job.id, "FINISHED")
44 check_file_contents("out", "xyz\n")
45
46
47def test_submit_pyfunction_fail(hq_env: HqEnv):

Callers

nothing calls this directly

Calls 10

functionMethod · 0.95
submitMethod · 0.95
ClientClass · 0.90
JobClass · 0.90
PythonEnvClass · 0.85
wait_for_job_stateFunction · 0.85
check_file_contentsFunction · 0.50
start_serverMethod · 0.45
start_workerMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected