Confirm artifact existing before downloading in a new thread.

Call method WaitForArtifactToExist to make sure all artifact exist before
starting downloading in a new thread. This prevents caller from waiting
indefinitely for any nonexistent artifact.

BUG=chromium:270819
TEST=test with run_suite in a local setup of devserver

Change-Id: I0b2af27e0abe5fd7ede63c492e4e2f4f8be0c56e
Reviewed-on: https://gerrit.chromium.org/gerrit/65397
Reviewed-by: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
diff --git a/build_artifact.py b/build_artifact.py
index 0e63fb2..f8686a8 100755
--- a/build_artifact.py
+++ b/build_artifact.py
@@ -104,7 +104,7 @@
     with open(os.path.join(self.install_dir, self.marker_name), 'w') as f:
       f.write('')
 
-  def _WaitForArtifactToExist(self, timeout):
+  def WaitForArtifactToExist(self, timeout):
     """Waits for artifact to exist and sets self.name to appropriate name."""
     names = gsutil_util.GetGSNamesWithWait(
         self.name, self.archive_url, str(self), single_item=self.single_name,
@@ -166,7 +166,7 @@
         # If the artifact should already have been uploaded, don't waste
         # cycles waiting around for it to exist.
         timeout = 1 if no_wait else 10
-        self._WaitForArtifactToExist(timeout)
+        self.WaitForArtifactToExist(timeout)
         self._Download()
         self._Setup()
         self._MarkArtifactStaged()