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

Run Modin on cluster #46

Closed
wants to merge 19 commits into from
Closed

Conversation

pschafhalter
Copy link
Collaborator

@pschafhalter pschafhalter commented Jul 19, 2018

This PR lays the groundwork for using modin on clusters. It exposes a primitive way method for running Modin on a cluster using a jupyter notebook.

Example use

modin notebook --config=config.yaml --port=8889
This will launch a Modin cluster configured by config.yaml with the jupyter notebook accessible at localhost:8889.

See example_config.yaml for information on the config file.

What do these changes do?

  • Add scripts to set up Ray cluster
  • Add script to launch jupyter notebook on driver
  • Add modin console command
  • SSH forwarding from driver
  • Documentation

Future work for follow-up PRs

  • Usability improvements
    • Insert ray.init(redis_address=...) into notebook or override ray initialization import modin
    • Open notebook in browser
  • Improved error handling
    • Detecting whether port specified for forwarding is open
    • Better notifications for errors in nodes
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

@kunalgosar
Copy link
Collaborator

I don't think we should merge this until at least the Documentation is ready. Potentially we can all collaborate on this branch in the meantime?

@pschafhalter
Copy link
Collaborator Author

I'll add documentation tomorrow.

Copy link
Collaborator

@devin-petersohn devin-petersohn left a comment

Choose a reason for hiding this comment

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

Left a few comments. Overall looks good!

KEY=$2

ssh -i $2 -o "StrictHostKeyChecking no" $1 << "ENDSSH"
pip3 install modin jupyter
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might want to think about this line for the final implementation. Ideally, we would let the user specify the python they want to use (or somehow require it on the $PATH).

For now, I would suggest just doing python -m pip so it installs for the python on the $PATH. How does this affect ray start and ray stop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll add this fix. It shouldn't affect ray start and ray stop unless the user manually installs Ray with another version of python.

