Skip to content

Commit

Permalink
Avoid querying metadata query to check if it's GCE if `TPU_SKIP_MDS_Q…
Browse files Browse the repository at this point in the history
…UERY` is set.

PiperOrigin-RevId: 687399234
  • Loading branch information
Google-ML-Automation committed Oct 18, 2024
1 parent bbcc3ee commit 8e52b92
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jax/_src/clusters/cloud_tpu_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ def is_env_present(cls) -> bool:
if not running_in_cloud_tpu_vm:
logger.debug("Did not detect cloud TPU VM")
return False
if os.environ.get("TPU_SKIP_MDS_QUERY") is not None:
logger.debug("TPU_SKIP_MDS_QUERY is set to True, so it's probably not a GCE TPU cluster.")
return False
metadata_response, metadata_code = get_metadata('agent-worker-number')
if metadata_code == metadata_response_code_success:
logger.debug("Gce Tpu Cluster detected for Jax Distributed System")
Expand Down

0 comments on commit 8e52b92

Please sign in to comment.