Refactor sql2subunit to use get_tests_run_dicts_from_run_id

This commit takes the sql2subunit method in write_subunit and rewrites
it to use the get_tests_run_dicts_from_run_id() function.
This significantly improves the performance of sql2subunit by using
a single joined query to collect information, rather than running
multiple queries serially in a loop.

Change-Id: Ic1d8cc38d19e1f7531e10cc750c7b3dc8fa731ca
Merge "Refactor sql2subunit to use get_tests_run_dicts_from_run_id"