Skip to content

Split up client and local code.#330

Merged
bgrant merged 11 commits into
enthought:masterfrom
cowlicks:split-global-local
May 5, 2014
Merged

Split up client and local code.#330
bgrant merged 11 commits into
enthought:masterfrom
cowlicks:split-global-local

Conversation

@cowlicks
Copy link
Copy Markdown
Contributor

Previously with local/ residing in distarray/* next to all the client code the client code was imported anytime we imported local/. This PR breaks up the package so that local code and client code can be imported independently. This avoi
had imports from local. This breaks up the package so that local code and client code can be imported independently. This avoids some of the circular import issues we had. And avoids import client modules on the engines.

The package structure is now like this

distarray/
    |
    -local/
    |   -local_stuff.py
    -client/
    |   -client_stuff.py
    -general_stuff.py

I also renamed the client.py file to distarray.py.

@kwmsmith kwmsmith added this to the 0.3 milestone Apr 21, 2014
@kwmsmith
Copy link
Copy Markdown
Contributor

@bgrant @cowlicks thoughts on renaming client / client_stuff to global / global_stuff? It would compliment local better, and is less IP.parallel centric, preparing the way for implementing an MPI-only backend.

@kwmsmith kwmsmith modified the milestone: 0.3 Apr 21, 2014
@bgrant
Copy link
Copy Markdown
Contributor

bgrant commented Apr 21, 2014

Doesn't this run into reserved-word issues?

@cowlicks
Copy link
Copy Markdown
Contributor Author

I'm not sure what you mean @bgrant ?

@markkness
Copy link
Copy Markdown
Contributor

I think he means the proposed use of the name global, which is a reserved
word. I suggest not trying to use reserved words.

On Mon, Apr 21, 2014 at 3:47 PM, Blake Griffith notifications@github.comwrote:

I'm not sure what you mean @bgrant https://github.com/bgrant ?


Reply to this email directly or view it on GitHubhttps://github.com//pull/330#issuecomment-40975366
.

@cowlicks
Copy link
Copy Markdown
Contributor Author

Oh yeah, @kwmsmith's suggestion does.

@kwmsmith
Copy link
Copy Markdown
Contributor

I rescind my suggestion -- don't know what I was thinking...

Other options besides global for this package? world? universe? Nothing comes to mind that I really like.

We could abbreviate it to glb or glbl, but those don't seem very good, either.

@cowlicks
Copy link
Copy Markdown
Contributor Author

I'd prefer client since we seem to have a master/slave architecture. And the client does "master" stuff.

@cowlicks
Copy link
Copy Markdown
Contributor Author

rebased

@kwmsmith
Copy link
Copy Markdown
Contributor

But client is definitely IPython.parallel terminology. It would be a strange name for someone coming from MPI, for example.

What about root? Or master?

@cowlicks
Copy link
Copy Markdown
Contributor Author

I like client because it implies it is the interface through which we control distarray. Other suggested names don't really do this, except master, but this has git connotations. controller, interface, or manager would work.

I'd like to steer away from prepositional phrases like local, global, remote etc. since their meaning is relative to the location you are considering, and instead use the relationship between the client and engines for naming. Since this is the same universally.

@cowlicks
Copy link
Copy Markdown
Contributor Author

Also, I'll hold off rebasing this until we think it is ready to merge since it will probably break again.

@cowlicks
Copy link
Copy Markdown
Contributor Author

Rebased. Did we decide what to rename client? I like to get this merged soon since it touches so much stuff.

@bgrant
Copy link
Copy Markdown
Contributor

bgrant commented Apr 24, 2014

@kwmsmith, @cowlicks: Why don't we go ahead and merge this to get the breakage out of the way. It'll be easier to do a rename when we decide on new names.

@cowlicks
Copy link
Copy Markdown
Contributor Author

@bgrant okay. Changing the name will be easier once this is in. I'll rebase it and go with dist and local

@kwmsmith
Copy link
Copy Markdown
Contributor

@bgrant @cowlicks +1 on merging for now, and resolving the final name later. Reviewing.

Comment thread distarray/dist/context.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't necessary (and it's broken -- cleanup_all takes 2 arguments).

Look at the Context._CLEANUP = (...) inside Context.__init__(). That's where the cleanup stuff is registered.

@cowlicks
Copy link
Copy Markdown
Contributor Author

Rebased and working

@kwmsmith
Copy link
Copy Markdown
Contributor

@cowlicks -- looks good. Some small comments:

  • It seems like mpiutils.py should go inside local.
  • Similarly, ipython_utils.py should go inside dist.
  • cleanup.py should go inside dist, I think.
  • I'd prefer if distarray/utils.py were split into distarray/local/utils.py and distarray/dist/utils.py, but that isn't so important right now, I think.

Ideally we'd have just the local, dist, externals, plotting, apps and tests packages inside distarray, but we don't have to do everything in this PR.

@cowlicks
Copy link
Copy Markdown
Contributor Author

@kwmsmith mpiutils is used in context.py so it does not make sense for it to be in local/. What if all the the *utils.py modules go in distarray/utils/*?

@kwmsmith
Copy link
Copy Markdown
Contributor

On Wed, Apr 30, 2014 at 2:58 PM, Blake Griffith notifications@github.comwrote:

mpiutils is used in context.py so it does not make sense for it to be in
local/.

It's used inside functions that are pushed locally with apply_async, so
it is only ever used on the engines. It is never imported directly by
anything inside context.py

What if all the the utils.py modules go in distarray/utils/?

Only for those that really need to be used both locally and globally.
mpiutils should only ever need to be used locally.


Reply to this email directly or view it on GitHubhttps://github.com//pull/330#issuecomment-41842795
.

Kurt W. Smith, Ph.D. ksmith@enthought.com
Enthought, Inc. http://www.enthought.com | 512.536.1057

@cowlicks
Copy link
Copy Markdown
Contributor Author

cowlicks commented May 1, 2014

Rebased

@bgrant
Copy link
Copy Markdown
Contributor

bgrant commented May 1, 2014

I think most of the tests in distarray/tests should go in distarray/dist/tests. I like to have code structured like the following:

my_module.py
tests/
    test_my_module.py
subpackage/
    my_other_module.py
    tests/
        test_my_other_module.py

@bgrant
Copy link
Copy Markdown
Contributor

bgrant commented May 1, 2014

... so some of the tests should also move from distarray/tests to distarray/utils/tests as well.

Otherwise, looks good to me.

@kwmsmith
Copy link
Copy Markdown
Contributor

kwmsmith commented May 1, 2014

@bgrant +1 -- @cowlicks please move whatever test files from distarray/tests to distarray/dist/tests as makes sense.

cowlicks added 7 commits May 1, 2014 19:36
This is because dacluster should not have to impor distarray/client/ to
clean things up.
Since the module distarray/client/distarray.py's name conflicts with the
package name we import `absolute_import` everywhere in the file.
@kwmsmith
Copy link
Copy Markdown
Contributor

kwmsmith commented May 2, 2014

@cowlicks -- what about moving mpiutils.py to local, ipython_utils.py to dist, and cleanup.py to dist?

@cowlicks
Copy link
Copy Markdown
Contributor Author

cowlicks commented May 2, 2014

@kwmsmith oops, I thought those were already in this PR for some reason. Done.

@bgrant
Copy link
Copy Markdown
Contributor

bgrant commented May 2, 2014

@cowlicks: what I was getting at here is that each module in directory <dir> should have its tests in <dir>/tests. So since metadata_utils.py and testing.py are still in distarray/, their tests should still be in distarray/tests. The modules that you moved into distarray/dist should have their tests is distarray/dist/tests/.

@kwmsmith
Copy link
Copy Markdown
Contributor

kwmsmith commented May 2, 2014

@cowlicks looks like the dacluster script wasn't updated with the recent moves (travis fails for both 2.7 and 3.3).

Also, please organize the test files according to @bgrant's suggestion.

@cowlicks
Copy link
Copy Markdown
Contributor Author

cowlicks commented May 2, 2014

Okay trying again.

@bgrant
Copy link
Copy Markdown
Contributor

bgrant commented May 5, 2014

Looks good to me.

@bgrant bgrant merged commit 767e989 into enthought:master May 5, 2014
@cowlicks cowlicks deleted the split-global-local branch May 27, 2014 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants