Skip to content

Instantly share code, notes, and snippets.

@ntabris
Created May 22, 2025 21:25
Show Gist options
  • Save ntabris/9666c77e8af9d100bc0d0af37863f9b8 to your computer and use it in GitHub Desktop.
Save ntabris/9666c77e8af9d100bc0d0af37863f9b8 to your computer and use it in GitHub Desktop.
coiled_cluster_from_node.py
### GET CLUSTER AND CLIENT OBJECTS ###
import coiled
cluster = coiled.get_cluster_from_node()
cluster.adapt()
client = cluster.get_client()
print("dask client:", client)
### USER CODE FOLLOWS ###
import dask
# generate random timeseries of data
df = dask.datasets.timeseries(
"1980", "2005", partition_freq="2w"
).persist()
# perform a groupby with an aggregation
result = df.groupby("name").aggregate({"x": "sum", "y": "max"}).compute()
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment