Feat/halt on error (#862)

* Introduce halt-on-error

* Introduce halt-on-error

* Fix wording
This commit is contained in:
Henry Ruhs
2025-01-31 10:17:33 +01:00
committed by henryruhs
parent efc9652df4
commit 296eea8577
14 changed files with 99 additions and 54 deletions

View File

@@ -61,7 +61,7 @@ def test_job_submit() -> None:
def test_submit_all() -> None:
commands = [ sys.executable, 'facefusion.py', 'job-submit-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-submit-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 1
@@ -79,7 +79,7 @@ def test_submit_all() -> None:
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-submit-all-2', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_file('test-job-remix-step.jpg') ]
subprocess.run(commands)
commands = [ sys.executable, 'facefusion.py', 'job-submit-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-submit-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 0
assert is_test_job_file('test-job-submit-all-1.json', 'queued') is True
@@ -103,7 +103,7 @@ def test_job_delete() -> None:
def test_job_delete_all() -> None:
commands = [ sys.executable, 'facefusion.py', 'job-delete-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-delete-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 1
@@ -113,7 +113,7 @@ def test_job_delete_all() -> None:
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-delete-all-2', '--jobs-path', get_test_jobs_directory() ]
subprocess.run(commands)
commands = [ sys.executable, 'facefusion.py', 'job-delete-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-delete-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 0
assert is_test_job_file('test-job-delete-all-1.json', 'drafted') is False

View File

@@ -51,7 +51,7 @@ def test_job_run() -> None:
def test_job_run_all() -> None:
commands = [ sys.executable, 'facefusion.py', 'job-run-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-run-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 1
@@ -70,14 +70,14 @@ def test_job_run_all() -> None:
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run-all-2', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_file('test-job-run-all-2.mp4'), '--trim-frame-start', '0', '--trim-frame-end', '1' ]
subprocess.run(commands)
commands = [ sys.executable, 'facefusion.py', 'job-run-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-run-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 1
commands = [ sys.executable, 'facefusion.py', 'job-submit-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-submit-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
subprocess.run(commands)
commands = [ sys.executable, 'facefusion.py', 'job-run-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-run-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 0
assert subprocess.run(commands).returncode == 1
@@ -111,7 +111,7 @@ def test_job_retry() -> None:
def test_job_retry_all() -> None:
commands = [ sys.executable, 'facefusion.py', 'job-retry-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-retry-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 1
@@ -130,7 +130,7 @@ def test_job_retry_all() -> None:
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry-all-2', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_file('test-job-retry-all-2.mp4'), '--trim-frame-start', '0', '--trim-frame-end', '1' ]
subprocess.run(commands)
commands = [ sys.executable, 'facefusion.py', 'job-retry-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-retry-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 1
@@ -139,7 +139,7 @@ def test_job_retry_all() -> None:
move_job_file('test-job-retry-all-1', 'failed')
move_job_file('test-job-retry-all-2', 'failed')
commands = [ sys.executable, 'facefusion.py', 'job-retry-all', '--jobs-path', get_test_jobs_directory() ]
commands = [ sys.executable, 'facefusion.py', 'job-retry-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
assert subprocess.run(commands).returncode == 0
assert subprocess.run(commands).returncode == 1

View File

@@ -63,19 +63,20 @@ def test_submit_jobs() -> None:
'target_path': 'target-2.jpg',
'output_path': 'output-2.jpg'
}
halt_on_error = True
assert submit_jobs() is False
assert submit_jobs(halt_on_error) is False
create_job('job-test-submit-jobs-1')
create_job('job-test-submit-jobs-2')
assert submit_jobs() is False
assert submit_jobs(halt_on_error) is False
add_step('job-test-submit-jobs-1', args_1)
add_step('job-test-submit-jobs-2', args_2)
assert submit_jobs() is True
assert submit_jobs() is False
assert submit_jobs(halt_on_error) is True
assert submit_jobs(halt_on_error) is False
def test_delete_job() -> None:
@@ -88,12 +89,14 @@ def test_delete_job() -> None:
def test_delete_jobs() -> None:
assert delete_jobs() is False
halt_on_error = True
assert delete_jobs(halt_on_error) is False
create_job('job-test-delete-jobs-1')
create_job('job-test-delete-jobs-2')
assert delete_jobs() is True
assert delete_jobs(halt_on_error) is True
@pytest.mark.skip()

View File

@@ -85,8 +85,9 @@ def test_run_jobs() -> None:
'target_path': get_test_example_file('target-240p.jpg'),
'output_path': get_test_output_file('output-1.jpg')
}
halt_on_error = True
assert run_jobs(process_step) is False
assert run_jobs(process_step, halt_on_error) is False
create_job('job-test-run-jobs-1')
create_job('job-test-run-jobs-2')
@@ -95,11 +96,11 @@ def test_run_jobs() -> None:
add_step('job-test-run-jobs-2', args_2)
add_step('job-test-run-jobs-3', args_3)
assert run_jobs(process_step) is False
assert run_jobs(process_step, halt_on_error) is False
submit_jobs()
submit_jobs(halt_on_error)
assert run_jobs(process_step) is True
assert run_jobs(process_step, halt_on_error) is True
@pytest.mark.skip()