File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1062,32 +1062,38 @@ def get_gcp_region(details):
10621062 return "us-west4"
10631063 elif region == "Texas" :
10641064 return "us-south1"
1065+ else :
1066+ return "us-other"
10651067 elif country == "ZA" :
10661068 if region == "Gauteng" :
10671069 return "africa-south1"
10681070 # Add other regions later if needed.
1071+ return "other"
10691072 return None
10701073
10711074
1075+ class ColabLocationError (RuntimeError ):
1076+ pass
1077+
1078+
10721079def check_colab_location (gcp_region : Optional [str ]):
10731080 """
10741081 Sometimes, colab will allocate a VM outside the US, e.g., in
10751082 Europe or Asia. Because the MalariaGEN GCS buckets are located
10761083 in the US, this is usually bad for performance, because of
1077- increased latency and lower bandwidth. Add a check for this and
1078- issue a warning if not in the US.
1084+ increased latency and lower bandwidth, and costs money. Add a
1085+ check for this and raise an error if not in the US.
10791086 """
10801087
10811088 if colab and gcp_region :
10821089 if not gcp_region .startswith ("us-" ):
1083- warnings . warn (
1090+ raise ColabLocationError (
10841091 fill (
10851092 dedent (
10861093 """
1087- Your currently allocated Google Colab VM is not located in the US.
1088- This usually means that data access will be substantially slower.
1089- If possible, select "Runtime > Disconnect and delete runtime" from
1090- the menu to request a new VM and try again.
1094+ Your Google Colab VM is not located in the US.
1095+ Please select "Runtime > Disconnect and delete runtime" from
1096+ the menu to request a new VM, then rerun your notebook.
10911097 """
10921098 )
10931099 )
You can’t perform that action at this time.
0 commit comments