mirror of
				https://github.com/clearml/clearml
				synced 2025-06-26 18:16:07 +00:00 
			
		
		
		
	Fix StorageManager.get_file_size_bytes() returns ClientError instead of None for invalid S3 links
				
					
				
			This commit is contained in:
		
							parent
							
								
									d723299f1e
								
							
						
					
					
						commit
						3dee5854bd
					
				| @ -619,6 +619,13 @@ class StorageHelper(object): | ||||
|             if isinstance(self._driver, _HttpDriver) and obj: | ||||
|                 obj = self._driver._get_download_object(obj)  # noqa | ||||
|                 size = int(obj.headers.get("Content-Length", 0)) | ||||
|             elif isinstance(self._driver, _Boto3Driver) and obj: | ||||
|                 # noinspection PyBroadException | ||||
|                 try: | ||||
|                     # To catch botocore exceptions | ||||
|                     size = obj.content_length  # noqa | ||||
|                 except Exception: | ||||
|                     pass | ||||
|             elif hasattr(obj, "size"): | ||||
|                 size = obj.size | ||||
|                 # Google storage has the option to reload the object to get the size | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 allegroai
						allegroai