@@ -396,7 +396,7 @@ class CloudContainerBuilder(ContainerBuilder):
396
396
"""Container builder that uses Google cloud build."""
397
397
398
398
def get_docker_image (
399
- self , max_status_check_attempts = 20 , delay_between_status_checks = 30
399
+ self , max_status_check_attempts = 40 , delay_between_status_checks = 30
400
400
):
401
401
"""Builds, publishes and returns a Docker image.
402
402
@@ -427,7 +427,9 @@ def get_docker_image(
427
427
requestBuilder = google_api_client .TFCloudHttpRequest ,
428
428
)
429
429
request_dict = self ._create_cloud_build_request_dict (
430
- image_uri , storage_object_name
430
+ image_uri ,
431
+ storage_object_name ,
432
+ max_status_check_attempts * delay_between_status_checks
431
433
)
432
434
433
435
try :
@@ -494,7 +496,9 @@ def _upload_tar_to_gcs(self):
494
496
blob .upload_from_filename (self .tar_file_path )
495
497
return storage_object_name
496
498
497
- def _create_cloud_build_request_dict (self , image_uri , storage_object_name ):
499
+ def _create_cloud_build_request_dict (
500
+ self , image_uri , storage_object_name , timeout_sec
501
+ ):
498
502
"""Creates request body for cloud build JSON API call.
499
503
500
504
`create` body should be a `Build` object
@@ -503,6 +507,7 @@ def _create_cloud_build_request_dict(self, image_uri, storage_object_name):
503
507
Args:
504
508
image_uri: GCR Docker image URI.
505
509
storage_object_name: Name of the tarfile object in GCS.
510
+ timeout_sec: timeout for the CloudBuild in seconds.
506
511
507
512
Returns:
508
513
Build request dictionary.
@@ -511,6 +516,7 @@ def _create_cloud_build_request_dict(self, image_uri, storage_object_name):
511
516
request_dict ["projectId" ] = self .project_id
512
517
request_dict ["images" ] = [[image_uri ]]
513
518
request_dict ["steps" ] = []
519
+ request_dict ["timeout" ] = "{}s" .format (timeout_sec )
514
520
build_args = ["build" , "-t" , image_uri , "." ]
515
521
516
522
if self .docker_config :
0 commit comments