@@ -82,7 +82,7 @@ class ContainerCodeExecutor(BaseCodeExecutor):
8282
8383 stateful : bool = Field (default = False , frozen = True , exclude = True )
8484
85- optimize_data_file : bool = Field (default = False , frozen = True , exclude = True )
85+ optimize_data_file : bool = Field (default = True , frozen = True , exclude = True )
8686
8787 _client : DockerClient = None
8888 _container : Container = None
@@ -117,10 +117,6 @@ def __init__(
117117 )
118118 if "stateful" in data and data ["stateful" ]:
119119 raise ValueError ("Cannot set `stateful=True` in ContainerCodeExecutor." )
120- if "optimize_data_file" in data and data ["optimize_data_file" ]:
121- raise ValueError (
122- "Cannot set `optimize_data_file=True` in ContainerCodeExecutor."
123- )
124120
125121 super ().__init__ (** data )
126122 self .base_url = base_url
@@ -239,13 +235,16 @@ def _get_output_files(self) -> list[File]:
239235 The list of output files retrieved from the container.
240236 """
241237 try :
242- tar_bytes , stat = self ._container .get_archive (self .output_dir )
238+ tar_stream , _ = self ._container .get_archive (self .output_dir )
243239 except docker .errors .APIError as e :
244240 if e .response .status_code == 404 :
245241 logger .debug ("No output files found at %s" , self .output_dir )
246242 return []
247243 raise
248-
244+ if isinstance (tar_stream , bytes ):
245+ tar_bytes = tar_stream
246+ else :
247+ tar_bytes = b"" .join (tar_stream )
249248 tar_buffer = io .BytesIO (tar_bytes )
250249 output_files = []
251250
0 commit comments