|
293 | 293 | "</svg>\n" |
294 | 294 | ], |
295 | 295 | "text/plain": [ |
296 | | - "<graphviz.graphs.Digraph at 0x28d6ebdab20>" |
| 296 | + "<graphviz.graphs.Digraph at 0x2ef3e70af40>" |
297 | 297 | ] |
298 | 298 | }, |
299 | 299 | "execution_count": 10, |
|
385 | 385 | "</svg>\n" |
386 | 386 | ], |
387 | 387 | "text/plain": [ |
388 | | - "<graphviz.graphs.Digraph at 0x28d6ec1bb80>" |
| 388 | + "<graphviz.graphs.Digraph at 0x2ef3e75f940>" |
389 | 389 | ] |
390 | 390 | }, |
391 | 391 | "execution_count": 12, |
|
465 | 465 | "</svg>\n" |
466 | 466 | ], |
467 | 467 | "text/plain": [ |
468 | | - "<graphviz.graphs.Digraph at 0x28d6eca1880>" |
| 468 | + "<graphviz.graphs.Digraph at 0x2ef3e7e8520>" |
469 | 469 | ] |
470 | 470 | }, |
471 | 471 | "execution_count": 13, |
|
498 | 498 | "Job1 triggers Job2 and Job3, and Job4 is waiting for both Job2 and Job3 to complete." |
499 | 499 | ] |
500 | 500 | }, |
501 | | - { |
502 | | - "cell_type": "code", |
503 | | - "execution_count": 17, |
504 | | - "metadata": {}, |
505 | | - "outputs": [ |
506 | | - { |
507 | | - "data": { |
508 | | - "image/svg+xml": [ |
509 | | - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", |
510 | | - "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", |
511 | | - " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", |
512 | | - "<!-- Generated by graphviz version 8.0.2 (20230410.1723)\n", |
513 | | - " -->\n", |
514 | | - "<!-- Title: root Pages: 1 -->\n", |
515 | | - "<svg width=\"284pt\" height=\"153pt\"\n", |
516 | | - " 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", |
517 | | - "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 149)\">\n", |
518 | | - "<title>root</title>\n", |
519 | | - "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-149 279.58,-149 279.58,4 -4,4\"/>\n", |
520 | | - "<g id=\"clust1\" class=\"cluster\">\n", |
521 | | - "<title>cluster_0</title>\n", |
522 | | - "<polygon fill=\"none\" stroke=\"black\" points=\"8,-8 8,-137 267.58,-137 267.58,-8 8,-8\"/>\n", |
523 | | - "<text text-anchor=\"middle\" x=\"137.79\" y=\"-121.8\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">ChainedJobs</text>\n", |
524 | | - "</g>\n", |
525 | | - "<!-- ChainedJobs/Job1 -->\n", |
526 | | - "<g id=\"node1\" class=\"node\">\n", |
527 | | - "<title>ChainedJobs/Job1</title>\n", |
528 | | - "<ellipse fill=\"none\" stroke=\"black\" cx=\"44.6\" cy=\"-61\" rx=\"28.7\" ry=\"18\"/>\n", |
529 | | - "<text text-anchor=\"middle\" x=\"44.6\" y=\"-57.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">Job1</text>\n", |
530 | | - "</g>\n", |
531 | | - "<!-- ChainedJobs/Job2 -->\n", |
532 | | - "<g id=\"node2\" class=\"node\">\n", |
533 | | - "<title>ChainedJobs/Job2</title>\n", |
534 | | - "<ellipse fill=\"none\" stroke=\"black\" cx=\"137.79\" cy=\"-34\" rx=\"28.7\" ry=\"18\"/>\n", |
535 | | - "<text text-anchor=\"middle\" x=\"137.79\" y=\"-30.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">Job2</text>\n", |
536 | | - "</g>\n", |
537 | | - "<!-- ChainedJobs/Job1->ChainedJobs/Job2 -->\n", |
538 | | - "<g id=\"edge1\" class=\"edge\">\n", |
539 | | - "<title>ChainedJobs/Job1->ChainedJobs/Job2</title>\n", |
540 | | - "<path fill=\"none\" stroke=\"black\" d=\"M71,-53.48C80.21,-50.75 90.8,-47.62 100.75,-44.67\"/>\n", |
541 | | - "<polygon fill=\"black\" stroke=\"black\" points=\"101.61,-47.77 110.21,-41.57 99.63,-41.06 101.61,-47.77\"/>\n", |
542 | | - "</g>\n", |
543 | | - "<!-- ChainedJobs/Job3 -->\n", |
544 | | - "<g id=\"node3\" class=\"node\">\n", |
545 | | - "<title>ChainedJobs/Job3</title>\n", |
546 | | - "<ellipse fill=\"none\" stroke=\"black\" cx=\"137.79\" cy=\"-88\" rx=\"28.7\" ry=\"18\"/>\n", |
547 | | - "<text text-anchor=\"middle\" x=\"137.79\" y=\"-84.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">Job3</text>\n", |
548 | | - "</g>\n", |
549 | | - "<!-- ChainedJobs/Job1->ChainedJobs/Job3 -->\n", |
550 | | - "<g id=\"edge2\" class=\"edge\">\n", |
551 | | - "<title>ChainedJobs/Job1->ChainedJobs/Job3</title>\n", |
552 | | - "<path fill=\"none\" stroke=\"black\" d=\"M71,-68.52C80.21,-71.25 90.8,-74.38 100.75,-77.33\"/>\n", |
553 | | - "<polygon fill=\"black\" stroke=\"black\" points=\"99.63,-80.94 110.21,-80.43 101.61,-74.23 99.63,-80.94\"/>\n", |
554 | | - "</g>\n", |
555 | | - "<!-- ChainedJobs/Job4 -->\n", |
556 | | - "<g id=\"node4\" class=\"node\">\n", |
557 | | - "<title>ChainedJobs/Job4</title>\n", |
558 | | - "<ellipse fill=\"none\" stroke=\"black\" cx=\"230.99\" cy=\"-61\" rx=\"28.7\" ry=\"18\"/>\n", |
559 | | - "<text text-anchor=\"middle\" x=\"230.99\" y=\"-57.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">Job4</text>\n", |
560 | | - "</g>\n", |
561 | | - "<!-- ChainedJobs/Job2->ChainedJobs/Job4 -->\n", |
562 | | - "<g id=\"edge3\" class=\"edge\">\n", |
563 | | - "<title>ChainedJobs/Job2->ChainedJobs/Job4</title>\n", |
564 | | - "<path fill=\"none\" stroke=\"black\" d=\"M164.2,-41.52C173.41,-44.25 184,-47.38 193.95,-50.33\"/>\n", |
565 | | - "<polygon fill=\"black\" stroke=\"black\" points=\"192.82,-53.94 203.4,-53.43 194.81,-47.23 192.82,-53.94\"/>\n", |
566 | | - "</g>\n", |
567 | | - "<!-- ChainedJobs/Job3->ChainedJobs/Job4 -->\n", |
568 | | - "<g id=\"edge4\" class=\"edge\">\n", |
569 | | - "<title>ChainedJobs/Job3->ChainedJobs/Job4</title>\n", |
570 | | - "<path fill=\"none\" stroke=\"black\" d=\"M164.2,-80.48C173.41,-77.75 184,-74.62 193.95,-71.67\"/>\n", |
571 | | - "<polygon fill=\"black\" stroke=\"black\" points=\"194.81,-74.77 203.4,-68.57 192.82,-68.06 194.81,-74.77\"/>\n", |
572 | | - "</g>\n", |
573 | | - "</g>\n", |
574 | | - "</svg>\n" |
575 | | - ], |
576 | | - "text/plain": [ |
577 | | - "<graphviz.graphs.Digraph at 0x28d6ecb5220>" |
578 | | - ] |
579 | | - }, |
580 | | - "execution_count": 17, |
581 | | - "metadata": {}, |
582 | | - "output_type": "execute_result" |
583 | | - } |
584 | | - ], |
585 | | - "source": [ |
586 | | - "\n", |
587 | | - "def chain_jobs(jobs, inpath='ChainedJobs'):\n", |
588 | | - " workflow.chain(jobs, inpath=inpath)\n", |
589 | | - " \n", |
590 | | - "chains = [\n", |
591 | | - " [JobCommand('Job1', command='echo Hello1'), JobCommand('Job2', command='echo Hello2')],\n", |
592 | | - " [JobCommand('Job1', command='echo Hello1'), JobCommand('Job3', command='echo Hello3')],\n", |
593 | | - " [JobCommand('Job2', command='echo Hello2'), JobCommand('Job4', command='echo Hello4')],\n", |
594 | | - " [JobCommand('Job3', command='echo Hello3'), JobCommand('Job4', command='echo Hello4')]\n", |
595 | | - "] \n", |
596 | | - "\n", |
597 | | - "for job_chain in chains:\n", |
598 | | - " chain_jobs(job_chain)\n", |
599 | | - "\n", |
600 | | - "get_graph(workflow)" |
601 | | - ] |
602 | | - }, |
603 | | - { |
604 | | - "cell_type": "markdown", |
605 | | - "metadata": {}, |
606 | | - "source": [ |
607 | | - "Here's an example for the same scenario using separate triggers:" |
608 | | - ] |
609 | | - }, |
610 | 501 | { |
611 | 502 | "cell_type": "code", |
612 | 503 | "execution_count": 14, |
|
683 | 574 | "</svg>\n" |
684 | 575 | ], |
685 | 576 | "text/plain": [ |
686 | | - "<graphviz.graphs.Digraph at 0x28d6ecb5250>" |
| 577 | + "<graphviz.graphs.Digraph at 0x2ef3e805220>" |
687 | 578 | ] |
688 | 579 | }, |
689 | 580 | "execution_count": 14, |
|
692 | 583 | } |
693 | 584 | ], |
694 | 585 | "source": [ |
695 | | - " \n", |
| 586 | + "workflow.clear_all()\n", |
696 | 587 | "\n", |
697 | 588 | "workflow.chain(\n", |
698 | 589 | " [\n", |
|
0 commit comments