1

I am using the billiard library with docker (in an ubuntu terminal within windows) and when initializing the object without parameters in the constructor it gives me an error. If instead of billiard I use multiprocessing it does work for me (apparently).

My version of python is Python 3.8.6

Other colleagues can execute the library and the code without problems. Does anyone know why it can be?

A possible solution is to replace import billiard as multiprocessing with import multiprocessing. But the library works internally differently as I have been able to read.

The code and the error are as follows

import billiard as multiprocessing
def my_function (df, func, ** kwargs):
      pool = multiprocessing.Pool()
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task
celery_worker_1  |     R = retval = fun(*args, **kwargs)
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__
celery_worker_1  |     return self.run(*args, **kwargs)
celery_worker_1  |   File "/code/datamodel/celery_tasks.py", line 460, in call_to_multiprocesing
celery_worker_1  |     points_df = ObjectWIthMultiprocesing.usingMultiprocesing(files, position.borders[0], row_limit=row_limit)
celery_worker_1  |   File "/code/ObjectWIthMultiprocesing.py", line 387, in usingMultiprocesing
celery_worker_1  |     df['in_position'] = apply_by_multiprocessing(df, calcDist, axis=1, workers=16, poly=poly)
celery_worker_1  |   File "/code/ObjectWIthMultiprocesing.py", line 123, in apply_by_multiprocessing
celery_worker_1  |     pool = multiprocessing.Pool()
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/context.py", line 160, in Pool
celery_worker_1  |     return Pool(processes, initializer, initargs, maxtasksperchild,
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/pool.py", line 1046, in __init__
celery_worker_1  |     self._create_worker_process(i)
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/pool.py", line 1142, in _create_worker_process
celery_worker_1  |     on_ready_counter = self._ctx.Value('i')
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/context.py", line 181, in Value
celery_worker_1  |     return Value(typecode_or_type, *args, lock=lock,
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/sharedctypes.py", line 78, in Value
celery_worker_1  |     obj = RawValue(typecode_or_type, *args)
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/sharedctypes.py", line 46, in RawValue
celery_worker_1  |     obj = _new_value(type_)
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/sharedctypes.py", line 37, in _new_value
celery_worker_1  |     wrapper = heap.BufferWrapper(size)
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/heap.py", line 274, in __init__
celery_worker_1  |     block = BufferWrapper._heap.malloc(size)
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/heap.py", line 255, in malloc
celery_worker_1  |     (arena, start, stop) = self._malloc(size)
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/heap.py", line 152, in _malloc
celery_worker_1  |     arena = Arena(length)
celery_worker_1  |   File "/usr/local/lib/python3.8/site-packages/billiard/heap.py", line 104, in __init__
celery_worker_1  |     self.buffer = mmap.mmap(self.fd, self.size)
celery_worker_1  | FileNotFoundError: [Errno 2] No such file or directory


  [1]: https://stackoverflow.com/questions/54858326/python-multiprocessing-billiard-vs-multiprocessing
Luis
  • 133
  • 6

0 Answers0