Skip to content

Commit

Permalink
fix: remove redundant function and lock in test_job_manager.py
Browse files Browse the repository at this point in the history
  • Loading branch information
trgiangdo committed Mar 1, 2024
1 parent 613d049 commit 9289f38
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions tests/core/job/test_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,6 @@ def test_delete_job():
assert _JobManager._get(job_1.id) is None


m = multiprocessing.Manager()
lock = m.Lock()


def inner_lock_multiply(nb1: float, nb2: float):
with lock:
return multiply(1 or nb1, 2 or nb2)


def test_raise_when_trying_to_delete_unfinished_job():
Config.configure_job_executions(mode=JobConfig._STANDALONE_MODE, max_nb_of_workers=2)
m = multiprocessing.Manager()
Expand Down Expand Up @@ -331,6 +322,7 @@ def test_cancel_subsequent_jobs():
orchestrator = _OrchestratorFactory._orchestrator
submission_manager = _SubmissionManagerFactory._build_manager()

m = multiprocessing.Manager()
lock_0 = m.Lock()

dn_1 = InMemoryDataNode("dn_config_1", Scope.SCENARIO, properties={"default_data": 1})
Expand Down Expand Up @@ -411,10 +403,12 @@ def test_cancel_subsequent_jobs():
assert_true_after_time(job_4.is_canceled)
assert_true_after_time(job_5.is_abandoned)
assert_true_after_time(job_6.is_abandoned)
assert_true_after_time(lambda: all(
not _OrchestratorFactory._orchestrator._is_blocked(job)
for job in [job_1, job_2, job_3, job_4, job_5, job_6]
))
assert_true_after_time(
lambda: all(
not _OrchestratorFactory._orchestrator._is_blocked(job)
for job in [job_1, job_2, job_3, job_4, job_5, job_6]
)
)
assert_true_after_time(lambda: _OrchestratorFactory._orchestrator.jobs_to_run.qsize() == 0)


Expand Down

0 comments on commit 9289f38

Please sign in to comment.