From b5bf9624e6255001ec10f6156619843b98af69a8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:41:38 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- notebooks/1-local.ipynb | 44 ++++++++++++++++++++++---------- notebooks/2-hpc-submission.ipynb | 6 ++--- notebooks/3-hpc-allocation.ipynb | 14 +++++----- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/notebooks/1-local.ipynb b/notebooks/1-local.ipynb index ac401ca1..bde52e9d 100644 --- a/notebooks/1-local.ipynb +++ b/notebooks/1-local.ipynb @@ -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])" ] }, @@ -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())" ] }, @@ -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])" ] }, @@ -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())" ] }, @@ -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())" ] @@ -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])" ] }, @@ -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])" ] }, @@ -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", @@ -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())" ] @@ -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())" ] diff --git a/notebooks/2-hpc-submission.ipynb b/notebooks/2-hpc-submission.ipynb index b4b2120f..35e643f3 100644 --- a/notebooks/2-hpc-submission.ipynb +++ b/notebooks/2-hpc-submission.ipynb @@ -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])" ] }, @@ -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())" ] diff --git a/notebooks/3-hpc-allocation.ipynb b/notebooks/3-hpc-allocation.ipynb index 96461df8..3bd083ac 100644 --- a/notebooks/3-hpc-allocation.ipynb +++ b/notebooks/3-hpc-allocation.ipynb @@ -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])" ] }, @@ -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())" ] @@ -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", + " )" ] }, {