mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-27 14:25:16 +02:00
made parallel optimize_restart responsive to ctrl+c
This commit is contained in:
parent
b33d3e4c99
commit
c44493077a
1 changed files with 13 additions and 9 deletions
|
|
@ -188,10 +188,10 @@ class model(parameterised):
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
initial_parameters = self._get_params_transformed()
|
initial_parameters = self._get_params_transformed()
|
||||||
|
|
||||||
if parallel:
|
if parallel:
|
||||||
|
try:
|
||||||
jobs = []
|
jobs = []
|
||||||
pool = mp.Pool(processes=num_processes)
|
pool = mp.Pool(processes=num_processes)
|
||||||
for i in range(Nrestarts):
|
for i in range(Nrestarts):
|
||||||
|
|
@ -201,6 +201,10 @@ class model(parameterised):
|
||||||
|
|
||||||
pool.close() # signal that no more data coming in
|
pool.close() # signal that no more data coming in
|
||||||
pool.join() # wait for all the tasks to complete
|
pool.join() # wait for all the tasks to complete
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print "Ctrl+c received, terminating and joining pool."
|
||||||
|
pool.terminate()
|
||||||
|
pool.join()
|
||||||
|
|
||||||
for i in range(Nrestarts):
|
for i in range(Nrestarts):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue