@@ -144,7 +144,10 @@ def GetArchitectureFromMachineType(machine_type: str) -> Architecture:
144144 The architecture of the machine type. This can be either X86 or ARM.
145145 """
146146 machine_type = machine_type .lower ().split ("-" )
147- return Architecture .ARM if machine_type [0 ].endswith ("a" ) else Architecture .X86
147+ if machine_type [0 ].lower ().endswith ("x" ):
148+ return Architecture .ARM
149+ else :
150+ return Architecture .X86
148151
149152
150153@retry .retry (
@@ -317,13 +320,19 @@ def UploadArtifactsToGcs(
317320
318321 storage_client = storage .Client ()
319322
320- # Create the bucket if it does not exist.
321- bucket = storage_client .bucket (bucket_name )
322- try :
323- storage_client .create_bucket (bucket )
324- logging .info ("Created bucket [%s] in the project." , bucket_name )
325- except google_cloud_exceptions .Conflict :
326- logging .info ("Bucket [%s] already exists in the project." , bucket_name )
323+ bucket = storage_client .lookup_bucket (bucket_name )
324+ if bucket is None :
325+ # Create the bucket if it does not exist.
326+ try :
327+ storage_client .create_bucket (bucket )
328+ logging .info ("Created bucket [%s] in the project." , bucket_name )
329+ except google_cloud_exceptions .exceptions .GoogleAPIError as e :
330+ logging .info (
331+ "Bucket creation failed for %s: %s. Skipping GCS upload." ,
332+ bucket_name ,
333+ e ,
334+ )
335+ return
327336
328337 for artifact in artifacts_to_upload :
329338 UploadArtifactToGcs (
@@ -470,7 +479,7 @@ def DownloadFileFromUrl(url: str, destination_path: str) -> None:
470479
471480def InstallMftUserspaceSoftware (
472481 architecture : Architecture , mft_version : str , mft_build_version : str
473- ):
482+ ) -> None :
474483 """Installs Mellanox Firmware Tool (MFT) userspace software on the instance.
475484
476485 Args:
@@ -682,7 +691,7 @@ def InsertMftKernelModulesIfNotLoaded(
682691
683692def IdentifyMftKernelModules (
684693 gce_instance_info : GceInstanceInfo ,
685- ) -> storage . Blob :
694+ ):
686695 """Downloads the Mellanox Firmware Tool (MFT) kernel modules.
687696
688697 Args:
0 commit comments