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

Update reportengine dependencies #61

Merged
merged 6 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
1 change: 0 additions & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ requirements:
- python
- flit


run:
- python
- jinja2
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ classifiers = [
description-file="README.md"
requires = [
"jinja2",
"ruamel_yaml",
"ruamel_yaml<0.18", # the code is not compatible with ruamel 0.18
"matplotlib",
"pandas",
"pygments",
"blessings",
"dask",
"dask[distributed]",
]
Comment on lines +27 to 28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"dask[distributed]",
]
"dask[distributed]",
"bokeh!=3.0.*,>=2.4.2",
]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is bokeh a required dependency? I don't see it anywhere


[tool.flit.metadata.requires-extra]
Expand Down
15 changes: 9 additions & 6 deletions src/reportengine/resourcebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/reportengine/tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 7 additions & 4 deletions src/reportengine/tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason for calling this promise?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looked like a js promise objet to me

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):
Expand All @@ -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()
unittest.main()
Loading