[autotest] Set shard to NULL for completed jobs.

Completed job's shards are set to NULL to signal they should be
uploaded to the master again.

BUG=None
DEPLOY=scheduler
TEST=Run suites

Change-Id: Icd040c895ca6f2a5e3cfcc53e762a94f5b442f58
Reviewed-on: https://chromium-review.googlesource.com/218721
Reviewed-by: Prashanth B <beeps@chromium.org>
Commit-Queue: Jakob Jülich <jakobjuelich@chromium.org>
Tested-by: Jakob Jülich <jakobjuelich@chromium.org>
diff --git a/scheduler/scheduler_models.py b/scheduler/scheduler_models.py
index 004711c..6bb4b88 100644
--- a/scheduler/scheduler_models.py
+++ b/scheduler/scheduler_models.py
@@ -633,6 +633,9 @@
 
         if complete:
             self._on_complete(status)
+            if self.job.shard_id is not None:
+                # If shard_id is None, the job will be synced back to the master
+                self.job.update_field('shard_id', None)
             self._email_on_job_complete()
 
         should_email_status = (status.lower() in _notify_email_statuses or