Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pyspark.InheritableThread as the base thread class for threadpool #32

Open
NivekNey opened this issue Jul 19, 2021 · 1 comment
Open

Comments

@NivekNey
Copy link

NivekNey commented Jul 19, 2021

Context

InheritableThread is a thread class that pyspark provides to support sync between JVM and python threads.

The ThreadPool class used in this package is python's original multiprocessing.pool.ThreadPool.

What goods/bads will it bring? Dunno, I'll start looking around.

Proposal

Without touching this package's source code, a user can already nicely make their own ThreadPool that uses their own Thread class. If this package were to adopt the pyspark Thread class, then the steps may be:

  1. Create a custom DummyProcess that inherits pyspark.InheritableThread.
  2. Create a custom ThreadPool that uses the custom DummyProcess.
  3. Use the custom ThreadPool in this package's SparkDistributedBackend._get_pool method.
@WeichenXu123
Copy link
Collaborator

Yes in future we will switch to it. InheritableThread can avoid memory leak in pyspark pin-thread mode (slightly leak not serious).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants