Skip to main content

Launch Dask from Spark and Spark from Dask. This project is not mature.

Examples

pip install dask-spark

Create Spark cluster from a Dask cluster

>>> from dask.distributed import Client
>>> client = Client('scheduler-address:8786')
>>> client
<Client: scheduler='tcp://scheduler-address:8786' processes=8 cores=64>

>>> from dask_spark import dask_to_spark
>>> sc = dask_to_spark(client)
>>> sc
<pyspark.context.SparkContext at 0x7f62fa4bb550>

Create Dask cluster from a Spark cluster

>>> import pyspark
>>> sc = pyspark.SparkContext('local[4]')
<pyspark.context.SparkContext at 0x7f8b908b0128>

>>> from dask_spark import spark_to_dask
>>> client = spark_to_dask(sc)
>>> client
<Client: scheduler="'tcp://127.0.0.1:8786'">

Requirements and How this Works

This depends on a relatively recent version of Dask.distributed.

For starting Spark from Dask this assumes that you have Spark installed and that the start-master.sh and start-slave.sh Spark scripts are available on the PATH of the workers. This starts a long-running Spark master process on the Dask Scheduler and starts long running Spark slaves on Dask workers. There will only be one slave per worker. We set the number of cores and the amount of memory to match the Dask workers and available memory.

When starting Dask from Spark this will block the Spark cluster. We start a scheduler on the local machine and then run a long-running function that starts up a Dask worker using RDD.mapPartitions.

TODO

  • [ ] This almost certainly fails in non-trivial situations

  • [ ] Enable user specification of Java flags for memory and core use

  • [ ] Support multiple spark clusters per Dask cluster

Release files for dask-spark 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dask-spark 0.0.2
File Size Uploaded
dask-spark-0.0.2.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dask-spark 0.0.2
File Interpreter ABI Platform
dask_spark-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 8.9 kB

Release files / dask-spark-0.0.2.tar.gz

Download URL dask-spark-0.0.2.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cac382297f17cc48308baea9f3277cae46c3a5d3a8ee1be4f68720a10e438a0c
BLAKE2b-256 checksum
How to use checksums
a80ddd3429bba41a7ca00c81b8f9e97baf43439c8d9b4ba4f072d34888905b20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dask_spark-0.0.2-py2.py3-none-any.whl

Download URL dask_spark-0.0.2-py2.py3-none-any.whl
Size 5.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
119c00115f21d793671c385d9ca44e480130374cb40140132cef82517ba3def3
BLAKE2b-256 checksum
How to use checksums
71aa8473e64e11fd8c11374b2d0c7924b678b16a412a0ca858e69cbe85a3450d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page