Skip to content

Commit c66e9f4

Browse files
committed
wip
1 parent 67a0d40 commit c66e9f4

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed

nanshe_ipython.ipynb

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@
3838
"dataset = \"images\"\n",
3939
"\n",
4040
"num_workers = None\n",
41-
"cluster_kwargs = {}\n",
41+
"cluster_kwargs = {\n",
42+
" \"preexec_commands\": (\n",
43+
" \"singularity exec ~/nanshe_nanshe_workflow_latest.img \\\\\",\n",
44+
" ),\n",
45+
"}\n",
4246
"client_kwargs = {}\n",
4347
"\n",
4448
"\n",
@@ -80,39 +84,7 @@
8084
"metadata": {},
8185
"outputs": [],
8286
"source": [
83-
"import time\n",
84-
"import distributed\n",
85-
"import dask_drmaa\n",
86-
"from nanshe_workflow.par import set_num_workers\n",
87-
"\n",
88-
"\n",
89-
"def startup_distributed(nworkers):\n",
90-
" nworkers = int(nworkers)\n",
91-
"\n",
92-
" if dask_drmaa:\n",
93-
" cluster = dask_drmaa.DRMAACluster(\n",
94-
" preexec_commands=(\n",
95-
" \"singularity exec ~/nanshe_nanshe_workflow_latest.img \\\\\",\n",
96-
" ),\n",
97-
" template={\"jobEnvironment\": os.environ}\n",
98-
" )\n",
99-
" cluster.start_workers(nworkers)\n",
100-
" else:\n",
101-
" # Either `dask_drmaa` is unavailable or DRMAA cannot start.\n",
102-
" # Fallback to a local Distributed client instead.\n",
103-
" cluster = distributed.LocalCluster(\n",
104-
" n_workers=nworkers, threads_per_worker=1\n",
105-
" )\n",
106-
"\n",
107-
" client = distributed.Client(cluster)\n",
108-
" while (\n",
109-
" (client.status == \"running\") and\n",
110-
" (len(client.scheduler_info()[\"workers\"]) < nworkers)\n",
111-
" ):\n",
112-
" time.sleep(1)\n",
113-
"\n",
114-
" return client\n",
115-
"\n",
87+
"from nanshe_workflow.par import set_num_workers, startup_distributed\n",
11688
"\n",
11789
"num_workers = set_num_workers(num_workers)\n",
11890
"\n",

0 commit comments

Comments
 (0)