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

Rename ghost module to overlap #3830

Merged
merged 24 commits into from Aug 6, 2018
Merged

Rename ghost module to overlap #3830

merged 24 commits into from Aug 6, 2018

Conversation

rmsare
Copy link
Contributor

@rmsare rmsare commented Jul 31, 2018

This replaces ghost with an identical overlap module and makes the same changes to the docs. All of the old ghost tests or documentation are kept as is, and tests are duplicated for overlap.

Calling an old function warns and returns the result from the corresponding function in overlap. I went ahead and replaced ghost.ghost with overlap.overlap for consistency, as it seemed confusing to be able to call overlap.ghost(...).

There are probably better ways to deprecate the old ghost module, too, but couldn't find any examples of deprecation warnings used elsewhere in dask so I tried to be conservative. Any pointers or feedback would be much appreciated!

Addresses #3639.

  • Tests added / passed
  • Passes flake8 dask

@mrocklin
Copy link
Member

This looks really nice to me. cc @jakirkham @jni

All of the old ghost tests or documentation are kept as is, and tests are duplicated for overlap.

It's encouraing seeing that the old test suite works cleanly. Question for the group, do we want to keep it around, or clean it up / remove it?

@mrocklin
Copy link
Member

Thank you for putting this together @rmsare . I think that this new name will help a lot of people find this functionality.

@jni
Copy link
Contributor

jni commented Jul 31, 2018

Nice! I agree that this is the least-jargony name.

@mrocklin
Copy link
Member

mrocklin commented Aug 1, 2018

If no one else has any comments then I suggest that we remove the old test suite and then merge this in. If we want to keep some tests I think that they should probably only test the warning behavior, and leave the correctness tests for test_overlap.py . I don't think it's essential that we test the warning behavior though.

@jakirkham
Copy link
Member

What do you mean by old tests?

@mrocklin
Copy link
Member

mrocklin commented Aug 1, 2018 via email

@rmsare
Copy link
Contributor Author

rmsare commented Aug 1, 2018

I agree with removing the old tests, done.

Not sure what the accepted practice would be on testing the warnings, but my preference is to not write specific tests for that kind of behavior.

@mrocklin
Copy link
Member

mrocklin commented Aug 1, 2018

Merging this tomorrow if there are no further comments

Copy link
Member

@jcrist jcrist left a comment

Choose a reason for hiding this comment

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

Apologies for the late review here. Overall this looks fine, requested a few additional cleanups to the warnings.


index = tuple(index)
warn('ghost module will be renamed to overlap, '
Copy link
Member

Choose a reason for hiding this comment

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

Request to change "will be" -> "has been". This should be done throughout.

Also request to be a bit more descriptive, since this may show up deeper in other functions. Perhaps:

warn("the dask.array.ghost module has been renamed to dask.array.overlap, ...")

index = tuple(index)
warn('ghost module will be renamed to overlap, '
'use overlap.fractional_slice.',
DeprecationWarning)
Copy link
Member

Choose a reason for hiding this comment

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

DeprecationWarnings are ignored by default on non-python 2, so users won't see this warning (which is unhelpful). In other parts of dask we have been using raw warnings prefixed with the string "DeprecationWarning:", which seems to work fairly well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, completely forgot those are ignored with default warnings. I've updated the warning type and message text.

Map a function across blocks
----------------------------

Ghosting goes hand-in-hand with mapping a function across blocks. This
Copy link
Member

Choose a reason for hiding this comment

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

Ghosting -> Overlapping?

shape2 = [d if axes.get(i, 0) else 1 for i, d in enumerate(shape)]
result = reshapelist(shape2, seq)
return result
return overlap.expand_key(k, dims, name, axes)


def ghost_internal(x, axes):
Copy link
Member

Choose a reason for hiding this comment

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

Should we rename ghost_internal to overlap_internal?

Copy link
Member

Choose a reason for hiding this comment

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

NVM. Overlooked the warning below.


Consider two neighboring blocks in a Dask array.

.. image:: images/unghosted-neighbors.png
Copy link
Member

Choose a reason for hiding this comment

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

Kind of nitpicky, but should we rename the images as well?

Copy link
Member

Choose a reason for hiding this comment

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

Worth noting there are SVGs like this as well that may need the same renaming. SVGs contain a docname parameter internally (why?) that includes the name too, which would need renaming as well.


.. image:: images/unghosted-neighbors.png
:width: 30%
:alt: un-overlapped neighbors
Copy link
Member

Choose a reason for hiding this comment

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

non-overlapping


.. image:: images/ghosted-neighbors.png
:width: 30%
:alt: overlapped neighbors
Copy link
Member

Choose a reason for hiding this comment

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

overlapping


.. image:: images/ghosted-blocks.png
:width: 40%
:alt: overlapped blocks
Copy link
Member

Choose a reason for hiding this comment

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

overlapping

@jakirkham
Copy link
Member

jakirkham commented Aug 2, 2018

Should we (re)move docs/source/array-ghost.rst?

@jakirkham
Copy link
Member

Looks pretty good, @rmsare. Added a few comments above. Thanks for working on this.

@mrocklin
Copy link
Member

mrocklin commented Aug 2, 2018 via email

@rmsare
Copy link
Contributor Author

rmsare commented Aug 2, 2018

Thanks @jcrist and @jakirkham ! I've addressed most of your comments.

TODO later today: Edit the SVGs, and redirect on the array-ghost.rst page.

Unfortunately these changes are pushed under my work account username, hope that's alright.

@mrocklin
Copy link
Member

mrocklin commented Aug 3, 2018

We should add a redirect in docs/source/conf.py. Look for redirect_files.

@mrocklin
Copy link
Member

mrocklin commented Aug 3, 2018

@jakirkham thank you for the extensive review here. Are you ok with the revised changes?

@jakirkham
Copy link
Member

Just the redirect that you mentioned and there were a couple "ghost" SVGs remaining.

@rmsare
Copy link
Contributor Author

rmsare commented Aug 5, 2018

@mrocklin Thanks for pointing out the redirect list. I think these changes take care of the rest of the comments above. Sorry for the delay on these.

@mrocklin
Copy link
Member

mrocklin commented Aug 6, 2018

Anything left to do here? @jakirkham are you ok with these changes?

@jakirkham
Copy link
Member

There still appears to be docs/source/array-ghost.rst with a full doc page referencing da.ghost. Was that going to be replaced by a redirect? 😕

@rmsare
Copy link
Contributor Author

rmsare commented Aug 6, 2018

@jakirkham Oops, it is deleted now. array-ghost.html redirects to array-overlap.html in any case.

Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @rmsare. 😄

@jcrist
Copy link
Member

jcrist commented Aug 6, 2018

Thanks @rmsare! Merging.

@jcrist jcrist merged commit 07cb89f into dask:master Aug 6, 2018
@rmsare rmsare deleted the rename-ghost branch August 6, 2018 21:15
@shoyer
Copy link
Member

shoyer commented Aug 8, 2018

This is causing xarray's test suite to fail (see pydata/xarray#2349).

In particular, please restore the top level import of ghost in dask/array/__init__.py, so code like da.ghost.ghost(...) gets a warning instead of failing with AttributeError.

@mrocklin
Copy link
Member

mrocklin commented Aug 8, 2018

@rmsare would you be willing to follow up here?

@shoyer thanks for the report

@jcrist
Copy link
Member

jcrist commented Aug 8, 2018

Apologies @shoyer, this is fixed in #3861.

@rmsare
Copy link
Contributor Author

rmsare commented Aug 8, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants