code: def get_live_gcs_manager(
      tmp_path: Path,
      prefix: Optional[str],
      require_secrets: bool,
  ) -> storage.GCSStorageManager:
      """
      Skip when we have no gcs access, unless --require-secrets was set, in which case fail.
  
      Note that if you normally have GCS access to the bucket in question and you have done the usual
      login with the gcloud cli tool, no environment variables are necessary to run this test locally.
      """
  
      # Instantiating a google.cloud.storage.Client() takes a few seconds, so we speed up test by
      # reusing the one created for the storage manager.
      try:
          manager = storage.GCSStorageManager(
              bucket=BUCKET_NAME,
              prefix=prefix,
              temp_dir=str(tmp_path),
          )
          blob = manager.bucket.blob(CHECK_ACCESS_KEY)
          assert blob.download_as_bytes() == CHECK_KEY_CONTENT
      except errors.NoDirectStorageAccess as e:
          # No access detected.
          if (not require_secrets) and isinstance(
              e.__cause__,
              google.auth.exceptions.DefaultCredentialsError,
          ):
              pytest.skip("No GCS access")
          raise
  
      return manager
  
file_path: determined/harness/tests/storage/test_gcs.py
imports: import os
  import uuid
  from pathlib import Path
  from typing import Dict, Iterator, List, Optional
  import google.auth.exceptions
  import google.cloud.storage
  import pytest
  from determined import errors
  from determined.common import storage
  from determined.tensorboard.fetchers.gcs import GCSFetcher
  from tests.storage import util
label_desc: Use image node_id 2 for calling a global function with example usage: get_live_gcs_manager(tmp_path, prefix, require_secrets) and returns: manager