Move all cli logic to cli module
Fix some pylint complaints
Less hacky retry logic, updated ChunkedFileWrapper

* Run upload_check after all units are uploaded to refresh bitmap
  properly.
* Use offset/length instead of range_start/range_end in
  ChunkedFileWrapper