Total Complexity | 4 |
Total Lines | 21 |
Duplicated Lines | 100 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
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 |
||
7 | View Code Duplication | class VerifyCedarCluster(VerifySlurmCluster): |
|
|
|||
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 | |||
35 |