From d5a2006ecab0c33e571a96cde368fb4b798dd16e Mon Sep 17 00:00:00 2001 From: Peter Habelitz Date: Wed, 22 May 2019 09:40:33 +0000 Subject: [PATCH] bug fix --- phs/compute_definition.py | 12 ++++++++---- tests/test_integrations.py | 8 ++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/phs/compute_definition.py b/phs/compute_definition.py index 199cdb9..c27687b 100644 --- a/phs/compute_definition.py +++ b/phs/compute_definition.py @@ -122,6 +122,8 @@ def __init__(self, if 1 in row[1:]: break self.number_of_parameter_sets_until_first_bayesian_task = count_row + else: + self.number_of_parameter_sets_until_first_bayesian_task = None @@ -269,8 +271,9 @@ def start_execution(self): with PoolExecutor(max_workers=self.local_processes_num_workers) as executor: self.pp.pprint(executor.__dict__) - if self.number_of_parameter_sets_until_first_bayesian_task < self.local_processes_num_workers: - phs.utils.idle_workers_warning(self.number_of_parameter_sets_until_first_bayesian_task, self.local_processes_num_workers) + if self.number_of_parameter_sets_until_first_bayesian_task is not None: + if self.number_of_parameter_sets_until_first_bayesian_task < self.local_processes_num_workers: + phs.utils.idle_workers_warning(self.number_of_parameter_sets_until_first_bayesian_task, self.local_processes_num_workers) self.start_execution_kernel(executor, wait, as_completed) self.as_completed_functions(as_completed) @@ -293,8 +296,9 @@ def start_execution(self): self.pp.pprint(client.scheduler_info()) number_dask_workers = len(client.scheduler_info()['workers']) - if self.number_of_parameter_sets_until_first_bayesian_task < number_dask_workers: - phs.utils.idle_workers_warning(self.number_of_parameter_sets_until_first_bayesian_task, number_dask_workers) + if self.number_of_parameter_sets_until_first_bayesian_task is not None: + if self.number_of_parameter_sets_until_first_bayesian_task < number_dask_workers : + phs.utils.idle_workers_warning(self.number_of_parameter_sets_until_first_bayesian_task, number_dask_workers) client.upload_file(os.path.abspath(phs.bayes.__file__)) # probably not necessary client.upload_file(os.path.abspath(phs.proxy.__file__)) # probably not necessary diff --git a/tests/test_integrations.py b/tests/test_integrations.py index 06e6d0a..5697774 100644 --- a/tests/test_integrations.py +++ b/tests/test_integrations.py @@ -62,3 +62,11 @@ def test_parameter_definition(): def test_post_pro_demo(): template_test_wrapper(func=def_post_pro_demo.def_post_pro_demo, relative_fixture_path='/fixtures/fix_post_pro_demo') + + +# manual tests have to be performed from directory phs: python tests/test_integrations.py +if __name__ == '__main__': + test_quick_start() + test_data_types_and_order() + test_parameter_definition() + test_post_pro_demo() \ No newline at end of file