redis_address = cluster.setup_cluster(config)
print("\nLaunching notebook\n")
print("*" * 68)
print(("To connect to the cluster, run the following commands in the "
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally this would go in our __init__ so we should be able to detect if the cli was used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, I'm still thinking about how to best set this up. Do you think setting an environment variable with the redis address and detecting that in the __init__ is a good solution?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would probably be good, but we probably should use two environment variables, one for MODIN_EXECUTION_FRAMEWORK and one for MODIN_RAY_REDIS_ADDRESS or something like that.

def setup_cluster(config):
"""Sets up a cluster given a valid configuration"""
if config["execution_engine"] != "ray":
raise ValueError("Only Ray clusters supported for now")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer NotImplementedError

@pschafhalter pschafhalter changed the title Run Modin on cluster [WIP] Run Modin on cluster Jul 20, 2018
@pschafhalter pschafhalter changed the title [WIP] Run Modin on cluster Run Modin on cluster Jul 20, 2018
@robertnishihara
Copy link
Contributor

We've tried to make it super easy to start/manage a Ray cluster with the documentation in http://ray.readthedocs.io/en/latest/using-ray-on-a-large-cluster.html (for the existing cluster case), and http://ray.readthedocs.io/en/latest/autoscaling.html (for AWS/GCP).

This PR is targeting the existing the existing cluster case. If you find configure_ray_cluster.sh easier to use than what we currently have in our documentation, we should add it to the Ray repository (it would be useful for any Ray user, right?).


def check_required(config, schema):
"""Check required config entries"""
if type(config) is not dict and type(config) is not list:
Copy link
Contributor

Choose a reason for hiding this comment

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

It's more canonical to use isinstance

@@ -0,0 +1,52 @@
#!/usr/bin/sh
Copy link
Contributor

Choose a reason for hiding this comment

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

I've made some scripts like this in the past, and in the end I've always had to convert them from bash -> Python. Happy to share examples.

Copy link
Collaborator Author

@pschafhalter pschafhalter Jul 24, 2018

Choose a reason for hiding this comment

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

Would love to take a look!

@@ -0,0 +1,44 @@
from __future__ import absolute_import
from __future__ import print_function
Copy link
Contributor

Choose a reason for hiding this comment

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

did you intend to omit from __future__ import division?

@@ -0,0 +1,146 @@
import os
import subprocess
import yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

@ericl can you comment on whether whether it makes sense to support an autoscaler config that takes in a bunch of IP addresses for nodes in an existing cluster?

Copy link

Choose a reason for hiding this comment

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

Yes, that should work

@@ -0,0 +1,146 @@
import os
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest adding the from __future__ import ... lines for consistency

if os.environ.get("MODIN_EXECUTION_FRAMEWORK") == "ray" and \
os.environ.get("MODIN_RAY_REDIS_ADDRESS"):
redis_address = os.environ.get("MODIN_RAY_REDIS_ADDRESS")
ray.init(redis_address=redis_address)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect it will simplify users' lives to just call ray.init(redis_addres=...) but I could be wrong about that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@devin-petersohn thoughts? This was what I was doing in an older version of the PR.

@pschafhalter
Copy link
Collaborator Author

@robertnishihara agreed, if parts of this PR generalize to generic Ray clusters, I would be happy to merge them upstream. At first, I hoped to first take advantage of the autoscaler scripts in order to easily run Pandas on Ray AWS/GCP clusters, but after some discussion @devin-petersohn thought it might be best to develop a script for manually managed clusters first.

@simon-mo
Copy link
Collaborator

@pschafhalter Will you be ok if I push this PR forward?

@pschafhalter
Copy link
Collaborator Author

@simon-mo sure, although I think it should be redesigned to take advantage of the Ray's newly added support for local clusters ray-project/ray#2678

@devin-petersohn devin-petersohn added new feature/request 💬 Requests and pull requests for new features and removed enhancement labels Sep 28, 2018
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@devin-petersohn
Copy link
Collaborator

Jenkins, add to whitelist.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Modin/12/
Test FAILed.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Modin-Performance-Testing/6/
Test FAILed.

@pschafhalter
Copy link
Collaborator Author

Closed since this is out-of-date

dchigarev pushed a commit to dchigarev/modin that referenced this pull request Aug 25, 2020
mvashishtha pushed a commit to mvashishtha/modin that referenced this pull request Jan 26, 2023
* Fix nlargest and smallest support

Signed-off-by: Naren Krishna <[email protected]>
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Feb 13, 2023
RehanSD pushed a commit to RehanSD/modin that referenced this pull request Feb 17, 2023
…a service

Signed-off-by: Devin Petersohn <[email protected]>

Fixes to pass CI + docs for io.py

Update implementation

Signed-off-by: Devin Petersohn <[email protected]>

Fix some things

Signed-off-by: Devin Petersohn <[email protected]>

Lint fixes

Fix put

Signed-off-by: Devin Petersohn <[email protected]>

Clean up and add new details

Signed-off-by: Devin Petersohn <[email protected]>

Use fsspec to get full path and allow URLs

Signed-off-by: Devin Petersohn <[email protected]>

Add lazy loc

Signed-off-by: Devin Petersohn <[email protected]>

fixes for tests

porting more tests

more fixes

moar fixes

Raise exception

Signed-off-by: Devin Petersohn <[email protected]>

Lint fixes

Return Python as the default modin engine

Handle indexing case for client qc

Call fast path for __getitem__ if not lazy

Remove user warning for Python-engine fall back

Add init

Signed-off-by: Devin Petersohn <[email protected]>

Implement free as a no-op

Signed-off-by: Devin Petersohn <[email protected]>

Add support for replace - client side

Fix a couple of issues with Client

Signed-off-by: Devin Petersohn <[email protected]>

Throw errors on to_pandas

Signed-off-by: Devin Petersohn <[email protected]>

Do not default to pandas for str_repeat

Add support for 18 datetime functions/properties

Fix columns caching when renaming columns

Fix test_query: put backticks back for col names

Add support for astype -- client side

hard coded changes for functions

Client support for str_(en/de)code, to_datetime

Add all missing query compiler methods.

Signed-off-by: mvashishtha <[email protected]>

Fix getitem_column_array and take_2d.

Signed-off-by: mvashishtha <[email protected]>

Fix getitem_column_array and take_2d.

Signed-off-by: mvashishtha <[email protected]>

Fix again.

Signed-off-by: mvashishtha <[email protected]>

Fix more bugs.

Signed-off-by: mvashishtha <[email protected]>

More fixes.

Signed-off-by: mvashishtha <[email protected]>

Fix more bugs-- pushdown tests test_dates and test_pivot still broken due to service bugs.

Signed-off-by: mvashishtha <[email protected]>

Fix typo. Note drop() broken because service requires you to specify both argument and client QC at base of this PR uses default Nones.

Signed-off-by: mvashishtha <[email protected]>

Add query compiler class.

Signed-off-by: mvashishtha <[email protected]>

Testing a commit

Initial changes for adding support for Expanding

FEAT Support for rolling.sem

FEAT support for Expanding sum, min, max, mean, var, std, count, sem

Removing extratenous comment

REFACTOR: Remove defaults to pandas at API layer and add some corresponding client QC methods.

Signed-off-by: mvashishtha <[email protected]>

Add more methods.

Signed-off-by: mvashishtha <[email protected]>

Fix expanding.

Signed-off-by: mvashishtha <[email protected]>

Add ewm.

Signed-off-by: mvashishtha <[email protected]>

Revert whitespace.

Signed-off-by: mvashishtha <[email protected]>

Fix to_numpy by making it like to_pandas.

Signed-off-by: mvashishtha <[email protected]>

Remove extra to_numpy.

Signed-off-by: mvashishtha <[email protected]>

Pass kwargs

Signed-off-by: mvashishtha <[email protected]>

Fix DataFrame import for isin.

Signed-off-by: mvashishtha <[email protected]>

Fix again.

Signed-off-by: mvashishtha <[email protected]>

Remove breakpoint

Signed-off-by: mvashishtha <[email protected]>

Tell if series.

Signed-off-by: mvashishtha <[email protected]>

Fix client qc.

Signed-off-by: mvashishtha <[email protected]>

Add self_is_series.

Signed-off-by: mvashishtha <[email protected]>

FIX: Set numeric_only to True in groupby quantile

Add some comments

Fix str_cat/fullmatch/removeprefix/removesuffix/translate/wrap (modin-project#44)

* Fix str_cat/fullmatch/removeprefix/removesuffix/translate/wrap

* Update modin/core/storage_formats/base/query_compiler.py

Co-authored-by: Mahesh Vashishtha <[email protected]>

* Update modin/pandas/series_utils.py

Co-authored-by: Mahesh Vashishtha <[email protected]>

* Update modin/core/storage_formats/base/query_compiler.py

Co-authored-by: Mahesh Vashishtha <[email protected]>

Co-authored-by: Mahesh Vashishtha <[email protected]>

FEAT Support expanding.aggregate (modin-project#45)

Fix at_time and between_time. (modin-project#43)

Signed-off-by: mvashishtha <[email protected]>

Signed-off-by: mvashishtha <[email protected]>

Add QC method for groupby.sem (modin-project#47)

* FEAT: Add partial support for groupby.sem()

* Add sem changes to groupby

Fix nlargest and nsmallest Series support (modin-project#46)

* Fix nlargest and smallest support

Signed-off-by: Naren Krishna <[email protected]>

Remove client query compiler's columnarize. (modin-project#48)

Signed-off-by: mvashishtha <[email protected]>

Signed-off-by: mvashishtha <[email protected]>

Fix info and set memory_usage=False. (modin-project#49)

Signed-off-by: mvashishtha <[email protected]>

Signed-off-by: mvashishtha <[email protected]>

POND-815 fixes for 21 column dataset (modin-project#50)

* POND-815 fixes for 21 column dataset

* Update modin/pandas/base.py

Co-authored-by: helmeleegy <[email protected]>

---------

Co-authored-by: helmeleegy <[email protected]>

Bring in upstream series binary operation fix 6d5545f… (modin-project#52)

* Bring in upstream series binary operation fix 6d5545f.

Signed-off-by: mvashishtha <[email protected]>

* Update modin/pandas/series.py

Co-authored-by: Karthik Velayutham <[email protected]>

---------

Signed-off-by: mvashishtha <[email protected]>
Co-authored-by: Karthik Velayutham <[email protected]>

Support groupby first/last (modin-project#53)

Signed-off-by: Naren Krishna <[email protected]>

FEAT: Add initial partial support for groupby.cumcount() (modin-project#54)

* FEAT: Add partial support for cumcount

* Remove the set_index_name

* Squeeze the result

* Write cumcount name to None

* Can't set dtype to int64

Fix resample sum, prod, size (modin-project#56)

Signed-off-by: Naren Krishna <[email protected]>

POND-184: fix describe and simplify query compiler interface (modin-project#55)

* Fix describe

Signed-off-by: mvashishtha <[email protected]>

* Pass datetime_is_numeric.

Signed-off-by: mvashishtha <[email protected]>

---------

Signed-off-by: mvashishtha <[email protected]>

Fix dt_day_of_week/day_of_year, str_cat/extract/partition/replace/rpartition (modin-project#51)

* Fix dt_day_of_week/day_of_year, str_partition/replace/rpartition

* Fix str_extract

Revert "Fix dt_day_of_week/day_of_year, str_cat/extract/partition/replace/rpartition (modin-project#51)" (modin-project#58)

This reverts commit f7a31ab.

Revert "Revert "Fix dt_day_of_week/day_of_year, str_cat/extract/partition/replace/rpartition (modin-project#51)" (modin-project#58)" (modin-project#60)

This reverts commit ad9231d.

Add query compiler method for groupby.prod() (modin-project#57)

Signed-off-by: Naren Krishna <[email protected]>

FEAT: Add support for groupby.head and groupby.tail (modin-project#61)

* FEAT: Add support for groupby.head and groupby.tail

* Change _change_index

FEAT: Add partial support for groupby.nth (modin-project#62)

FIX: Push first and last down to query compiler. (modin-project#64)

* FIX: Push first and last down to query compiler.

Signed-off-by: mvashishtha <[email protected]>

* Fix last.

Signed-off-by: mvashishtha <[email protected]>

---------

Signed-off-by: mvashishtha <[email protected]>

FEAT: Add partial support for groupby.ngroup (modin-project#65)

* FEAT: Add partial support for groupby.ngroup

* Name of result should be none for now

Add client support for SeriesGroupby unique, nsmallest, nlargest (modin-project#63)

* Add client support for SeriesGroupby unique, nsmallest, nlargest

Signed-off-by: Naren Krishna <[email protected]>

---------

Signed-off-by: Naren Krishna <[email protected]>

Push memory_usage entirely to query compiler [change is not to be upstreamed to Modin] (modin-project#66)

* Fix dataframe memory usage.

Signed-off-by: mvashishtha <[email protected]>

* Fix series memory_usage() the same way.

Signed-off-by: mvashishtha <[email protected]>

---------

Signed-off-by: mvashishtha <[email protected]>

FIX: allow updating backend query compilers in place. (modin-project#67)

* FIX: Mutate client query compiler columns and index in the service.

Motivation: Align axis update semantics across query compilers. In the base
query compiler and even our service's query compiler, you can update the index
and columns in place. However, the service gives no way to update axes of a
query compiler.

Right now, for inplace updates, service exposes an extra method rename(), and
client query compiler uses this to get the id of a new compiler with updated
axis, and then updates its id ID of the new query compiler.

This change might be the first to make the service present a mutable interface
for a backend query compiler. That seems safe to me, except I had to make
copy() get a new query compiler copied from the old query compiler, because we
can't let updates to the new query compiler change the original (or vice versa).

Signed-off-by: mvashishtha <[email protected]>

* Add a comment.

Signed-off-by: mvashishtha <[email protected]>

---------

Signed-off-by: mvashishtha <[email protected]>

FEAT replace groupby.fillna with a simpler logic (modin-project#68)

* FEAT Support expanding.aggregate

* Replaced groupby.fillna logic with a simpler one

* Fix in groupby.fillna. Work object was causing problems.

* Only need to change _check_index_name to _check_index

* Removed commented out code.
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Feb 27, 2023
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Mar 16, 2023
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Mar 16, 2023
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Mar 16, 2023
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Mar 16, 2023
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Mar 16, 2023
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Mar 16, 2023
vnlitvinov pushed a commit to vnlitvinov/modin that referenced this pull request Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature/request 💬 Requests and pull requests for new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants