Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions dask_jobqueue/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ class JobQueueCluster(SpecCluster):
)

job_cls = None
config_name = None

def __init__(
self,
Expand Down Expand Up @@ -421,9 +422,12 @@ def __init__(
"or SGEJob with the job_cls= argument."
)

if config_name:
if config_name is not None:
self.config_name = config_name

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.

Not convinced this is the right fix, not 100% sure though. I need to look into it more ...

My instincts is that there is some unnecessary complicated things with config_name both a class variable at the Cluster level and the Job level ... a bit vague but I'll try to look at it tomorrow in more details.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I agree this might thought about it a little more, but maybe we could do this after fixing this problem? (I know, we'll probably never look at it again ...)

Maybe we should merge this and open another issue to indicate that we parse the config twice and create duplicate class variables?

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.

Wow it has been 19 days already ... I have a WIP PR in #366. Let me know if you have any comments.


if self.config_name:
if interface is None:
interface = dask.config.get("jobqueue.%s.interface" % config_name)
interface = dask.config.get("jobqueue.%s.interface" % self.config_name)

scheduler = {
"cls": Scheduler, # Use local scheduler for now
Expand All @@ -435,8 +439,8 @@ def __init__(
"security": security,
},
}
if config_name:
kwargs["config_name"] = config_name
if self.config_name:
kwargs["config_name"] = self.config_name
kwargs["interface"] = interface
kwargs["protocol"] = protocol
kwargs["security"] = security
Expand Down
11 changes: 11 additions & 0 deletions dask_jobqueue/tests/test_jobqueue_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import socket
import sys
import re
import psutil

import pytest

import dask
from dask_jobqueue import (
JobQueueCluster,
PBSCluster,
Expand Down Expand Up @@ -206,3 +208,12 @@ def test_cluster_has_cores_and_memory(Cluster):

with pytest.raises(ValueError, match=r"cores=4, memory='\d+GB'"):
Cluster(cores=4)


@pytest.mark.asyncio
async def test_config_interface():
net_if_addrs = psutil.net_if_addrs()
interface = list(net_if_addrs.keys())[0]
with dask.config.set({"jobqueue.pbs.interface": interface}):
cluster = PBSCluster(cores=1, memory="2GB", asynchronous=True)
assert interface in str(cluster.scheduler_spec)