From 7ad139a49dfb01533f815b12deb77a90925996d9 Mon Sep 17 00:00:00 2001 From: "Juan M. Cruz-Martinez" Date: Fri, 24 Nov 2023 10:25:30 +0100 Subject: [PATCH 1/6] Update dask dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e9f31aa..a75ca62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ requires = [ "pandas", "pygments", "blessings", - "dask", + "dask[distributed]", ] [tool.flit.metadata.requires-extra] From 1ba0563254c54f826e3afcfad9dd1d2ed6744288 Mon Sep 17 00:00:00 2001 From: "Juan M. Cruz-Martinez" Date: Fri, 24 Nov 2023 10:28:49 +0100 Subject: [PATCH 2/6] Update ruamel dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a75ca62..56536ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ description-file="README.md" requires = [ "jinja2", - "ruamel_yaml", + "ruamel_yaml<0.18", "matplotlib", "pandas", "pygments", From 4d3f997ae338bfc1dcf2c1f9b50ec7346e5c9d7c Mon Sep 17 00:00:00 2001 From: "Juan M. Cruz-Martinez" Date: Fri, 24 Nov 2023 10:36:10 +0100 Subject: [PATCH 3/6] edit conda recipe as well --- conda-recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 4036c7b..c0e481d 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -25,6 +25,7 @@ requirements: - blessings - pandoc >=2 - dask + - distributed test: requires: From 17ea7cc142fd148e3cb3b484f6283726bbbda4fd Mon Sep 17 00:00:00 2001 From: juacrumar Date: Fri, 24 Nov 2023 12:55:59 +0100 Subject: [PATCH 4/6] fix tests --- conda-recipe/meta.yaml | 2 -- src/reportengine/resourcebuilder.py | 15 +++++++++------ src/reportengine/tests/test_builder.py | 3 ++- src/reportengine/tests/test_executor.py | 11 +++++++---- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index c0e481d..a663664 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -14,7 +14,6 @@ requirements: - python - flit - run: - python - jinja2 @@ -25,7 +24,6 @@ requirements: - blessings - pandoc >=2 - dask - - distributed test: requires: diff --git a/src/reportengine/resourcebuilder.py b/src/reportengine/resourcebuilder.py index c0f01bf..94ee80e 100644 --- a/src/reportengine/resourcebuilder.py +++ b/src/reportengine/resourcebuilder.py @@ -43,9 +43,9 @@ class DefaultStylePlugin(WorkerPlugin): Class used to set style for each dask worker """ - def __init__(self, style, default_style): - self.style = style - self.default_style = default_style + def __init__(self, style = None, default_style = None): + self.style = style if style is not None else "default" + self.default_style = default_style if default_style is not None else "default" def setup(self, worker): from matplotlib import style @@ -238,9 +238,12 @@ def execute_parallel(self, scheduler=None): """ log.info("Initializing dask.distributed Client") - plugin = DefaultStylePlugin( - style=self.environment.style, default_style=self.environment.default_style - ) + if self.environment is not None: + plugin = DefaultStylePlugin( + style=self.environment.style, default_style=self.environment.default_style + ) + else: + plugin = DefaultStylePlugin() if not scheduler: # the deefault distributed logger is too noisy. Limit it here since diff --git a/src/reportengine/tests/test_builder.py b/src/reportengine/tests/test_builder.py index e95e3d5..c00c56c 100644 --- a/src/reportengine/tests/test_builder.py +++ b/src/reportengine/tests/test_builder.py @@ -162,7 +162,8 @@ def test_collect(self): d = namespaces.resolve(builder.rootns, [('lists',1)]) assert d['restaurant_collect'] == list("123") builder.execute_parallel() - assert namespaces.resolve(builder.rootns, ('UK',))['score'] == -1 + # since it is using dask it returns a future + assert namespaces.resolve(builder.rootns, ('UK',))['score'].result() == -1 def test_collect_raises(self): with self.assertRaises(TypeError): diff --git a/src/reportengine/tests/test_executor.py b/src/reportengine/tests/test_executor.py index 7066ded..ca056d5 100644 --- a/src/reportengine/tests/test_executor.py +++ b/src/reportengine/tests/test_executor.py @@ -76,10 +76,13 @@ def nsspec(x, beginning=()): self.graph.add_node(mcall, inputs={gcall, hcall}) - def _test_ns(self): + def _test_ns(self, promise=False): mresult = 'fresult: 4'*10 namespace = self.rootns - self.assertEqual(namespace['mresult'], mresult) + if promise: + self.assertEqual(namespace['mresult'].result(), mresult) + else: + self.assertEqual(namespace['mresult'], mresult) def test_seq_execute(self): @@ -88,7 +91,7 @@ def test_seq_execute(self): def test_parallel_execute(self): self.execute_parallel() - self._test_ns() + self._test_ns(promise=True) if __name__ =='__main__': - unittest.main() \ No newline at end of file + unittest.main() From eb92582c877d444e22d45ee64c9d88f91b6a9aa0 Mon Sep 17 00:00:00 2001 From: "Juan M. Cruz-Martinez" Date: Mon, 4 Mar 2024 20:23:12 +0100 Subject: [PATCH 5/6] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 56536ec..cd649ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ description-file="README.md" requires = [ "jinja2", - "ruamel_yaml<0.18", + "ruamel_yaml<0.18", # the code is not compatible with ruamel 0.18 "matplotlib", "pandas", "pygments", From 56a324214b7de3a0a2da4991b26e9a994d4bf04c Mon Sep 17 00:00:00 2001 From: juacrumar Date: Thu, 7 Mar 2024 11:35:10 +0100 Subject: [PATCH 6/6] add bokeh --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cd649ef..c5574d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,4 +32,6 @@ test = [ "pytest", "hypothesis", ] - +dashboard = [ + "bokeh!=3.0.*,>=2.4.2" +]