Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add queue timeout for 30 seconds #60

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions alpha_automl/automl_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,35 @@ def _search_pipelines(self, automl_hyperparams):
found_pipelines = 0

while True:
result = queue.get()
try:
result = queue.get(timeout=30)
except Exception:
EdenWuyifan marked this conversation as resolved.
Show resolved Hide resolved
logger.info('Queue Timeout after 30s')
result = None

if result == 'DONE':
search_process.terminate()
search_process.join(30)
logger.info(f'Found {found_pipelines} pipelines')
logger.info('Search done')
break

pipeline = result
score = pipeline.get_score()
logger.info('Found new pipeline')
yield {'pipeline': pipeline, 'message': 'FOUND'}

if need_rescoring:
score, start_time, end_time = score_pipeline(pipeline.get_pipeline(), self.X, self.y, self.scoring,
self.splitting_strategy)
pipeline.set_score(score)
pipeline.set_start_time(start_time)
pipeline.set_end_time(end_time)

if score is not None:
logger.info(f'Pipeline scored successfully, score={score}')
found_pipelines += 1
yield {'pipeline': pipeline, 'message': 'SCORED'}
elif result is not None:
pipeline = result
score = pipeline.get_score()
logger.info('Found new pipeline')
yield {'pipeline': pipeline, 'message': 'FOUND'}

if need_rescoring:
score, start_time, end_time = score_pipeline(pipeline.get_pipeline(), self.X, self.y, self.scoring,
self.splitting_strategy)
pipeline.set_score(score)
pipeline.set_start_time(start_time)
pipeline.set_end_time(end_time)

if score is not None:
logger.info(f'Pipeline scored successfully, score={score}')
found_pipelines += 1
yield {'pipeline': pipeline, 'message': 'SCORED'}

if time.time() > search_start_time + self.time_bound:
search_process.terminate()
Expand Down