Skip to content

Cluster keeps appending "interface" flag to job script #589

Closed

Description

@theXYZT

When I run the following code snippet:

from dask_jobqueue import SLURMCluster

cluster = SLURMCluster(memory="100GB", cores=40, interface="ib0")

for _ in range(20):
    _ = cluster.job_script()
    
print(cluster.job_script())

I get the following output:

#!/usr/bin/env bash

#SBATCH -J dask-worker
#SBATCH -n 1
#SBATCH --cpus-per-task=40
#SBATCH --mem=94G
#SBATCH -t 00:30:00

/path/to/python -m distributed.cli.dask_worker tcp://xx.xx.xx.xx:pppp --nthreads 5 --nworkers 8 --memory-limit 11.64GiB --name dummy-name --nanny --death-timeout 60 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0 --interface ib0

It seems everytime the job script method is called, the interface flag is appended to it. I am running dask-jobqueue==0.8.0 off the conda-forge channel. (Python 3.10 if relevant)

You can replicate this with PBSCluster as well. The issue seems to be in how worker_extra_args are handled in the __init__() method of dask_jobqueue.core.Job

Activity

  1. changed the title [-]SLURMCluster keeps appending "interface" flag to job script[/-] [+]Cluster keeps appending "interface" flag to job script[/+] on Oct 1, 2022
  2. guillaumeeb commented on Oct 2, 2022

    @guillaumeeb
    Member

    Hi @theXYZT,

    Good catch!

    It seems that when we retrieve the worker-extra-args from dask.config (https://github.com/dask/dask-jobqueue/blob/main/dask_jobqueue/core.py#L226), as we don't make a copy, the object is kept in memory in dask.config, and so we retrieve the same object each time we construct a Job.

    I'm not sure why yet, but this issue was not present in previous release (0.7.4) before we renamed extra in worker-extra-args.

    I'll propose some fix, but I'd like to understand which change we made that lead to this result. cc @jolange if you have some idea.

    @theXYZT does is causes errors on your system or is it just a visual problem?

  3. theXYZT commented on Oct 2, 2022

    @theXYZT
    Author

    I am not sure if this causes any problems currently. Although I use a few more worker-extra-args and all of them get duplicated quite a bit in the job script over time.

  4. jolange commented on Oct 3, 2022

    @jolange
    Contributor

    I did not notice this funny feature so far, thanks! From a quick look at the renaming diffs, I don't see what might have caused that, but if you are sure that it did not happen in the previous release, I will have a closer look later!

  5. guillaumeeb commented on Oct 3, 2022

    @guillaumeeb
    Member

    From a quick look at the renaming diffs, I don't see what might have caused that

    Neither do I, but I tested the problem on 0.7.4 and it did not behave that way. I admit I have no idea if this comes from the renaming or something else. It's ok if you don't have time, I just wanted to know if something strikes you.

  6. jolange commented on Oct 3, 2022

    @jolange
    Contributor

    I found the part of the renaming that is causing this. I still don't get why yet, but I'll figure it out and fix it!

  7. jolange commented on Oct 3, 2022

    @jolange
    Contributor

    Ok, this is a subtle combination of two things:

    1. The one you noted: The config is assigned to worker_extra_args:
      worker_extra_args = dask.config.get(
      "jobqueue.%s.worker-extra-args" % self.config_name
      )
    2. In the renaming, I changed from X = X + NEW to X += NEW:
             if interface:
    -            extra = extra + ["--interface", interface]
    +            worker_extra_args += ["--interface", interface]

    This changes the config, whereas before worker_extra_args (or extra then) was newly assigned. I will revert that!

  8. guillaumeeb commented on Oct 3, 2022

    @guillaumeeb
    Member

    Nice catch and many thanks @jolange.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions