RSH 16: Debugging

Debugging: we all do it, we are never taught it. How we approach it and some tools we use

Video

Collaborative notes taken during the session

Ice-breaker question

What was the most difficult bug you have chased/solved? What was the longest debugging session/period for you?

Questions and comments

Code:

import ipyparallel as ipp
rc = ipp.Client()
rc.ids
executor = rc.become_dask(ncores=4)
executor
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/ipyparallel/controller/hub.py", line 559, in dispatch_query
    handler(idents, msg)
  File "/opt/conda/lib/python3.7/site-packages/ipyparallel/controller/hub.py", line 1467, in become_dask
    self.distributed_scheduler = scheduler = Scheduler(**kwargs)
  File "/opt/conda/lib/python3.7/site-packages/distributed/scheduler.py", line 885, in __init__
    self.bandwidth = parse_bytes(dask.config.get("distributed.scheduler.bandwidth"))
  File "/opt/conda/lib/python3.7/site-packages/dask/utils.py", line 1164, in parse_bytes
    s = s.replace(" ", "")
AttributeError: 'int' object has no attribute 'replace'

"Sleep on it" :smile: :+1:

"debuggers do not remove bugs, they run your code in slow motion" [citation needed]

The example that we use gdb on (later also Valgrind): https://github.com/ResearchSoftwareHour/demo-debugging :+1:

def func(mylist=[]):
    mylist.append("hello")
    print(mylist)

func()
func()
...

Thank you! :) Learned a lot and will start debugging now

Thanks for another great episode of RSHour! :heart: +1 :+1:

Thank you :-)

Notes we used when planning this session

Introduction

Types of bugs

Approach to debugging

Preparing code for debugging

Debuggers and debugging tools

Bonus if we have time