Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 12, 2024
1 parent 73dc0de commit b5bf962
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 23 deletions.
44 changes: 30 additions & 14 deletions notebooks/1-local.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"source": [
"%%time\n",
"with Executor(backend=\"local\") as exe:\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(2,5)]\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n",
" print([f.result() for f in future_lst])"
]
},
Expand Down Expand Up @@ -199,8 +199,13 @@
}
],
"source": [
"with Executor(max_workers=1, max_cores=2, resource_dict={\"cores\": 2}, backend=\"local\") as exe:\n",
" fs = exe.submit(calc, 3,)\n",
"with Executor(\n",
" max_workers=1, max_cores=2, resource_dict={\"cores\": 2}, backend=\"local\"\n",
") as exe:\n",
" fs = exe.submit(\n",
" calc,\n",
" 3,\n",
" )\n",
" print(fs.result())"
]
},
Expand Down Expand Up @@ -288,7 +293,7 @@
"source": [
"%%time\n",
"with Executor(backend=\"local\", block_allocation=True) as exe:\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(2,5)]\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n",
" print([f.result() for f in future_lst])"
]
},
Expand Down Expand Up @@ -363,8 +368,17 @@
}
],
"source": [
"with Executor(max_workers=1, max_cores=2, resource_dict={\"cores\": 2}, backend=\"local\", block_allocation=True) as exe:\n",
" fs = exe.submit(calc, 3,)\n",
"with Executor(\n",
" max_workers=1,\n",
" max_cores=2,\n",
" resource_dict={\"cores\": 2},\n",
" backend=\"local\",\n",
" block_allocation=True,\n",
") as exe:\n",
" fs = exe.submit(\n",
" calc,\n",
" 3,\n",
" )\n",
" print(fs.result())"
]
},
Expand Down Expand Up @@ -405,7 +419,9 @@
}
],
"source": [
"with Executor(init_function=init_function, backend=\"local\", block_allocation=True) as exe:\n",
"with Executor(\n",
" init_function=init_function, backend=\"local\", block_allocation=True\n",
") as exe:\n",
" fs = exe.submit(calc, 2, j=5)\n",
" print(fs.result())"
]
Expand Down Expand Up @@ -447,7 +463,7 @@
"source": [
"%%time\n",
"with Executor(backend=\"local\", cache_directory=\"./cache\") as exe:\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(1,4)]\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n",
" print([f.result() for f in future_lst])"
]
},
Expand All @@ -470,7 +486,7 @@
"source": [
"%%time\n",
"with Executor(backend=\"local\", cache_directory=\"./cache\") as exe:\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(1,4)]\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n",
" print([f.result() for f in future_lst])"
]
},
Expand All @@ -490,7 +506,7 @@
],
"source": [
"import os\n",
"import shutil \n",
"import shutil\n",
"\n",
"cache_dir = \"./cache\"\n",
"if os.path.exists(cache_dir):\n",
Expand Down Expand Up @@ -547,10 +563,10 @@
"source": [
"with Executor(backend=\"local\") as exe:\n",
" future = None\n",
" for i in range(1,4):\n",
" for i in range(1, 4):\n",
" if future is None:\n",
" future = exe.submit(add_funct, i, i)\n",
" else: \n",
" else:\n",
" future = exe.submit(add_funct, i, future)\n",
" print(future.result())"
]
Expand Down Expand Up @@ -666,10 +682,10 @@
"source": [
"with Executor(backend=\"local\", plot_dependency_graph=True) as exe:\n",
" future = None\n",
" for i in range(1,4):\n",
" for i in range(1, 4):\n",
" if future is None:\n",
" future = exe.submit(add_funct, i, i)\n",
" else: \n",
" else:\n",
" future = exe.submit(add_funct, i, future)\n",
" print(future.result())"
]
Expand Down
6 changes: 3 additions & 3 deletions notebooks/2-hpc-submission.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"source": [
"%%time\n",
"with Executor(backend=\"pysqa_flux\", cache_directory=\"./cache\") as exe:\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(1,4)]\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n",
" print([f.result() for f in future_lst])"
]
},
Expand Down Expand Up @@ -85,10 +85,10 @@
"source": [
"with Executor(backend=\"pysqa_flux\", cache_directory=\"./cache\") as exe:\n",
" future = None\n",
" for i in range(4,8):\n",
" for i in range(4, 8):\n",
" if future is None:\n",
" future = exe.submit(add_funct, i, i)\n",
" else: \n",
" else:\n",
" future = exe.submit(add_funct, i, future)\n",
" print(future.result())"
]
Expand Down
14 changes: 8 additions & 6 deletions notebooks/3-hpc-allocation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"source": [
"%%time\n",
"with Executor(backend=\"flux\") as exe:\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(2,5)]\n",
" future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n",
" print([f.result() for f in future_lst])"
]
},
Expand Down Expand Up @@ -85,10 +85,10 @@
"source": [
"with Executor(backend=\"flux\") as exe:\n",
" future = None\n",
" for i in range(1,4):\n",
" for i in range(1, 4):\n",
" if future is None:\n",
" future = exe.submit(add_funct, i, i)\n",
" else: \n",
" else:\n",
" future = exe.submit(add_funct, i, future)\n",
" print(future.result())"
]
Expand Down Expand Up @@ -162,9 +162,11 @@
],
"source": [
"with flux.Flux() as handle:\n",
" rs=flux.resource.status.ResourceStatusRPC(handle).get()\n",
" rl=flux.resource.list.resource_list(handle).get()\n",
" print(\"nodes: \",rs.nodelist,\" #cores: \",rl.all.ncores, \" #free: \", rl.free.ncores)"
" rs = flux.resource.status.ResourceStatusRPC(handle).get()\n",
" rl = flux.resource.list.resource_list(handle).get()\n",
" print(\n",
" \"nodes: \", rs.nodelist, \" #cores: \", rl.all.ncores, \" #free: \", rl.free.ncores\n",
" )"
]
},
{
Expand Down

0 comments on commit b5bf962

Please sign in to comment.