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

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