Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/aistairc/aiaccel into featu…
Browse files Browse the repository at this point in the history
…re/fix_qstat
  • Loading branch information
KanaiYuma-aist committed Aug 18, 2022
2 parents 2b36443 + 5766730 commit 4566f3d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
26 changes: 21 additions & 5 deletions tests/resumption/resumption_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,29 @@ def test_run(self, cd_work, data_dir, work_dir):
commandline_args = [
"start.py",
"--config",
format(config_file)
format(config_file),
"--clean"
]
delete_alive(work_dir)
run_master(commandline_args, work_dir)
final_result_at_one_time = get_final_result(work_dir)
print('at one time', final_result_at_one_time)
wait_alive(work_dir)
delete_alive(work_dir)
base_clean_work_dir(data_dir, work_dir)

config_file = data_dir.joinpath(
'config_{}_resumption.json'.format(self.search_algorithm)
)
commandline_args = [
"start.py",
"--config",
format(config_file)
format(config_file),
"--clean"
]
run_master(commandline_args, work_dir)
print('resumed steps finished')
wait_alive(work_dir)

delete_alive(work_dir)
config_file = data_dir.joinpath(
'config_{}.json'.format(self.search_algorithm)
)
Expand All @@ -54,6 +57,8 @@ def test_run(self, cd_work, data_dir, work_dir):
dict_resume
]
run_master(commandline_args, work_dir)
wait_alive(work_dir) #
delete_alive(work_dir)
final_result_resumption = get_final_result(work_dir)
print('resumption steps finished', final_result_resumption)
assert final_result_at_one_time == final_result_resumption
Expand Down Expand Up @@ -91,7 +96,18 @@ def wait_alive(work_dir):
break
if not alive:
break
time.sleep(0.1)
time.sleep(1.0)


def delete_alive(work_dir):
alive_files = [
work_dir.joinpath(aiaccel.dict_alive, aiaccel.alive_master),
work_dir.joinpath(aiaccel.dict_alive, aiaccel.alive_optimizer),
work_dir.joinpath(aiaccel.dict_alive, aiaccel.alive_scheduler)
]
for alive_file in alive_files:
if alive_file.exists():
alive_file.unlink()


def base_clean_work_dir(data_dir, work_dir):
Expand Down
4 changes: 2 additions & 2 deletions tests/resumption/sphere/test_sphere_tpe_resumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import aiaccel


class TestSphereRandomResumption(ResumptionTest):
class TestSphereTpeResumption(ResumptionTest):

@classmethod
def setup_class(cls):
cls.search_algorithm = aiaccel.search_algorithm_random
cls.search_algorithm = aiaccel.search_algorithm_tpe

0 comments on commit 4566f3d

Please sign in to comment.