Skip to content

forward 'ip' to LocalCluster - #107

Merged
guillaumeeb merged 5 commits into
dask:masterfrom
twoertwein:master
Aug 7, 2018
Merged

guillaumeeb merged 5 commits into
dask:masterfrom
twoertwein:master

Conversation

@twoertwein

Copy link
Copy Markdown
Contributor

JobQueueCluster forwards any additional keyword arguments to LocalCluster. However, it fails to forward 'ip' to the LocalCluster as it is explicitly set. This commit allows the user to forward 'ip' to the LocalCluster.

Context:
My cluster head has two network interfaces (one facing only the workers and one facing the internet). I want the scheduler to only listen on the worker facing interface. The 'interface' argument would be well suited for this task but JobQueueCluster also forwards this interface to the workers. Unfortunately, not all my cluster nodes have the same interface names. Therefore, I have to use 'ip' to force the scheduler to listen on the worker facing interface (without forcing the workers itself to use a (potentially non-existing) interface).
Personally, I would prefer to not force the interface of the workers (in that case I could use 'interface' to set the interface of only the scheduler) but I assume you have a reason for doing so :)

@lesteve

lesteve commented Jul 31, 2018

Copy link
Copy Markdown
Member

I am not an expert in this kind of thing but this seems like a problem related to dask/dask-drmaa#75. It would be great if you could add a test similar to the one in dask/dask-drmaa#77.

Unfortunately, not all my cluster nodes have the same interface names.

Interesting, can I ask whether there is a good reason for this?

Personally, I would prefer to not force the interface of the workers (in that case I could use 'interface' to set the interface of only the scheduler) but I assume you have a reason for doing so :)

Not sure ... maybe @mrocklin has some inputs on this.

@guillaumeeb guillaumeeb left a comment

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.

Those changes seem fine to me, thanks. I was searching a way to do that with less 'if' but I'm still not pythonic enough to find one.

I am not an expert in this kind of thing but this seems like a problem related to dask/dask-drmaa#75. It would be great if you could add a test similar to the one in dask/dask-drmaa#77.

Interestingly, the solution here is different, we do not default to ip='', but look for the hostname, both solutions are ok though.

Personally, I would prefer to not force the interface of the workers (in that case I could use 'interface' to set the interface of only the scheduler) but I assume you have a reason for doing so :)

Not sure ... maybe @mrocklin has some inputs on this.

See http://dask.pydata.org/en/latest/setup/hpc.html#high-performance-network, usualy in an HPC cluster, all the nodes have the same interfaces, and especially infiniband ones. The scheduler and workers need to use identical interface to communicate, as you found out.

@twoertwein

twoertwein commented Jul 31, 2018 •

Copy link
Copy Markdown
Contributor Author

I am not an expert in this kind of thing but this seems like a problem related to dask/dask-drmaa#75. It would be great if you could add a test similar to the one in dask/dask-drmaa#77.

Yes, that looks similar. I will look trough how you are doing unit tests and then add one to verify the IP address.

Interesting, can I ask whether there is a good reason for this?

There is no (good) reason for that. I wish the interfaces across all nodes had the same name. It is a cluster from a university research lab.

Those changes seem fine to me, thanks. I was searching a way to do that with less 'if' but I'm still not pythonic enough to find one.

This solution would have less if's and it doesn't change the input arguments:

# Find the IP address and (if requested) set interface for workers
localhost_kwargs = {}
if interface:
    localhost_kwargs['ip'] = get_ip_interface(interface)
    extra += ' --interface  %s ' % interface
else:
    localhost_kwargs['ip'] = socket.gethostname()

localhost_kwargs.update(kwargs)
self.local_cluster = LocalCluster(n_workers=0, **localhost_kwargs)

@guillaumeeb

Copy link
Copy Markdown
Member

This solution would have less if's and it doesn't change the input arguments

I was thinking on something like this, but with a temporary variable, not a dict:

localcluster_ip = socket.gethostname()
if interface:
    localcluster_ip  = get_ip_interface(interface)
    extra += ' --interface  %s ' % interface

if 'ip' not in kwargs:
    kwargs['ip'] = localcluster_ip 

But really, no strong concern about this, I let you chose, we can keep it as it is.

@twoertwein

Copy link
Copy Markdown
Contributor Author

@lesteve about the test case, there are some differences compared to dask/dask-drmaa#77

  1. JobQueueCluster should not directly be instantiated. I could add a SLURM test case, but that seems to be the wrong place for it;
  2. The requested IP address in Allow setting the ip of DRMAACluster, fixes #75 dask-drmaa#77 is the same one as JobQueueCluster would use by default, i.e., it wouldn't test anything. I could request an IP address which 'probably' does not coincide with the default IP address by requesting the (probably not-existing) IP address 127.0.0.2 (surprisingly, it does work to insatiate a SLURMCluster with this IP address, even though that machine doesn't have an interface with that ip).

I don't think that using a SLURMCluster (wrong component) with a probably not-existing IP address is a good way to test this PR. Do you have any suggestions?

I will change the PR to reflect @guillaumeeb suggestion - it looks much nicer :)

@guillaumeeb

Copy link
Copy Markdown
Member

I'm adding basic tests here, to merge if everything is OK so that we can move on to solve #90.

@guillaumeeb
guillaumeeb merged commit 392a927 into dask:master Aug 7, 2018
@guillaumeeb

Copy link
Copy Markdown
Member

Getting this in quiclky to propose another PR that solves #90 and allows #111.

Thanks @twoertwein.

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.

4 participants