Skip to content

Commit

Permalink
make tests faster and fix restoration
Browse files Browse the repository at this point in the history
  • Loading branch information
Kate Noskova authored and Kate Noskova committed Jun 9, 2022
1 parent b85cedd commit 2e9135f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions gadma/optimizers/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,9 @@ def optimize(self, f, variables, args=(),

# We beleave that optimizer will understand that the run was finished
# Otherwise there are problems when we want to run additional x iters
# if self.run_info.result.success:
# return self.run_info.result
# This block could be commented out but it could cause problems
if self.run_info.result.success:
return self.run_info.result

optimize_kwargs = self.process_optimize_kwargs(f=f_in_opt,
variables=vars_in_opt,
Expand Down
14 changes: 7 additions & 7 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def test_restore_finished_run(self):
fl.write("Linked SNP's: False\n"
"Silence: True\n"
"global_maxiter: 2\n"
"local_maxiter: 1\n")
"local_maxeval: 10\n")
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file,
'--output', outdir]
try:
Expand All @@ -212,7 +212,7 @@ def test_restore_models_from_finished_run(self):
"Relative parameters: True\n"
"Silence: True\n"
"global_maxiter: 2\n"
"local_maxiter: 1\n")
"local_maxeval: 10\n")
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file,
'--only_models']
try:
Expand All @@ -238,7 +238,7 @@ def test_restore_with_different_options_1(self):
"Projections: 4,4\n"
"Silence: True\n"
"global_maxiter: 2\n"
"local_maxiter: 1\n")
"local_maxeval: 10\n")
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
try:
core.main()
Expand All @@ -264,7 +264,7 @@ def test_restore_with_different_options_2(self):
"Projections: 4,4\n"
"Silence: True\n"
"global_maxiter: 2\n"
"local_maxiter: 1\n")
"local_maxeval: 10\n")
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
try:
gadma.PIL_available = False
Expand All @@ -286,7 +286,7 @@ def test_restore_with_different_options_failure(self):
"Initial structure: 1, 1\n"
"Silence: True\n"
"global_maxiter: 2\n"
"local_maxiter: 1\n")
"local_maxeval: 10\n")
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
try:
gadma.PIL_available = False
Expand All @@ -310,7 +310,7 @@ def test_restore_with_new_migration_masks(self):
"Migration masks: [[0, 1], [0, 0]]\n"
"Silence: True\n"
"global_maxiter: 2\n"
"local_maxiter: 1\n")
"local_maxeval: 10\n")
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]

try:
Expand Down Expand Up @@ -374,7 +374,7 @@ def test_restore_failure_with_new_migration_masks(self):
"Migration masks: [[0, 1], [0, 0]]\n"
"Silence: True\n"
"global_maxiter: 2\n"
"local_maxiter: 1\n")
"local_maxeval: 10\n")
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
try:
gadma.PIL_available = False
Expand Down

0 comments on commit 2e9135f

Please sign in to comment.