|
69 | 69 | "source": [ |
70 | 70 | "from executorlib import Executor\n", |
71 | 71 | "\n", |
72 | | - "with Executor(max_cores=1, backend=\"flux\") as exe:\n", |
| 72 | + "with Executor(max_cores=1, backend=\"flux_allocation\") as exe:\n", |
73 | 73 | " future = exe.submit(sum, [1, 1])\n", |
74 | 74 | " print(future.result())" |
75 | 75 | ] |
|
103 | 103 | " return sum(*args)\n", |
104 | 104 | "\n", |
105 | 105 | "\n", |
106 | | - "with Executor(max_cores=2, backend=\"flux\") as exe:\n", |
| 106 | + "with Executor(max_cores=2, backend=\"flux_allocation\") as exe:\n", |
107 | 107 | " fs_1 = exe.submit(calc, [2, 1])\n", |
108 | 108 | " fs_2 = exe.submit(calc, [2, 2])\n", |
109 | 109 | " fs_3 = exe.submit(calc, [2, 3])\n", |
|
159 | 159 | " return sum(*args)\n", |
160 | 160 | "\n", |
161 | 161 | "\n", |
162 | | - "with Executor(max_cores=2, backend=\"flux\") as exe:\n", |
| 162 | + "with Executor(max_cores=2, backend=\"flux_allocation\") as exe:\n", |
163 | 163 | " print(list(exe.map(calc, [[2, 1], [2, 2], [2, 3], [2, 4]])))" |
164 | 164 | ] |
165 | 165 | }, |
|
205 | 205 | " with Executor(\n", |
206 | 206 | " # Resource definition on the executor level\n", |
207 | 207 | " max_workers=2, # total number of cores available to the Executor\n", |
208 | | - " backend=\"flux\", # optional in case the backend is not recognized\n", |
| 208 | + " backend=\"flux_allocation\", # optional in case the backend is not recognized\n", |
209 | 209 | " # Optional resource definition\n", |
210 | 210 | " resource_dict={\n", |
211 | 211 | " \"cores\": 1,\n", |
|
277 | 277 | " # Resource definition on the executor level\n", |
278 | 278 | " max_cores=2, # total number of cores available to the Executor\n", |
279 | 279 | " block_allocation=True, # reuse python processes\n", |
280 | | - " backend=\"flux\",\n", |
| 280 | + " backend=\"flux_allocation\",\n", |
281 | 281 | ") as exe:\n", |
282 | 282 | " future_obj = exe.submit(\n", |
283 | 283 | " calc_function,\n", |
|
332 | 332 | "with Executor(\n", |
333 | 333 | " max_cores=1,\n", |
334 | 334 | " init_function=init_function,\n", |
335 | | - " backend=\"flux\",\n", |
| 335 | + " backend=\"flux_allocation\",\n", |
336 | 336 | " block_allocation=True,\n", |
337 | 337 | ") as exe:\n", |
338 | 338 | " fs = exe.submit(calc, 2, j=5)\n", |
|
462 | 462 | "with Executor(\n", |
463 | 463 | " max_cores=2,\n", |
464 | 464 | " resource_dict={\"cores\": 2},\n", |
465 | | - " backend=\"flux\",\n", |
| 465 | + " backend=\"flux_allocation\",\n", |
466 | 466 | " flux_executor_pmi_mode=\"pmix\",\n", |
467 | 467 | ") as exe:\n", |
468 | 468 | " fs = exe.submit(calc, 3)\n", |
|
519 | 519 | "with Executor(\n", |
520 | 520 | " max_workers=2, \n", |
521 | 521 | " gpus_per_worker=1,\n", |
522 | | - " backend=\"flux\",\n", |
| 522 | + " backend=\"flux_allocation\",\n", |
523 | 523 | ") as exe:\n", |
524 | 524 | " fs_1 = exe.submit(get_available_gpus)\n", |
525 | 525 | " fs_2 = exe.submit(get_available_gpus)\n", |
|
627 | 627 | " return parameter_a + parameter_b\n", |
628 | 628 | "\n", |
629 | 629 | "\n", |
630 | | - "with Executor(max_cores=2, backend=\"flux\") as exe:\n", |
| 630 | + "with Executor(max_cores=2, backend=\"flux_allocation\") as exe:\n", |
631 | 631 | " future_1 = exe.submit(\n", |
632 | 632 | " calc_function,\n", |
633 | 633 | " 1,\n", |
|
672 | 672 | "```\n", |
673 | 673 | "from executorlib import Executor\n", |
674 | 674 | "\n", |
675 | | - "with Executor(max_cores=1, backend=\"slurm\") as exe:\n", |
| 675 | + "with Executor(max_cores=1, backend=\"slurm_allocation\") as exe:\n", |
676 | 676 | " future = exe.submit(sum, [1,1])\n", |
677 | 677 | " print(future.result())\n", |
678 | 678 | "```" |
|
683 | 683 | "id": "ae8dd860-f90f-47b4-b3e5-664f5c949350", |
684 | 684 | "metadata": {}, |
685 | 685 | "source": [ |
686 | | - "The `backend=\"slurm\"` parameter is optional as `executorlib` automatically recognizes if [flux framework](https://flux-framework.org)\n", |
| 686 | + "The `backend=\"slurm_allocation\"` parameter is optional as `executorlib` automatically recognizes if [flux framework](https://flux-framework.org)\n", |
687 | 687 | "or SLURM are available. \n", |
688 | 688 | "\n", |
689 | 689 | "In addition, the SLURM backend introduces the `command_line_argument_lst=[]` parameter, which allows the user to provide\n", |
|
0 commit comments