pytorch / torchx
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 336 units with 2,817 lines of code in units (55.0% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (132 lines of code)
    • 27 medium size units (838 lines of code)
    • 47 small units (679 lines of code)
    • 260 very small units (1,168 lines of code)
0% | 4% | 29% | 24% | 41%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 4% | 29% | 24% | 41%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
torchx/cli0% | 16% | 23% | 27% | 31%
torchx/schedulers0% | 4% | 36% | 20% | 38%
torchx/apps0% | 0% | 85% | 6% | 7%
torchx/pipelines0% | 0% | 47% | 27% | 25%
scripts0% | 0% | 13% | 41% | 44%
torchx/runner0% | 0% | 9% | 24% | 66%
torchx/runtime0% | 0% | 29% | 24% | 45%
torchx/components0% | 0% | 0% | 34% | 65%
torchx/util0% | 0% | 0% | 29% | 70%
torchx0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _run()
in torchx/cli/cmd_run.py
78 10 3
def role_to_pod()
in torchx/schedulers/kubernetes_scheduler.py
54 6 2
def describe()
in torchx/schedulers/docker_scheduler.py
47 11 2
def describe()
in torchx/schedulers/slurm_scheduler.py
44 8 2
def parse_args()
in torchx/apps/utils/process_monitor.py
43 1 1
def main()
in torchx/apps/utils/process_monitor.py
43 13 1
def app_to_resource()
in torchx/schedulers/kubernetes_scheduler.py
42 5 2
def add_arguments()
in torchx/cli/cmd_run.py
41 1 2
def main()
in torchx/apps/serve/serve.py
40 5 1
def describe()
in torchx/schedulers/kubernetes_scheduler.py
36 5 2
def factory_wrapper()
in torchx/pipelines/kfp/adapter.py
35 7 2
def run_job()
in scripts/kube_dist_trainer.py
33 3 1
def close()
in torchx/schedulers/local_scheduler.py
32 5 1
def run_opts()
in torchx/schedulers/ray_scheduler.py
32 1 1
def parse_args()
in torchx/apps/serve/serve.py
31 2 1
def schedule()
in torchx/schedulers/local_scheduler.py
30 5 2
def describe()
in torchx/schedulers/local_scheduler.py
30 9 2
def parse_args()
in torchx/apps/utils/booth_main.py
29 1 1
def load()
in torchx/runner/config.py
26 9 4
def add_arguments()
in torchx/cli/cmd_log.py
25 2 2