Fokko commented on PR #8015:
URL: https://github.com/apache/iceberg/pull/8015#issuecomment-1634317651

   Just out curiosity, where are you able to run multi-processing?
   ```
   export PYICEBERG_CONCURRENCY_MODE=process
   ➜  docker-spark-iceberg git:(main) time python3 /tmp/vo.py                  
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py",
 line 116, in spawn_main
       exitcode = _main(fd, parent_sentinel)
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py",
 line 125, in _main
       prepare(preparation_data)
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py",
 line 236, in prepare
       _fixup_main_from_path(data['init_main_from_path'])
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py",
 line 287, in _fixup_main_from_path
       main_content = runpy.run_path(main_path,
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py",
 line 268, in run_path
       return _run_module_code(code, init_globals, run_name,
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py",
 line 97, in _run_module_code
       _run_code(code, mod_globals, init_globals,
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py",
 line 87, in _run_code
       exec(code, run_globals)
     File "/tmp/vo.py", line 11, in <module>
       df = table.scan().to_arrow()
     File 
"/Users/fokkodriesprong/Desktop/iceberg/python/pyiceberg/table/__init__.py", 
line 825, in to_arrow
       self.plan_files(),
     File 
"/Users/fokkodriesprong/Desktop/iceberg/python/pyiceberg/table/__init__.py", 
line 784, in plan_files
       *executor.map(
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/concurrent/futures/process.py",
 line 726, in map
       results = super().map(partial(_process_chunk, fn),
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py",
 line 597, in map
       fs = [self.submit(fn, *args) for args in zip(*iterables)]
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py",
 line 597, in <listcomp>
       fs = [self.submit(fn, *args) for args in zip(*iterables)]
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/concurrent/futures/process.py",
 line 697, in submit
       self._adjust_process_count()
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/concurrent/futures/process.py",
 line 675, in _adjust_process_count
       p.start()
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py",
 line 121, in start
       self._popen = self._Popen(self)
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py",
 line 284, in _Popen
       return Popen(process_obj)
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py",
 line 32, in __init__
       super().__init__(process_obj)
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py",
 line 19, in __init__
       self._launch(process_obj)
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py",
 line 42, in _launch
       prep_data = spawn.get_preparation_data(process_obj._name)
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py",
 line 154, in get_preparation_data
       _check_not_importing_main()
     File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py",
 line 134, in _check_not_importing_main
       raise RuntimeError('''
   RuntimeError: 
           An attempt has been made to start a new process before the
           current process has finished its bootstrapping phase.
   
           This probably means that you are not using fork to start your
           child processes and you have forgotten to use the proper idiom
           in the main module:
   
               if __name__ == '__main__':
                   freeze_support()
                   ...
   
           The "freeze_support()" line can be omitted if the program
           is not going to be frozen to produce an executable.
   ```
   
   Where:
   ```python
   from pyiceberg.catalog import load_catalog
   
   catalog = load_catalog('local')
   
   table = catalog.load_table('nyc.taxis')
   
   expected_rows = 15885533
   
   for _ in range(10):
       df = table.scan().to_arrow()
       assert len(df) == expected_rows, f"Got {len(df)} rows, instead of 
{expected_rows}"
   ```
   
   And local points to my local 
[docker-spark-iceberg](https://github.com/tabular-io/docker-spark-iceberg/tree/main/spark)
 setup, so I don't have S3 latency.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to