mirror of
				https://github.com/clearml/clearml
				synced 2025-06-26 18:16:07 +00:00 
			
		
		
		
	Fix can't write more than 2 GB to a file
This commit is contained in:
		
							parent
							
								
									17dfa2b92f
								
							
						
					
					
						commit
						d723299f1e
					
				| @ -562,8 +562,8 @@ class Artifacts(object): | ||||
|             if serialized_text is not None: | ||||
|                 override_filename_in_uri = name + override_filename_ext_in_uri | ||||
|                 fd, local_filename = mkstemp(prefix=quote(name, safe="") + ".", suffix=override_filename_ext_in_uri) | ||||
|                 os.write(fd, bytes(serialized_text.encode())) | ||||
|                 os.close(fd) | ||||
|                 with open(fd, "w") as f: | ||||
|                     f.write(serialized_text) | ||||
|                 preview = preview or serialized_text | ||||
|                 if len(preview) < self.max_preview_size_bytes: | ||||
|                     artifact_type_data.preview = preview | ||||
|  | ||||
| @ -395,17 +395,14 @@ class EventTrainsWriter(object): | ||||
|                     suffix=guess_extension(im.get_format_mimetype()) if hasattr(im, 'get_format_mimetype') | ||||
|                     else ".{}".format(str(im.format).lower()) | ||||
|                 ) | ||||
|                 os.write(fd, imdata) | ||||
|                 os.close(fd) | ||||
|                 with open(fd, "wb") as f: | ||||
|                     f.write(imdata) | ||||
|                 return temp_file | ||||
| 
 | ||||
|             image = np.asarray(im) | ||||
|             output.close() | ||||
|             if height is not None and height > 0 and width is not None and width > 0: | ||||
|                 # noinspection PyArgumentList | ||||
|                 val = image.reshape(height, width, -1).astype(np.uint8) | ||||
|                 val = np.array(im).reshape((height, width, -1)).astype(np.uint8) | ||||
|             else: | ||||
|                 val = image.astype(np.uint8) | ||||
|                 val = np.array(im).astype(np.uint8) | ||||
|             if val.ndim == 3 and val.shape[2] == 3: | ||||
|                 if self._visualization_mode == 'BGR': | ||||
|                     val = val[:, :, [2, 1, 0]] | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| # -*- coding: utf-8 -*- | ||||
| 
 | ||||
| import os | ||||
| import sys | ||||
| import threading | ||||
| from copy import deepcopy | ||||
| @ -559,8 +558,8 @@ class PatchedMatplotlib: | ||||
|                                       facecolor=None) | ||||
|                     buffer_.seek(0) | ||||
|                 fd, image = mkstemp(suffix='.' + image_format) | ||||
|                 os.write(fd, buffer_.read()) | ||||
|                 os.close(fd) | ||||
|                 with open(fd, "wb") as f: | ||||
|                     f.write(buffer_.read()) | ||||
| 
 | ||||
|             # check if we need to restore the active object | ||||
|             if set_active and not _pylab_helpers.Gcf.get_active() and stored_figure: | ||||
|  | ||||
| @ -1633,8 +1633,8 @@ class Task(_Task): | ||||
|             fd, local_filename = mkstemp(prefix='clearml_task_config_', | ||||
|                                          suffix=configuration_path.suffixes[-1] if | ||||
|                                          configuration_path.suffixes else '.txt') | ||||
|             os.write(fd, configuration_text.encode('utf-8')) | ||||
|             os.close(fd) | ||||
|             with open(fd, "w") as f: | ||||
|                 f.write(configuration_text) | ||||
|             if pathlib_Path: | ||||
|                 return pathlib_Path(local_filename) | ||||
|             return Path(local_filename) if isinstance(configuration, Path) else local_filename | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 allegroai
						allegroai