Skip to content
This repository was archived by the owner on Feb 10, 2021. It is now read-only.

Allow setting the ip of DRMAACluster, fixes #75 - #77

Merged
lesteve merged 2 commits into
dask:masterfrom
maxnoe:ip
Apr 16, 2018
Merged

lesteve merged 2 commits into
dask:masterfrom
maxnoe:ip

Conversation

@maxnoe

@maxnoe maxnoe commented Apr 10, 2018 •

Copy link
Copy Markdown
Contributor

Fixes #75.

@kbruegge kbruegge left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

does the IP string also support specifying the port?

@maxnoe

maxnoe commented Apr 11, 2018 •

Copy link
Copy Markdown
Contributor Author

No, it's just the ip.

The cluster as several ports, you can set them using the kwargs described here:
http://distributed.readthedocs.io/en/latest/local-cluster.html#api

For our usual usecase, setting scheduler_port = 0 (random port) and diagnostics_port=None (deactivate web interface) should work fine.

@lesteve

lesteve commented Apr 12, 2018

Copy link
Copy Markdown
Member

@maxnoe I edited you message to put "Fix #issueNumber" in your PR description (it was only in your title). This way the associated issue gets closed automatically when the PR is merged. For more details, look at this.

@lesteve

lesteve commented Apr 12, 2018

Copy link
Copy Markdown
Member

Is there a way to test this? Minimal test seems to pass an ip to DRMAACluster and to check that the ip of the LocalCluster is the same. Not sure how easy this is to do in practice though.

@maxnoe

maxnoe commented Apr 12, 2018 •

Copy link
Copy Markdown
Contributor Author

Is there a way to test this?

I tested it on our Torque cluster, without it it does not work at all, because the wrong ip address is taken and workers cannot reach the scheduler. With this option, everything works fine.

I edited you message to put "Fix #issueNumber" i

Actually, isses are closed by "fixes #" in the commit message. I included this. As the PR title lands in the Merge commit message, this also works indirectly.

@maxnoe

maxnoe commented Apr 12, 2018 •

Copy link
Copy Markdown
Contributor Author

I use this script:

from dask_drmaa import DRMAACluster
from dask.distributed import Client, as_completed
import time
import pandas as pd
import numpy as np

def do_work(i):
    df = pd.DataFrame()
    df['x'] = np.random.normal(size=1000)
    df['y'] = np.random.normal(size=1000)
    return df

cluster = DRMAACluster(
    ip='10.141.1.3',
    scheduler_port=0,
    diagnostics_port=None,
    template={'nativeSpecification': '-l walltime=03:59:59,vmem=6G'}
)

client = Client(cluster)
cluster.start_workers(2)

while not client.ncores():
    print('Waiting for workers to connect')
    time.sleep(5)

futures = client.map(do_work, range(100))

with pd.HDFStore('test.hdf5', mode='w') as hdf:
    for i, result in enumerate(as_completed(futures), start=1):
        print(f'Job #{i} of 100 done')
        hdf.append('events', client.gather(result))

client.close()
cluster.close()

the 10.146.x.x is the internal network of the nodes.

Comment thread dask_drmaa/core.py
self.hostname = hostname or socket.gethostname()
logger.info("Start local scheduler at %s", self.hostname)
self.local_cluster = LocalCluster(n_workers=0, ip='', **kwargs)
self.local_cluster = LocalCluster(n_workers=0, ip=ip, **kwargs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another solution to this would be to delete the keyword argument and depend on **kwargs to pass things through.

Also, in production I might recommend using the interface= keyword rather than ip=. See http://dask.pydata.org/en/latest/setup/hpc.html#high-performance-network

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deleting it would only listen on '127.0.0.1' per default. The '' makes more sense as a default for DRMAACluster imho.

@mrocklin

mrocklin commented Apr 12, 2018 via email

Copy link
Copy Markdown
Member

@lesteve

lesteve commented Apr 12, 2018

Copy link
Copy Markdown
Member

Is there a way to test this?

I tested it on our Torque cluster, without it it does not work at all, because the wrong ip address is taken and workers cannot reach the scheduler. With this option, everything works fine.

Great that you tested it on your cluster and thanks for your test script! What I had in mind was more is there a way to add a unit test for this fix. This way we make it less likely that this bug reappears inadvertently in the future.

Actually, isses are closed by "fixes #" in the commit message. I included this. As the PR title lands in the Merge commit message, this also works indirectly.

Good point! Not super important at all, but I still prefer the issue number in the PR description, it adds a link to the issue in the PR and a link to the PR in the issue. Also bear in mind that your message can be edited when squash+merging.

@maxnoe

maxnoe commented Apr 12, 2018

Copy link
Copy Markdown
Contributor Author

Unit Testing this is Kind of hard, as it involves several pieces of non standard hardware/system setup

@lesteve

lesteve commented Apr 12, 2018

Copy link
Copy Markdown
Member

Maybe you could test that the ip passed at the DRMAACluster reaches the LocalCluster level as I was alluding to in #77 (comment)?

@maxnoe

maxnoe commented Apr 12, 2018

Copy link
Copy Markdown
Contributor Author

Ah, ok. Yes that sounds like a good first step

@maxnoe

maxnoe commented Apr 12, 2018

Copy link
Copy Markdown
Contributor Author

I added a simple test case for the ip

@maxnoe
maxnoe force-pushed the ip branch 2 times, most recently from 173e502 to b620e02 Compare April 12, 2018 22:07
@lesteve

lesteve commented Apr 13, 2018

Copy link
Copy Markdown
Member

I added a simple test case for the ip

Nice, thanks!

Note the Travis failure seems identical to #60 and can be ignored.

LGTM, I'll wait a bit and merge this one, unless someone complains in the meantime.

@lesteve
lesteve merged commit 8aa6873 into dask:master Apr 16, 2018
@lesteve

lesteve commented Apr 16, 2018

Copy link
Copy Markdown
Member

Merging, thanks a lot @maxnoe!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants