Skip to content

Commit

Permalink
test_asynchronuos_execution
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Nov 21, 2024
1 parent eedd390 commit db72976
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/transports/test_all_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ def test_transfer_big_stdout(custom_transport, tmp_path):
assert retcode == 0


def test_asynchronous_execution(custom_transport):
def test_asynchronous_execution(custom_transport, tmp_path):
"""Test that the execution of a long(ish) command via the direct scheduler does not block.
This is a regression test for #3094, where running a long job on the direct scheduler
Expand All @@ -1220,10 +1220,10 @@ def test_asynchronous_execution(custom_transport):
tmpf.write(b'#!/bin/bash\nsleep 10\n')
tmpf.flush()

transport.putfile(tmpf.name, os.path.join('/tmp', script_fname))
transport.putfile(tmpf.name, str(tmp_path / script_fname))

timestamp_before = time.time()
job_id_string = scheduler.submit_job('/tmp', script_fname)
job_id_string = scheduler.submit_job(str(tmp_path), script_fname)

elapsed_time = time.time() - timestamp_before
# We want to get back control. If it takes < 5 seconds, it means that it is not blocking
Expand Down Expand Up @@ -1259,9 +1259,3 @@ def test_asynchronous_execution(custom_transport):
# If the process is already dead (or has never run), I just ignore the error
pass

# Also remove the script
try:
transport.remove(f'/tmp/{script_fname}')
except FileNotFoundError:
# If the file wasn't even created, I just ignore this error
pass

0 comments on commit db72976

Please sign in to comment.