Add shard count and shard index as tags to a swarming task.

Sometimes I'm only interested in the history of a single shard for a
given suite. Adding shard info as tags will let me query for them
explicitly in the task page on the web UI.

Bug: none
Change-Id: I10df73b77f09d1a4e004b2f0ffed2f108b729205
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-py/+/1217862
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Mirrored-From: https://chromium.googlesource.com/infra/luci/luci-py
Cr-Mirrored-Commit: 9d777172a5b1a46e99b2315d530aebdcdbb0bff0
diff --git a/swarming.py b/swarming.py
index 914e8e9..6124583 100755
--- a/swarming.py
+++ b/swarming.py
@@ -275,6 +275,11 @@
             total_shards = int(env_var['value'])
       if total_shards > 1:
         req['name'] += ':%s:%s' % (shard_index, total_shards)
+      if shard_index and total_shards:
+        req['tags'] += [
+            'shard_index:%d' % shard_index,
+            'total_shards:%d' % total_shards,
+        ]
 
     return req, shard_index