Completed
Pull Request — master (#173)
by
unknown
27s
created

VerifyCedarCluster   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 21
loc 21
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_arguments() 15 15 4

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
import os
2
import sys
3
4
from verify_slurm_cluster import VerifySlurmCluster, set_defaults
5
6
7 View Code Duplication
class VerifyCedarCluster(VerifySlurmCluster):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8
9
    WALLTIME = 60
10
    CORES_PER_NODE = 24
11
    GPUS_PER_NODE = 4
12
13
    def get_arguments(self, **kwargs):
14
15
        kwargs = super(VerifyCedarCluster, self).get_arguments(**kwargs)
16
17
        if kwargs["gpusPerCommand"] == 0:
18
            account = os.environ.get("CPU_SLURM_ACCOUNT")
19
        else:
20
            account = os.environ.get("GPU_SLURM_ACCOUNT")
21
22
        if "sbatchFlags" not in kwargs or len(kwargs["sbatchFlags"]) == 0:
23
            kwargs["sbatchFlags"] = "--account=" + account
24
        else:
25
            kwargs["sbatchFlags"] += " --account=" + account
26
27
        return kwargs
28
29
30
if __name__ == "__main__":
31
    verifications = filter(lambda o: not o.startswith("--"), sys.argv[1:])
32
    VerifyCedarCluster(debug="--debug" in sys.argv[1:],
33
                       no_fork="--no-fork" in sys.argv[1:]).run_verifications(
34
        filtered_by=verifications)
35