@@ -104,7 +104,7 @@ def move_script_dir_to_gcs(script_dir, tmp_dir, zip_name, bucket_path):
104104
105105 # Move zip file to GCS
106106 zip_in_gcs_path = "/" .join ((bucket_path , zip_name ))
107- command = ["gsutil " , "mv" , zip_path , zip_in_gcs_path ]
107+ command = ["gcloud" , "storage " , "mv" , zip_path , zip_in_gcs_path ]
108108 captured_output = subprocess .run (command , check = True , capture_output = True )
109109
110110 # Cleanup
@@ -148,7 +148,7 @@ def write_startup_script(zip_gcs_path, zip_name, log_name, bucket_path, startup_
148148tar xzf { zip_name }
149149{ args .COMMAND } ) 2>&1) >> { log_name }
150150(echo "{ finish_status_str ()} ") >> { log_name }
151- gsutil cp { log_name } "{ bucket_path } /"
151+ gcloud storage cp { log_name } "{ bucket_path } /"
152152(({ create_kill_command_str (args )} ) 2>&1 ) >> { log_name } """
153153
154154 with open (startup_script_file , "wt" , encoding = "utf-8" ) as f :
@@ -199,10 +199,10 @@ def write_download_from_gcs_sh(zip_gcs_path):
199199while [ \$GCS_READ_SUCCESS -eq 0 ]
200200do
201201 {{ # try
202- gsutil cp { zip_gcs_path } . &&
202+ gcloud storage cp { zip_gcs_path } . &&
203203 echo 'Code download from GCS successful!' && GCS_READ_SUCCESS=1
204204 }} || {{ # catch
205- echo 'Failed to read GCS via gsutil , trying again'
205+ echo 'Failed to read GCS via gcloud storage , trying again'
206206 sleep 10
207207 }}
208208done"""
@@ -341,7 +341,7 @@ def main(raw_args=None) -> None:
341341 captured_output = move_script_dir_to_gcs (args .SCRIPT_DIR , tmp_dir_relative_to_script , zip_name , bucket_path )
342342 if captured_output .returncode != 0 :
343343 print ("\n \n Moving code to GCS failed" )
344- print (f"Running 'gsutil mv zip { bucket_path } ' failed with error: " )
344+ print (f"Running 'gcloud storage mv zip { bucket_path } ' failed with error: " )
345345 print (captured_output .stderr .decode ())
346346 print ("\n You may need to run 'gcloud auth login'" )
347347 return - 1
0 commit comments