Skip to content

Instantly share code, notes, and snippets.

@zonca
Last active Aug 23, 2021
Embed
What would you like to do?
Dask on Jupyter at NERSC, this was working in 2019. NOT WORKING NOW, just useful for reference. See links in the comments to official NERSC documentation.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
""
]
}
],
"source": [
"import dask_jobqueue"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/global/homes/z/zonca/condajupynersc/lib/python3.6/site-packages/distributed/deploy/local.py:106: UserWarning: diagnostics_port has been deprecated. Please use `dashboard_address=` instead\n",
" \"diagnostics_port has been deprecated. \"\n"
]
}
],
"source": [
"cluster = dask_jobqueue.SLURMCluster()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"cluster.scale(1)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/global/homes/z/zonca/condajupynersc/lib/python3.6/site-packages/dask_jobqueue/__init__.py'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dask_jobqueue.__file__"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"#!/bin/bash\n",
"\n",
"#!/usr/bin/env bash\n",
"#SBATCH -J dask-worker\n",
"#SBATCH -p interactive\n",
"#SBATCH -n 1\n",
"#SBATCH --cpus-per-task=64\n",
"#SBATCH --mem=115GB\n",
"#SBATCH -t 00:10:00\n",
"#SBATCH -C haswell\n",
"#SBATCH -L project, SCRATCH, cscratch1\n",
"JOB_ID=${SLURM_JOB_ID%;*}\n",
"\n",
"\n",
"\n",
"/global/homes/z/zonca/condajupynersc/bin/python -m distributed.cli.dask_worker tcp://xxx.xxx.xxx.xxx:36667 --nthreads 16 --nprocs 4 --memory-limit 28.75GB --name dask-worker--${JOB_ID}-- --death-timeout 60\n",
"\n"
]
}
],
"source": [
"print(cluster.job_script())"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d850382980eb4d42829b0581e2e9c3df",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HTML(value='<h2>SLURMCluster</h2>'), HBox(children=(HTML(value='\\n<div>\\n <style scoped>\\n …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cluster"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "condajupynersc",
"language": "python",
"name": "condajupynersc"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
@rcthomas
Copy link

Hey @zonca, I just came across this, I don't think this works, right?

@zonca
Copy link
Author

zonca commented Aug 23, 2021

it was definitely working back in 2019, probably doesn't work right now, I'd like to keep it for reference, I'll put a notice in the description!

@rcthomas
Copy link

Maybe you're right, but the interactive qos doesn't allow sbatch and it won't ever again on Cori. For NERSC-specific notes it's probably better to refer to the Center's documentation on how to best leverage the interactive qos with Dask+Jupyter:

Merge requests from users like you to those repos are always welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment