Tradefed: reduce query count
Tradefed processes a manifest.xml file with sometimes more than a million tests. The code was sending multiple SQL queries to the database for every test in the manifest. It is known that SQUAD can become very slow in those situations, specially when other tasks are happening at the same time, causing lots of stress in the database.
The solution in this patch focuses in processing all tests in memory first, and only then add them to the database, in batches.
Unfortunately Django does not support bulk get_or_create so it had to be done manually.