[autotest]: Update gs_offloader to work on finished times.

Currently gs_offloader offloads jobs based off of when they are
created. This causes issues for long running jobs that run longer
than the offload wait time, causing them to be offloaded or
deleted as soon as they finish.

This change utilizes the finished times of special tasks a job's
host queue entries rather than the started and created times.

If all the host queue entries have null finished_on times, it then
uses the job's created_on time.

BUG=chromium:404275
TEST=unittests, manually edited my local database so that the
started time was less than now + days_old while the finish time was
not and observed it offloaded when it was supposed to.
DEPLOY=gs_offloader

Change-Id: I00186e9854d4e6fe37c28dac65e4c235618a248c
Reviewed-on: https://chromium-review.googlesource.com/212884
Reviewed-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
2 files changed