Skip to content

Commit 2e9135f

Browse files
Kate NoskovaKate Noskova
authored andcommitted
make tests faster and fix restoration
1 parent b85cedd commit 2e9135f

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

gadma/optimizers/optimizer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,9 @@ def optimize(self, f, variables, args=(),
515515

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

521522
optimize_kwargs = self.process_optimize_kwargs(f=f_in_opt,
522523
variables=vars_in_opt,

tests/test_all.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def test_restore_finished_run(self):
189189
fl.write("Linked SNP's: False\n"
190190
"Silence: True\n"
191191
"global_maxiter: 2\n"
192-
"local_maxiter: 1\n")
192+
"local_maxeval: 10\n")
193193
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file,
194194
'--output', outdir]
195195
try:
@@ -212,7 +212,7 @@ def test_restore_models_from_finished_run(self):
212212
"Relative parameters: True\n"
213213
"Silence: True\n"
214214
"global_maxiter: 2\n"
215-
"local_maxiter: 1\n")
215+
"local_maxeval: 10\n")
216216
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file,
217217
'--only_models']
218218
try:
@@ -238,7 +238,7 @@ def test_restore_with_different_options_1(self):
238238
"Projections: 4,4\n"
239239
"Silence: True\n"
240240
"global_maxiter: 2\n"
241-
"local_maxiter: 1\n")
241+
"local_maxeval: 10\n")
242242
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
243243
try:
244244
core.main()
@@ -264,7 +264,7 @@ def test_restore_with_different_options_2(self):
264264
"Projections: 4,4\n"
265265
"Silence: True\n"
266266
"global_maxiter: 2\n"
267-
"local_maxiter: 1\n")
267+
"local_maxeval: 10\n")
268268
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
269269
try:
270270
gadma.PIL_available = False
@@ -286,7 +286,7 @@ def test_restore_with_different_options_failure(self):
286286
"Initial structure: 1, 1\n"
287287
"Silence: True\n"
288288
"global_maxiter: 2\n"
289-
"local_maxiter: 1\n")
289+
"local_maxeval: 10\n")
290290
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
291291
try:
292292
gadma.PIL_available = False
@@ -310,7 +310,7 @@ def test_restore_with_new_migration_masks(self):
310310
"Migration masks: [[0, 1], [0, 0]]\n"
311311
"Silence: True\n"
312312
"global_maxiter: 2\n"
313-
"local_maxiter: 1\n")
313+
"local_maxeval: 10\n")
314314
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
315315

316316
try:
@@ -374,7 +374,7 @@ def test_restore_failure_with_new_migration_masks(self):
374374
"Migration masks: [[0, 1], [0, 0]]\n"
375375
"Silence: True\n"
376376
"global_maxiter: 2\n"
377-
"local_maxiter: 1\n")
377+
"local_maxeval: 10\n")
378378
sys.argv = ['gadma', '--resume', finished_run_dir, '-p', params_file]
379379
try:
380380
gadma.PIL_available = False

0 commit comments

Comments
 (0)