Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[batch] provide sufficient information to debug transient errors #14151

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions hail/python/test/hailtop/hailctl/batch/test_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,35 @@ def test_file_with_no_dest(runner: CliRunner):
os.chdir(dir)
write_hello(f'{dir}/hello.txt')
write_script(dir, f'{dir}/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt', 'test_job.py'])
assert res.exit_code == 0
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt', 'test_job.py'], catch_exceptions=False)
assert res.exit_code == 0, repr((res.output, res.stdout, res.stderr, res.exception))


def test_file_in_current_dir(runner: CliRunner):
with tempfile.TemporaryDirectory() as dir:
os.chdir(dir)
write_hello(f'{dir}/hello.txt')
write_script(dir, f'/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt:/', 'test_job.py'])
assert res.exit_code == 0
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt:/', 'test_job.py'], catch_exceptions=False)
assert res.exit_code == 0, repr((res.output, res.stdout, res.stderr, res.exception))


def test_file_mount_in_child_dir(runner: CliRunner):
with tempfile.TemporaryDirectory() as dir:
os.chdir(dir)
write_hello(f'{dir}/hello.txt')
write_script(dir, '/child/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt:/child/', 'test_job.py'])
assert res.exit_code == 0
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt:/child/', 'test_job.py'], catch_exceptions=False)
assert res.exit_code == 0, repr((res.output, res.stdout, res.stderr, res.exception))


def test_file_mount_in_child_dir_to_root_dir(runner: CliRunner):
with tempfile.TemporaryDirectory() as dir:
os.chdir(dir)
write_hello(f'{dir}/child/hello.txt')
write_script(dir, '/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'child/hello.txt:/', 'test_job.py'])
assert res.exit_code == 0
res = runner.invoke(cli.app, ['submit', '--files', 'child/hello.txt:/', 'test_job.py'], catch_exceptions=False)
assert res.exit_code == 0, repr((res.output, res.stdout, res.stderr, res.exception))


def test_mount_multiple_files(runner: CliRunner):
Expand All @@ -75,9 +75,11 @@ def test_mount_multiple_files(runner: CliRunner):
write_hello(f'{dir}/child/hello2.txt')
write_script(dir, '/hello1.txt')
res = runner.invoke(
cli.app, ['submit', '--files', 'child/hello1.txt:/', '--files', 'child/hello2.txt:/', 'test_job.py']
cli.app,
['submit', '--files', 'child/hello1.txt:/', '--files', 'child/hello2.txt:/', 'test_job.py'],
catch_exceptions=False,
)
assert res.exit_code == 0
assert res.exit_code == 0, repr((res.output, res.stdout, res.stderr, res.exception))


def test_dir_mount_in_child_dir_to_child_dir(runner: CliRunner):
Expand All @@ -86,8 +88,8 @@ def test_dir_mount_in_child_dir_to_child_dir(runner: CliRunner):
write_hello(f'{dir}/child/hello1.txt')
write_hello(f'{dir}/child/hello2.txt')
write_script(dir, '/child/hello1.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'child/:/child/', 'test_job.py'])
assert res.exit_code == 0
res = runner.invoke(cli.app, ['submit', '--files', 'child/:/child/', 'test_job.py'], catch_exceptions=False)
assert res.exit_code == 0, repr((res.output, res.stdout, res.stderr, res.exception))


def test_file_outside_curdir(runner: CliRunner):
Expand All @@ -96,8 +98,10 @@ def test_file_outside_curdir(runner: CliRunner):
os.chdir(f'{dir}/working_dir')
write_hello(f'{dir}/hello.txt')
write_script(dir, '/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', f'{dir}/hello.txt:/', '../test_job.py'])
assert res.exit_code == 0
res = runner.invoke(
cli.app, ['submit', '--files', f'{dir}/hello.txt:/', '../test_job.py'], catch_exceptions=False
)
assert res.exit_code == 0, repr((res.output, res.stdout, res.stderr, res.exception))


def test_dir_outside_curdir(runner: CliRunner):
Expand All @@ -107,5 +111,5 @@ def test_dir_outside_curdir(runner: CliRunner):
write_hello(f'{dir}/hello1.txt')
write_hello(f'{dir}/hello2.txt')
write_script(dir, '/hello1.txt')
res = runner.invoke(cli.app, ['submit', '--files', f'{dir}/:/', '../test_job.py'])
assert res.exit_code == 0, (res.exit_code, res.stdout, res.stderr)
res = runner.invoke(cli.app, ['submit', '--files', f'{dir}/:/', '../test_job.py'], catch_exceptions=False)
assert res.exit_code == 0, repr((res.exit_code, res.stdout, res.stderr, res.exception))
Loading