Finish job testing
This commit is contained in:
@@ -3,7 +3,7 @@ from time import sleep
|
||||
import pytest
|
||||
|
||||
from facefusion.jobs.job_helper import get_step_output_path
|
||||
from facefusion.jobs.job_manager import add_step, clear_jobs, count_step_total, create_job, delete_job, delete_jobs, find_job_ids, get_steps, init_jobs, insert_step, move_job_file, remix_step, remove_step, set_step_status, set_steps_status, submit_job, submit_jobs
|
||||
from facefusion.jobs.job_manager import add_step, clear_jobs, count_step_total, create_job, delete_job, delete_jobs, find_job_ids, find_jobs, get_steps, init_jobs, insert_step, move_job_file, remix_step, remove_step, set_step_status, set_steps_status, submit_job, submit_jobs
|
||||
from .helper import get_test_jobs_directory
|
||||
|
||||
|
||||
@@ -99,9 +99,19 @@ def test_delete_jobs() -> None:
|
||||
assert delete_jobs(halt_on_error) is True
|
||||
|
||||
|
||||
@pytest.mark.skip()
|
||||
def test_find_jobs() -> None:
|
||||
pass
|
||||
create_job('job-test-find-jobs-1')
|
||||
sleep(0.5)
|
||||
create_job('job-test-find-jobs-2')
|
||||
|
||||
assert 'job-test-find-jobs-1' in find_jobs('drafted')
|
||||
assert 'job-test-find-jobs-2' in find_jobs('drafted')
|
||||
assert find_jobs('queued') == {}
|
||||
|
||||
move_job_file('job-test-find-jobs-1', 'queued')
|
||||
|
||||
assert 'job-test-find-jobs-2' in find_jobs('drafted')
|
||||
assert 'job-test-find-jobs-1' in find_jobs('queued')
|
||||
|
||||
|
||||
def test_find_job_ids() -> None:
|
||||
|
||||
@@ -4,8 +4,8 @@ import pytest
|
||||
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.filesystem import copy_file
|
||||
from facefusion.jobs.job_manager import add_step, clear_jobs, create_job, init_jobs, submit_job, submit_jobs
|
||||
from facefusion.jobs.job_runner import collect_output_set, finalize_steps, run_job, run_jobs, run_steps
|
||||
from facefusion.jobs.job_manager import add_step, clear_jobs, create_job, init_jobs, move_job_file, submit_job, submit_jobs
|
||||
from facefusion.jobs.job_runner import collect_output_set, finalize_steps, retry_job, retry_jobs, run_job, run_jobs, run_steps
|
||||
from facefusion.types import Args
|
||||
from .helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_file, is_test_output_file, prepare_test_output_directory
|
||||
|
||||
@@ -103,14 +103,63 @@ def test_run_jobs() -> None:
|
||||
assert run_jobs(process_step, halt_on_error) is True
|
||||
|
||||
|
||||
@pytest.mark.skip()
|
||||
def test_retry_job() -> None:
|
||||
pass
|
||||
args_1 =\
|
||||
{
|
||||
'source_path': get_test_example_file('source.jpg'),
|
||||
'target_path': get_test_example_file('target-240p.mp4'),
|
||||
'output_path': get_test_output_file('output-1.mp4')
|
||||
}
|
||||
|
||||
assert retry_job('job-invalid', process_step) is False
|
||||
|
||||
create_job('job-test-retry-job')
|
||||
add_step('job-test-retry-job', args_1)
|
||||
submit_job('job-test-retry-job')
|
||||
|
||||
assert retry_job('job-test-retry-job', process_step) is False
|
||||
|
||||
move_job_file('job-test-retry-job', 'failed')
|
||||
|
||||
assert retry_job('job-test-retry-job', process_step) is True
|
||||
|
||||
|
||||
@pytest.mark.skip()
|
||||
def test_retry_jobs() -> None:
|
||||
pass
|
||||
args_1 =\
|
||||
{
|
||||
'source_path': get_test_example_file('source.jpg'),
|
||||
'target_path': get_test_example_file('target-240p.mp4'),
|
||||
'output_path': get_test_output_file('output-1.mp4')
|
||||
}
|
||||
args_2 =\
|
||||
{
|
||||
'source_path': get_test_example_file('source.jpg'),
|
||||
'target_path': get_test_example_file('target-240p.mp4'),
|
||||
'output_path': get_test_output_file('output-2.mp4')
|
||||
}
|
||||
args_3 =\
|
||||
{
|
||||
'source_path': get_test_example_file('source.jpg'),
|
||||
'target_path': get_test_example_file('target-240p.jpg'),
|
||||
'output_path': get_test_output_file('output-1.jpg')
|
||||
}
|
||||
halt_on_error = True
|
||||
|
||||
assert retry_jobs(process_step, halt_on_error) is False
|
||||
|
||||
create_job('job-test-retry-jobs-1')
|
||||
create_job('job-test-retry-jobs-2')
|
||||
add_step('job-test-retry-jobs-1', args_1)
|
||||
add_step('job-test-retry-jobs-1', args_1)
|
||||
add_step('job-test-retry-jobs-2', args_2)
|
||||
add_step('job-test-retry-jobs-3', args_3)
|
||||
|
||||
assert retry_jobs(process_step, halt_on_error) is False
|
||||
|
||||
move_job_file('job-test-retry-jobs-1', 'failed')
|
||||
move_job_file('job-test-retry-jobs-2', 'failed')
|
||||
|
||||
assert retry_jobs(process_step, halt_on_error) is True
|
||||
|
||||
|
||||
def test_run_steps() -> None:
|
||||
|
||||
Reference in New Issue
Block a user