[autotest] TKO parser mark original tests as invalid

This is part of the test retry imeplementation.
When retry job finished, we mark the original tests as invalid
so that run_suite/tko frontend could get the latest
results by only retrieving "valid" tests.

Also add a column 'invalidates_test_idx' in tko_tests.
This field works as a pointer from retry to original tests.
It will be used by wmatrix.

Design doc: crbug.com/314759

CQ-DEPEND=CL:191002, CL:190585
TEST=1)Manually call create_job twice, drop a keyval
"original_retry_job_id" for the first job. Let the scheduler
pick up and run the two jobs. Observe that at the end, the rows
for the first job in tko_tests are marked as invalid.
And 'invalidates_test_idx' are updated correctly.
2) Integration test with crosreview.com/191002 and
crosreview.com/190585.
- Add "JOB_RETRIES=2" to dummy_Fail/control
  and dummy_Pass/control.
  Create a trybot image that has the change.
- run_suite.py -b lumpy -s dummy -i
trybot-lumpy-release/R35-5653.0.0-b1948
- Observe that dummy_Fail is retried twice, and
  'invalid' and 'invalidates_job_id' are properly set
  in tko_tests.
  Observe that dummy_Pass is not retried.
- Test the same flow but dependencies are not satisfied
  Observed no retry was scheduled
- Test the same flow but abandon dummy_Fail before it started
  Observed no retry was scheduled
3) dummy suite runs ok with run_suite and test_that
4) Run database/migrate.py sync 86 (85)
   Observed database sync'd properly.
BUG=chromium:347687
DEPLOY=migrate, apache

Change-Id: Ieed64a724c7330c50e8c022bd659b9d1ec781061
Reviewed-on: https://chromium-review.googlesource.com/188365
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Fang Deng <fdeng@chromium.org>
Tested-by: Fang Deng <fdeng@chromium.org>
4 files changed