Skip to content

s3parq parallel processing issue when fetching non-partitioned files #65

@RyanAdalbert

Description

@RyanAdalbert

Describe the bug

When retrieving a file that was published using s3parq.publish and that did not utilize partitioning, s3parq.fetch becomes stuck in an infinite error loop UNLESS the parallel=False is provided in the s3parq.fetch call.

To Reproduce

Code:

s3parq.publish(bucket=ENV_BUCKET, key=key_filename, partitions=[], dataframe=df_revised_files, redshift_params=None)
s3parq.fetch(bucket=ENV_BUCKET, key=key_filename, filters=[])

Stacktrace:

    df_existing_files = s3parq.fetch(bucket=ENV_BUCKET, key=key_filename, filters=[])
  File "/usr/local/lib/python3.6/site-packages/s3parq/fetch_parq.py", line 176, in fetch
    parallel=parallel)
  File "/usr/local/lib/python3.6/site-packages/s3parq/fetch_parq.py", line 383, in _get_filtered_data
    with get_context("spawn").Pool() as pool:
  File "/usr/local/lib/python3.6/multiprocessing/context.py", line 119, in Pool
    context=self.get_context())
  File "/usr/local/lib/python3.6/multiprocessing/pool.py", line 174, in __init__
    self._repopulate_pool()
  File "/usr/local/lib/python3.6/multiprocessing/pool.py", line 239, in _repopulate_pool
    w.start()
  File "/usr/local/lib/python3.6/multiprocessing/process.py", line 105, in start
    self._popen = self._Popen(self)
  File "/usr/local/lib/python3.6/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/usr/local/lib/python3.6/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/usr/local/lib/python3.6/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/usr/local/lib/python3.6/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/usr/local/lib/python3.6/multiprocessing/spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "/usr/local/lib/python3.6/multiprocessing/spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions