Skip to content

Instantly share code, notes, and snippets.

@mGalarnyk
Last active February 17, 2021 20:34
Show Gist options
  • Save mGalarnyk/631822141afd8de1cefa80fcd5e558e5 to your computer and use it in GitHub Desktop.
Save mGalarnyk/631822141afd8de1cefa80fcd5e558e5 to your computer and use it in GitHub Desktop.
import ray
import raydp
ray.init()
@ray.remote
class PySparkDriver:
def __init__(self):
self.spark = raydp.init_spark(
app_name='RayDP example',
num_executors=2,
executor_cores=2,
executor_memory='4GB')
def foo(self):
return self.spark.range(1000).repartition(10).count()
driver = PySparkDriver.remote()
print(ray.get(driver.foo.remote()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment