|
18 | 18 | }, |
19 | 19 | { |
20 | 20 | "cell_type": "code", |
21 | | - "execution_count": 1, |
| 21 | + "execution_count": 18, |
22 | 22 | "metadata": {}, |
23 | 23 | "outputs": [], |
24 | 24 | "source": [ |
|
29 | 29 | }, |
30 | 30 | { |
31 | 31 | "cell_type": "code", |
32 | | - "execution_count": 2, |
| 32 | + "execution_count": 19, |
33 | 33 | "metadata": {}, |
34 | 34 | "outputs": [], |
35 | 35 | "source": [ |
|
54 | 54 | }, |
55 | 55 | { |
56 | 56 | "cell_type": "code", |
57 | | - "execution_count": 3, |
| 57 | + "execution_count": 20, |
58 | 58 | "metadata": {}, |
59 | 59 | "outputs": [], |
60 | 60 | "source": [ |
|
78 | 78 | }, |
79 | 79 | { |
80 | 80 | "cell_type": "code", |
81 | | - "execution_count": 4, |
| 81 | + "execution_count": 21, |
82 | 82 | "metadata": {}, |
83 | 83 | "outputs": [ |
84 | 84 | { |
|
87 | 87 | "'MyFirstFolder/MyFirstJob'" |
88 | 88 | ] |
89 | 89 | }, |
90 | | - "execution_count": 4, |
| 90 | + "execution_count": 21, |
91 | 91 | "metadata": {}, |
92 | 92 | "output_type": "execute_result" |
93 | 93 | } |
|
111 | 111 | }, |
112 | 112 | { |
113 | 113 | "cell_type": "code", |
114 | | - "execution_count": 5, |
| 114 | + "execution_count": 22, |
115 | 115 | "metadata": {}, |
116 | 116 | "outputs": [ |
117 | 117 | { |
|
138 | 138 | }, |
139 | 139 | { |
140 | 140 | "cell_type": "code", |
141 | | - "execution_count": 6, |
| 141 | + "execution_count": 23, |
142 | 142 | "metadata": {}, |
143 | 143 | "outputs": [ |
144 | 144 | { |
|
167 | 167 | }, |
168 | 168 | { |
169 | 169 | "cell_type": "code", |
170 | | - "execution_count": 7, |
| 170 | + "execution_count": 24, |
171 | 171 | "metadata": {}, |
172 | 172 | "outputs": [], |
173 | 173 | "source": [ |
|
178 | 178 | }, |
179 | 179 | { |
180 | 180 | "cell_type": "code", |
181 | | - "execution_count": 8, |
| 181 | + "execution_count": 25, |
182 | 182 | "metadata": {}, |
183 | 183 | "outputs": [ |
184 | 184 | { |
|
223 | 223 | }, |
224 | 224 | { |
225 | 225 | "cell_type": "code", |
226 | | - "execution_count": 9, |
| 226 | + "execution_count": 26, |
227 | 227 | "metadata": {}, |
228 | 228 | "outputs": [], |
229 | 229 | "source": [ |
|
255 | 255 | }, |
256 | 256 | { |
257 | 257 | "cell_type": "code", |
258 | | - "execution_count": 10, |
| 258 | + "execution_count": 27, |
259 | 259 | "metadata": {}, |
260 | 260 | "outputs": [ |
261 | 261 | { |
|
293 | 293 | "</svg>\n" |
294 | 294 | ], |
295 | 295 | "text/plain": [ |
296 | | - "<graphviz.graphs.Digraph at 0x2ef3e70af40>" |
| 296 | + "<graphviz.graphs.Digraph at 0x28d6ba39e20>" |
297 | 297 | ] |
298 | 298 | }, |
299 | | - "execution_count": 10, |
| 299 | + "execution_count": 27, |
300 | 300 | "metadata": {}, |
301 | 301 | "output_type": "execute_result" |
302 | 302 | } |
|
323 | 323 | }, |
324 | 324 | { |
325 | 325 | "cell_type": "code", |
326 | | - "execution_count": 11, |
| 326 | + "execution_count": 28, |
327 | 327 | "metadata": {}, |
328 | 328 | "outputs": [ |
329 | 329 | { |
|
341 | 341 | }, |
342 | 342 | { |
343 | 343 | "cell_type": "code", |
344 | | - "execution_count": 12, |
| 344 | + "execution_count": 29, |
345 | 345 | "metadata": {}, |
346 | 346 | "outputs": [ |
347 | 347 | { |
|
385 | 385 | "</svg>\n" |
386 | 386 | ], |
387 | 387 | "text/plain": [ |
388 | | - "<graphviz.graphs.Digraph at 0x2ef3e75f940>" |
| 388 | + "<graphviz.graphs.Digraph at 0x28d6ebda3a0>" |
389 | 389 | ] |
390 | 390 | }, |
391 | | - "execution_count": 12, |
| 391 | + "execution_count": 29, |
392 | 392 | "metadata": {}, |
393 | 393 | "output_type": "execute_result" |
394 | 394 | } |
|
409 | 409 | }, |
410 | 410 | { |
411 | 411 | "cell_type": "code", |
412 | | - "execution_count": 13, |
| 412 | + "execution_count": 30, |
413 | 413 | "metadata": {}, |
414 | 414 | "outputs": [ |
415 | 415 | { |
|
465 | 465 | "</svg>\n" |
466 | 466 | ], |
467 | 467 | "text/plain": [ |
468 | | - "<graphviz.graphs.Digraph at 0x2ef3e7e8520>" |
| 468 | + "<graphviz.graphs.Digraph at 0x28d6ecb58b0>" |
469 | 469 | ] |
470 | 470 | }, |
471 | | - "execution_count": 13, |
| 471 | + "execution_count": 30, |
472 | 472 | "metadata": {}, |
473 | 473 | "output_type": "execute_result" |
474 | 474 | } |
|
500 | 500 | }, |
501 | 501 | { |
502 | 502 | "cell_type": "code", |
503 | | - "execution_count": 14, |
| 503 | + "execution_count": 32, |
504 | 504 | "metadata": {}, |
505 | 505 | "outputs": [ |
506 | 506 | { |
|
574 | 574 | "</svg>\n" |
575 | 575 | ], |
576 | 576 | "text/plain": [ |
577 | | - "<graphviz.graphs.Digraph at 0x2ef3e805220>" |
| 577 | + "<graphviz.graphs.Digraph at 0x28d6ec1b880>" |
578 | 578 | ] |
579 | 579 | }, |
580 | | - "execution_count": 14, |
| 580 | + "execution_count": 32, |
| 581 | + "metadata": {}, |
| 582 | + "output_type": "execute_result" |
| 583 | + } |
| 584 | + ], |
| 585 | + "source": [ |
| 586 | + "workflow.clear_all()\n", |
| 587 | + "\n", |
| 588 | + "def chain_jobs(jobs, inpath='ChainedJobs'):\n", |
| 589 | + " workflow.chain(jobs, inpath=inpath)\n", |
| 590 | + "\n", |
| 591 | + "chains = [\n", |
| 592 | + " [JobCommand('Job1', command='echo Hello1'), JobCommand('Job2', command='echo Hello2')],\n", |
| 593 | + " [JobCommand('Job1', command='echo Hello1'), JobCommand('Job3', command='echo Hello3')],\n", |
| 594 | + " [JobCommand('Job2', command='echo Hello2'), JobCommand('Job4', command='echo Hello4')],\n", |
| 595 | + " [JobCommand('Job3', command='echo Hello3'), JobCommand('Job4', command='echo Hello4')]\n", |
| 596 | + "]\n", |
| 597 | + "\n", |
| 598 | + "for job_chain in chains:\n", |
| 599 | + " chain_jobs(job_chain)\n", |
| 600 | + "\n", |
| 601 | + "get_graph(workflow)" |
| 602 | + ] |
| 603 | + }, |
| 604 | + { |
| 605 | + "cell_type": "markdown", |
| 606 | + "metadata": {}, |
| 607 | + "source": [ |
| 608 | + "Here’s an example for the same scenario using separate triggers:" |
| 609 | + ] |
| 610 | + }, |
| 611 | + { |
| 612 | + "cell_type": "code", |
| 613 | + "execution_count": 33, |
| 614 | + "metadata": {}, |
| 615 | + "outputs": [ |
| 616 | + { |
| 617 | + "data": { |
| 618 | + "image/svg+xml": [ |
| 619 | + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", |
| 620 | + "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", |
| 621 | + " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", |
| 622 | + "<!-- Generated by graphviz version 8.0.2 (20230410.1723)\n", |
| 623 | + " -->\n", |
| 624 | + "<!-- Title: root Pages: 1 -->\n", |
| 625 | + "<svg width=\"284pt\" height=\"153pt\"\n", |
| 626 | + " viewBox=\"0.00 0.00 283.58 153.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", |
| 627 | + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 149)\">\n", |
| 628 | + "<title>root</title>\n", |
| 629 | + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-149 279.58,-149 279.58,4 -4,4\"/>\n", |
| 630 | + "<g id=\"clust1\" class=\"cluster\">\n", |
| 631 | + "<title>cluster_0</title>\n", |
| 632 | + "<polygon fill=\"none\" stroke=\"black\" points=\"8,-8 8,-137 267.58,-137 267.58,-8 8,-8\"/>\n", |
| 633 | + "<text text-anchor=\"middle\" x=\"137.79\" y=\"-121.8\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">ChainedJobs</text>\n", |
| 634 | + "</g>\n", |
| 635 | + "<!-- ChainedJobs/Job1 -->\n", |
| 636 | + "<g id=\"node1\" class=\"node\">\n", |
| 637 | + "<title>ChainedJobs/Job1</title>\n", |
| 638 | + "<ellipse fill=\"none\" stroke=\"black\" cx=\"44.6\" cy=\"-61\" rx=\"28.7\" ry=\"18\"/>\n", |
| 639 | + "<text text-anchor=\"middle\" x=\"44.6\" y=\"-57.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">Job1</text>\n", |
| 640 | + "</g>\n", |
| 641 | + "<!-- ChainedJobs/Job2 -->\n", |
| 642 | + "<g id=\"node2\" class=\"node\">\n", |
| 643 | + "<title>ChainedJobs/Job2</title>\n", |
| 644 | + "<ellipse fill=\"none\" stroke=\"black\" cx=\"137.79\" cy=\"-34\" rx=\"28.7\" ry=\"18\"/>\n", |
| 645 | + "<text text-anchor=\"middle\" x=\"137.79\" y=\"-30.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">Job2</text>\n", |
| 646 | + "</g>\n", |
| 647 | + "<!-- ChainedJobs/Job1->ChainedJobs/Job2 -->\n", |
| 648 | + "<g id=\"edge1\" class=\"edge\">\n", |
| 649 | + "<title>ChainedJobs/Job1->ChainedJobs/Job2</title>\n", |
| 650 | + "<path fill=\"none\" stroke=\"black\" d=\"M71,-53.48C80.21,-50.75 90.8,-47.62 100.75,-44.67\"/>\n", |
| 651 | + "<polygon fill=\"black\" stroke=\"black\" points=\"101.61,-47.77 110.21,-41.57 99.63,-41.06 101.61,-47.77\"/>\n", |
| 652 | + "</g>\n", |
| 653 | + "<!-- ChainedJobs/Job3 -->\n", |
| 654 | + "<g id=\"node3\" class=\"node\">\n", |
| 655 | + "<title>ChainedJobs/Job3</title>\n", |
| 656 | + "<ellipse fill=\"none\" stroke=\"black\" cx=\"137.79\" cy=\"-88\" rx=\"28.7\" ry=\"18\"/>\n", |
| 657 | + "<text text-anchor=\"middle\" x=\"137.79\" y=\"-84.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">Job3</text>\n", |
| 658 | + "</g>\n", |
| 659 | + "<!-- ChainedJobs/Job1->ChainedJobs/Job3 -->\n", |
| 660 | + "<g id=\"edge2\" class=\"edge\">\n", |
| 661 | + "<title>ChainedJobs/Job1->ChainedJobs/Job3</title>\n", |
| 662 | + "<path fill=\"none\" stroke=\"black\" d=\"M71,-68.52C80.21,-71.25 90.8,-74.38 100.75,-77.33\"/>\n", |
| 663 | + "<polygon fill=\"black\" stroke=\"black\" points=\"99.63,-80.94 110.21,-80.43 101.61,-74.23 99.63,-80.94\"/>\n", |
| 664 | + "</g>\n", |
| 665 | + "<!-- ChainedJobs/Job4 -->\n", |
| 666 | + "<g id=\"node4\" class=\"node\">\n", |
| 667 | + "<title>ChainedJobs/Job4</title>\n", |
| 668 | + "<ellipse fill=\"none\" stroke=\"black\" cx=\"230.99\" cy=\"-61\" rx=\"28.7\" ry=\"18\"/>\n", |
| 669 | + "<text text-anchor=\"middle\" x=\"230.99\" y=\"-57.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">Job4</text>\n", |
| 670 | + "</g>\n", |
| 671 | + "<!-- ChainedJobs/Job2->ChainedJobs/Job4 -->\n", |
| 672 | + "<g id=\"edge3\" class=\"edge\">\n", |
| 673 | + "<title>ChainedJobs/Job2->ChainedJobs/Job4</title>\n", |
| 674 | + "<path fill=\"none\" stroke=\"black\" d=\"M164.2,-41.52C173.41,-44.25 184,-47.38 193.95,-50.33\"/>\n", |
| 675 | + "<polygon fill=\"black\" stroke=\"black\" points=\"192.82,-53.94 203.4,-53.43 194.81,-47.23 192.82,-53.94\"/>\n", |
| 676 | + "</g>\n", |
| 677 | + "<!-- ChainedJobs/Job3->ChainedJobs/Job4 -->\n", |
| 678 | + "<g id=\"edge4\" class=\"edge\">\n", |
| 679 | + "<title>ChainedJobs/Job3->ChainedJobs/Job4</title>\n", |
| 680 | + "<path fill=\"none\" stroke=\"black\" d=\"M164.2,-80.48C173.41,-77.75 184,-74.62 193.95,-71.67\"/>\n", |
| 681 | + "<polygon fill=\"black\" stroke=\"black\" points=\"194.81,-74.77 203.4,-68.57 192.82,-68.06 194.81,-74.77\"/>\n", |
| 682 | + "</g>\n", |
| 683 | + "</g>\n", |
| 684 | + "</svg>\n" |
| 685 | + ], |
| 686 | + "text/plain": [ |
| 687 | + "<graphviz.graphs.Digraph at 0x28d6ecd0880>" |
| 688 | + ] |
| 689 | + }, |
| 690 | + "execution_count": 33, |
581 | 691 | "metadata": {}, |
582 | 692 | "output_type": "execute_result" |
583 | 693 | } |
|
636 | 746 | }, |
637 | 747 | { |
638 | 748 | "cell_type": "code", |
639 | | - "execution_count": 15, |
| 749 | + "execution_count": 34, |
640 | 750 | "metadata": {}, |
641 | 751 | "outputs": [ |
642 | 752 | { |
|
687 | 797 | }, |
688 | 798 | { |
689 | 799 | "cell_type": "code", |
690 | | - "execution_count": 16, |
| 800 | + "execution_count": 35, |
691 | 801 | "metadata": {}, |
692 | 802 | "outputs": [ |
693 | 803 | { |
|
0 commit comments