/usr/share/doc/python-futurist-doc/html/reference/index.html is in python-futurist-doc 1.6.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<title>OpenStack Docs: API Reference</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="../_static/css/bootstrap.min.css" rel="stylesheet">
<!-- Pygments CSS -->
<link href="../_static/css/native.css" rel="stylesheet">
<!-- Fonts -->
<link href="../_static/css/font-awesome.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="../_static/css/combined.css" rel="stylesheet">
</head>
<body>
<!-- SOURCE_FILE: https://git.openstack.org/cgit/openstack/futurist/tree/doc/source/reference/index.rst -->
<script type="text/javascript">
(function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
(w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
})(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');
_st('install','aDn5L_vgZ2yzRcE893kK','2.0.0');
</script>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button class="navbar-toggle" data-target="#bs-example-navbar-collapse-1" data-toggle="collapse" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="brand-wrapper">
<a class="navbar-brand" href="index.html"></a>
</div>
</div>
</div>
<!-- /.container -->
</nav>
<div class="container docs-book-wrapper">
<div class="row">
<div class="col-lg-9 col-md-8 col-sm-8 col-lg-push-3 col-md-push-4 col-sm-push-4">
<div class="row">
<div class="col-lg-8">
<h2>API Reference</h2>
</div>
<div class="docs-actions">
<a href="../user/history.html"><i class="fa fa-angle-double-left" data-toggle="tooltip" data-placement="top" title="Previous: CHANGES"></i></a>
<a href="../install/index.html"><i class="fa fa-angle-double-right" data-toggle="tooltip" data-placement="top" title="Next: Installation"></i></a>
<a id="logABugLink1" href="" target="_blank" title="Found an error? Report a bug against this page"><i class="fa fa-bug" data-toggle="tooltip" data-placement="top" title="Report a Bug"></i></a>
</div>
</div>
<div class="row docs-byline">
<div class="docs-updated">updated: 2018-01-24 15:40</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="docs-body">
<div class="section" id="api-reference">
<h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h1>
<div class="section" id="executors">
<h2>Executors<a class="headerlink" href="#executors" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="futurist.GreenThreadPoolExecutor">
<em class="property">class </em><code class="descclassname">futurist.</code><code class="descname">GreenThreadPoolExecutor</code><span class="sig-paren">(</span><em>max_workers=1000</em>, <em>check_and_reject=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.GreenThreadPoolExecutor" title="Permalink to this definition">¶</a></dt>
<dd><p>Executor that uses a green thread pool to execute calls asynchronously.</p>
<p>See: <a class="reference external" href="https://docs.python.org/dev/library/concurrent.futures.html">https://docs.python.org/dev/library/concurrent.futures.html</a>
and <a class="reference external" href="http://eventlet.net/doc/modules/greenpool.html">http://eventlet.net/doc/modules/greenpool.html</a> for information on
how this works.</p>
<p>It gathers statistics about the submissions executed for post-analysis…</p>
<dl class="method">
<dt id="futurist.GreenThreadPoolExecutor.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>max_workers=1000</em>, <em>check_and_reject=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.GreenThreadPoolExecutor.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes a green thread pool executor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>max_workers</strong> (<em>int</em>) – maximum number of workers that can be
simulatenously active at the same time, further
submitted work will be queued up when this limit
is reached.</li>
<li><strong>check_and_reject</strong> (<em>callback</em>) – a callback function that will be provided
two position arguments, the first argument
will be this executor instance, and the second
will be the number of currently queued work
items in this executors backlog; the callback
should raise a <a class="reference internal" href="#futurist.RejectedSubmission" title="futurist.RejectedSubmission"><code class="xref py py-class docutils literal"><span class="pre">RejectedSubmission</span></code></a>
exception if it wants to have this submission
rejected.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="futurist.GreenThreadPoolExecutor.alive">
<code class="descname">alive</code><a class="headerlink" href="#futurist.GreenThreadPoolExecutor.alive" title="Permalink to this definition">¶</a></dt>
<dd><p>Accessor to determine if the executor is alive/active.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.GreenThreadPoolExecutor.statistics">
<code class="descname">statistics</code><a class="headerlink" href="#futurist.GreenThreadPoolExecutor.statistics" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference internal" href="#futurist.ExecutorStatistics" title="futurist.ExecutorStatistics"><code class="xref py py-class docutils literal"><span class="pre">ExecutorStatistics</span></code></a> about the executors executions.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.GreenThreadPoolExecutor.submit">
<code class="descname">submit</code><span class="sig-paren">(</span><em>fn</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.GreenThreadPoolExecutor.submit" title="Permalink to this definition">¶</a></dt>
<dd><p>Submit some work to be executed (and gather statistics).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>args</strong> (<em>list</em>) – non-keyworded arguments</li>
<li><strong>kwargs</strong> (<em>dictionary</em>) – key-value arguments</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="futurist.ProcessPoolExecutor">
<em class="property">class </em><code class="descclassname">futurist.</code><code class="descname">ProcessPoolExecutor</code><span class="sig-paren">(</span><em>max_workers=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.ProcessPoolExecutor" title="Permalink to this definition">¶</a></dt>
<dd><p>Executor that uses a process pool to execute calls asynchronously.</p>
<p>It gathers statistics about the submissions executed for post-analysis…</p>
<p>See: <a class="reference external" href="https://docs.python.org/dev/library/concurrent.futures.html">https://docs.python.org/dev/library/concurrent.futures.html</a></p>
<dl class="attribute">
<dt id="futurist.ProcessPoolExecutor.alive">
<code class="descname">alive</code><a class="headerlink" href="#futurist.ProcessPoolExecutor.alive" title="Permalink to this definition">¶</a></dt>
<dd><p>Accessor to determine if the executor is alive/active.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.ProcessPoolExecutor.statistics">
<code class="descname">statistics</code><a class="headerlink" href="#futurist.ProcessPoolExecutor.statistics" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference internal" href="#futurist.ExecutorStatistics" title="futurist.ExecutorStatistics"><code class="xref py py-class docutils literal"><span class="pre">ExecutorStatistics</span></code></a> about the executors executions.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.ProcessPoolExecutor.submit">
<code class="descname">submit</code><span class="sig-paren">(</span><em>fn</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.ProcessPoolExecutor.submit" title="Permalink to this definition">¶</a></dt>
<dd><p>Submit some work to be executed (and gather statistics).</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="futurist.SynchronousExecutor">
<em class="property">class </em><code class="descclassname">futurist.</code><code class="descname">SynchronousExecutor</code><span class="sig-paren">(</span><em>green=False</em>, <em>run_work_func=<function <lambda>></em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.SynchronousExecutor" title="Permalink to this definition">¶</a></dt>
<dd><p>Executor that uses the caller to execute calls synchronously.</p>
<p>This provides an interface to a caller that looks like an executor but
will execute the calls inside the caller thread instead of executing it
in a external process/thread for when this type of functionality is
useful to provide…</p>
<p>It gathers statistics about the submissions executed for post-analysis…</p>
<dl class="method">
<dt id="futurist.SynchronousExecutor.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>green=False</em>, <em>run_work_func=<function <lambda>></em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.SynchronousExecutor.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Synchronous executor constructor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>green</strong> (<em>bool</em>) – when enabled this forces the usage of greened lock
classes and green futures (so that the internals of this
object operate correctly under eventlet)</li>
<li><strong>run_work_func</strong> – callable that takes a single work item and
runs it (typically in a blocking manner)</li>
<li><strong>run_work_func</strong> – callable</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="futurist.SynchronousExecutor.alive">
<code class="descname">alive</code><a class="headerlink" href="#futurist.SynchronousExecutor.alive" title="Permalink to this definition">¶</a></dt>
<dd><p>Accessor to determine if the executor is alive/active.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.SynchronousExecutor.restart">
<code class="descname">restart</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.SynchronousExecutor.restart" title="Permalink to this definition">¶</a></dt>
<dd><p>Restarts this executor (<em>iff</em> previously shutoff/shutdown).</p>
<p>NOTE(harlowja): clears any previously gathered statistics.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.SynchronousExecutor.statistics">
<code class="descname">statistics</code><a class="headerlink" href="#futurist.SynchronousExecutor.statistics" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference internal" href="#futurist.ExecutorStatistics" title="futurist.ExecutorStatistics"><code class="xref py py-class docutils literal"><span class="pre">ExecutorStatistics</span></code></a> about the executors executions.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.SynchronousExecutor.submit">
<code class="descname">submit</code><span class="sig-paren">(</span><em>fn</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.SynchronousExecutor.submit" title="Permalink to this definition">¶</a></dt>
<dd><p>Submit some work to be executed (and gather statistics).</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="futurist.ThreadPoolExecutor">
<em class="property">class </em><code class="descclassname">futurist.</code><code class="descname">ThreadPoolExecutor</code><span class="sig-paren">(</span><em>max_workers=None</em>, <em>check_and_reject=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.ThreadPoolExecutor" title="Permalink to this definition">¶</a></dt>
<dd><p>Executor that uses a thread pool to execute calls asynchronously.</p>
<p>It gathers statistics about the submissions executed for post-analysis…</p>
<p>See: <a class="reference external" href="https://docs.python.org/dev/library/concurrent.futures.html">https://docs.python.org/dev/library/concurrent.futures.html</a></p>
<dl class="method">
<dt id="futurist.ThreadPoolExecutor.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>max_workers=None</em>, <em>check_and_reject=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.ThreadPoolExecutor.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes a thread pool executor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>max_workers</strong> (<em>int</em>) – maximum number of workers that can be
simultaneously active at the same time, further
submitted work will be queued up when this limit
is reached.</li>
<li><strong>check_and_reject</strong> (<em>callback</em>) – a callback function that will be provided
two position arguments, the first argument
will be this executor instance, and the second
will be the number of currently queued work
items in this executors backlog; the callback
should raise a <a class="reference internal" href="#futurist.RejectedSubmission" title="futurist.RejectedSubmission"><code class="xref py py-class docutils literal"><span class="pre">RejectedSubmission</span></code></a>
exception if it wants to have this submission
rejected.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="futurist.ThreadPoolExecutor.alive">
<code class="descname">alive</code><a class="headerlink" href="#futurist.ThreadPoolExecutor.alive" title="Permalink to this definition">¶</a></dt>
<dd><p>Accessor to determine if the executor is alive/active.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.ThreadPoolExecutor.statistics">
<code class="descname">statistics</code><a class="headerlink" href="#futurist.ThreadPoolExecutor.statistics" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference internal" href="#futurist.ExecutorStatistics" title="futurist.ExecutorStatistics"><code class="xref py py-class docutils literal"><span class="pre">ExecutorStatistics</span></code></a> about the executors executions.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.ThreadPoolExecutor.submit">
<code class="descname">submit</code><span class="sig-paren">(</span><em>fn</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.ThreadPoolExecutor.submit" title="Permalink to this definition">¶</a></dt>
<dd><p>Submit some work to be executed (and gather statistics).</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="futures">
<h2>Futures<a class="headerlink" href="#futures" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="futurist.Future">
<em class="property">class </em><code class="descclassname">futurist.</code><code class="descname">Future</code><a class="headerlink" href="#futurist.Future" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents the result of an asynchronous computation.</p>
<dl class="method">
<dt id="futurist.Future.add_done_callback">
<code class="descname">add_done_callback</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.add_done_callback" title="Permalink to this definition">¶</a></dt>
<dd><p>Attaches a callable that will be called when the future finishes.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fn</strong> – A callable that will be called with this future as its only
argument when the future completes or is cancelled. The callable
will always be called by a thread in the same process in which
it was added. If the future has already completed or been
cancelled then the callable will be called immediately. These
callables are called in the order that they were added.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.cancel">
<code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.cancel" title="Permalink to this definition">¶</a></dt>
<dd><p>Cancel the future if possible.</p>
<p>Returns True if the future was cancelled, False otherwise. A future
cannot be cancelled if it is running or has already completed.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.cancelled">
<code class="descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.cancelled" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if the future was cancelled.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.done">
<code class="descname">done</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.done" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True of the future was cancelled or finished executing.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.exception">
<code class="descname">exception</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.exception" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the exception raised by the call that the future represents.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> – The number of seconds to wait for the exception if the
future isn’t done. If None, then there is no limit on the wait
time.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The exception raised by the call that the future represents or None
if the call completed without raising.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code> – If the future was cancelled.</li>
<li><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code> – If the future didn’t finish executing before the given
timeout.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.exception_info">
<code class="descname">exception_info</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.exception_info" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a tuple of (exception, traceback) raised by the call that the
future represents.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> – The number of seconds to wait for the exception if the
future isn’t done. If None, then there is no limit on the wait
time.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The exception raised by the call that the future represents or None
if the call completed without raising.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code> – If the future was cancelled.</li>
<li><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code> – If the future didn’t finish executing before the given
timeout.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.result">
<code class="descname">result</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.result" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the result of the call that the future represents.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> – The number of seconds to wait for the result if the future
isn’t done. If None, then there is no limit on the wait time.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The result of the call that the future represents.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code> – If the future was cancelled.</li>
<li><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code> – If the future didn’t finish executing before the given
timeout.</li>
<li><code class="xref py py-exc docutils literal"><span class="pre">Exception</span></code> – If the call raised then that exception will be raised.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.running">
<code class="descname">running</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.running" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if the future is currently executing.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.set_exception">
<code class="descname">set_exception</code><span class="sig-paren">(</span><em>exception</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.set_exception" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the result of the future as being the given exception.</p>
<p>Should only be used by Executor implementations and unit tests.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.set_exception_info">
<code class="descname">set_exception_info</code><span class="sig-paren">(</span><em>exception</em>, <em>traceback</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.set_exception_info" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the result of the future as being the given exception
and traceback.</p>
<p>Should only be used by Executor implementations and unit tests.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.set_result">
<code class="descname">set_result</code><span class="sig-paren">(</span><em>result</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.set_result" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the return value of work associated with the future.</p>
<p>Should only be used by Executor implementations and unit tests.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.Future.set_running_or_notify_cancel">
<code class="descname">set_running_or_notify_cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.Future.set_running_or_notify_cancel" title="Permalink to this definition">¶</a></dt>
<dd><p>Mark the future as running or process any cancel notifications.</p>
<p>Should only be used by Executor implementations and unit tests.</p>
<p>If the future has been cancelled (cancel() was called and returned
True) then any threads waiting on the future completing (though calls
to as_completed() or wait()) are notified and False is returned.</p>
<p>If the future was not cancelled then it is put in the running state
(future calls to running() will return True) and True is returned.</p>
<p>This method should be called by Executor implementations before
executing the work associated with this future. If this method returns
False then the work should not be executed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">False if the Future was cancelled, True otherwise.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code> – if this method was already called or if set_result()
or set_exception() was called.</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="futurist.GreenFuture">
<em class="property">class </em><code class="descclassname">futurist.</code><code class="descname">GreenFuture</code><a class="headerlink" href="#futurist.GreenFuture" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents the result of an asynchronous computation.</p>
</dd></dl>
</div>
<div class="section" id="periodics">
<h2>Periodics<a class="headerlink" href="#periodics" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="futurist.periodics.PeriodicWorker">
<em class="property">class </em><code class="descclassname">futurist.periodics.</code><code class="descname">PeriodicWorker</code><span class="sig-paren">(</span><em>callables</em>, <em>log=None</em>, <em>executor_factory=None</em>, <em>cond_cls=<function Condition></em>, <em>event_cls=<function Event></em>, <em>schedule_strategy='last_started'</em>, <em>now_func=<function monotonic></em>, <em>on_failure=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker" title="Permalink to this definition">¶</a></dt>
<dd><p>Calls a collection of callables periodically (sleeping as needed…).</p>
<p>NOTE(harlowja): typically the <a class="reference internal" href="#futurist.periodics.PeriodicWorker.start" title="futurist.periodics.PeriodicWorker.start"><code class="xref py py-meth docutils literal"><span class="pre">start()</span></code></a> method is executed in a
background thread so that the periodic callables are executed in
the background/asynchronously (using the defined periods to determine
when each is called).</p>
<dl class="attribute">
<dt id="futurist.periodics.PeriodicWorker.BUILT_IN_STRATEGIES">
<code class="descname">BUILT_IN_STRATEGIES</code><em class="property"> = {'aligned_last_finished': (<function _aligned_last_finished_strategy at 0x7f782d3e9230>, <function _now_plus_periodicity at 0x7f782d3e92a8>), 'aligned_last_finished_jitter': (<function _aligned_last_finished_strategy_with_jitter at 0x7f782d3e9b18>, <function _now_plus_periodicity at 0x7f782d3e92a8>), 'last_finished': (<function _last_finished_strategy at 0x7f782d3e9140>, <function _now_plus_periodicity at 0x7f782d3e92a8>), 'last_finished_jitter': (<function _last_finished_strategy_with_jitter at 0x7f782d3e9aa0>, <function _now_plus_periodicity at 0x7f782d3e92a8>), 'last_started': (<function _last_started_strategy at 0x7f782d3e91b8>, <function _now_plus_periodicity at 0x7f782d3e92a8>), 'last_started_jitter': (<function _last_started_strategy_with_jitter at 0x7f782d3e9a28>, <function _now_plus_periodicity at 0x7f782d3e92a8>)}</em><a class="headerlink" href="#futurist.periodics.PeriodicWorker.BUILT_IN_STRATEGIES" title="Permalink to this definition">¶</a></dt>
<dd><p>Built in scheduling strategies (used to determine when next to run
a periodic callable).</p>
<p>The first element is the strategy to use after the initial start
and the second element is the strategy to use for the initial start.</p>
<p>These are made somewhat pluggable so that we can <em>easily</em> add-on
different types later (perhaps one that uses a cron-style syntax
for example).</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.PeriodicWorker.DEFAULT_JITTER">
<code class="descname">DEFAULT_JITTER</code><em class="property"> = Fraction(1, 20)</em><a class="headerlink" href="#futurist.periodics.PeriodicWorker.DEFAULT_JITTER" title="Permalink to this definition">¶</a></dt>
<dd><p>Default jitter percentage the built-in strategies (that have jitter
support) will use.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.PeriodicWorker.MAX_LOOP_IDLE">
<code class="descname">MAX_LOOP_IDLE</code><em class="property"> = 30</em><a class="headerlink" href="#futurist.periodics.PeriodicWorker.MAX_LOOP_IDLE" title="Permalink to this definition">¶</a></dt>
<dd><p>Max amount of time to wait when running (forces a wakeup when elapsed).</p>
</dd></dl>
<dl class="method">
<dt id="futurist.periodics.PeriodicWorker.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>callables</em>, <em>log=None</em>, <em>executor_factory=None</em>, <em>cond_cls=<function Condition></em>, <em>event_cls=<function Event></em>, <em>schedule_strategy='last_started'</em>, <em>now_func=<function monotonic></em>, <em>on_failure=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a new worker using the given periodic callables.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>callables</strong> (<em>iterable</em>) – a iterable of tuple objects previously decorated
with the <a class="reference internal" href="#futurist.periodics.periodic" title="futurist.periodics.periodic"><code class="xref py py-func docutils literal"><span class="pre">periodic()</span></code></a> decorator, each item
in the iterable is expected to be in the format
of <code class="docutils literal"><span class="pre">(cb,</span> <span class="pre">args,</span> <span class="pre">kwargs)</span></code> where <code class="docutils literal"><span class="pre">cb</span></code> is the
decorated function and <code class="docutils literal"><span class="pre">args</span></code> and <code class="docutils literal"><span class="pre">kwargs</span></code> are
any positional and keyword arguments to send into
the callback when it is activated (both <code class="docutils literal"><span class="pre">args</span></code>
and <code class="docutils literal"><span class="pre">kwargs</span></code> may be provided as none to avoid
using them)</li>
<li><strong>log</strong> (<em>logger</em>) – logger to use when creating a new worker (defaults
to the module logger if none provided), it is currently
only used to report callback failures (if they occur)</li>
<li><strong>executor_factory</strong> (<em>ExecutorFactory</em><em> or </em><em>any callable</em>) – factory callable that can be used to generate
executor objects that will be used to
run the periodic callables (if none is
provided one will be created that uses
the <a class="reference internal" href="#futurist.SynchronousExecutor" title="futurist.SynchronousExecutor"><code class="xref py py-class docutils literal"><span class="pre">SynchronousExecutor</span></code></a>
class)</li>
<li><strong>cond_cls</strong> (<em>callable</em>) – callable object that can
produce <code class="docutils literal"><span class="pre">threading.Condition</span></code>
(or compatible/equivalent) objects</li>
<li><strong>event_cls</strong> (<em>callable</em>) – callable object that can produce <code class="docutils literal"><span class="pre">threading.Event</span></code>
(or compatible/equivalent) objects</li>
<li><strong>schedule_strategy</strong> (<em>string</em>) – string to select one of the built-in
strategies that can return the
next time a callable should run</li>
<li><strong>now_func</strong> (<em>callable</em>) – callable that can return the current time offset
from some point (used in calculating elapsed times
and next times to run); preferably this is
monotonically increasing</li>
<li><strong>on_failure</strong> (<em>callable</em>) – callable that will be called whenever a periodic
function fails with an error, it will be provided
four positional arguments and one keyword
argument, the first positional argument being the
callable that failed, the second being the type
of activity under which it failed (<code class="docutils literal"><span class="pre">IMMEDIATE</span></code> or
<code class="docutils literal"><span class="pre">PERIODIC</span></code>), the third being the spacing that the
callable runs at and the fourth <code class="docutils literal"><span class="pre">exc_info</span></code> tuple
of the failure. The keyword argument <code class="docutils literal"><span class="pre">traceback</span></code>
will also be provided that may be be a string
that caused the failure (this is required for
executors which run out of process, as those can not
<em>currently</em> transfer stack frames across process
boundaries); if no callable is provided then a
default failure logging function will be used
instead (do note that
any user provided callable should not raise
exceptions on being called)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="futurist.periodics.PeriodicWorker.__len__">
<code class="descname">__len__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.__len__" title="Permalink to this definition">¶</a></dt>
<dd><p>How many callables/periodic work units are currently active.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.periodics.PeriodicWorker.add">
<code class="descname">add</code><span class="sig-paren">(</span><em>cb</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.add" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds a new periodic callback to the current worker.</p>
<p>Returns a <a class="reference internal" href="#futurist.periodics.Watcher" title="futurist.periodics.Watcher"><code class="xref py py-class docutils literal"><span class="pre">Watcher</span></code></a> if added successfully or the value
<code class="docutils literal"><span class="pre">None</span></code> if not (or raises a <code class="docutils literal"><span class="pre">ValueError</span></code> if the callback is not
correctly formed and/or decorated).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>cb</strong> (<em>callable</em>) – a callable object/method/function previously decorated
with the <a class="reference internal" href="#futurist.periodics.periodic" title="futurist.periodics.periodic"><code class="xref py py-func docutils literal"><span class="pre">periodic()</span></code></a> decorator</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="classmethod">
<dt id="futurist.periodics.PeriodicWorker.create">
<em class="property">classmethod </em><code class="descname">create</code><span class="sig-paren">(</span><em>objects</em>, <em>exclude_hidden=True</em>, <em>log=None</em>, <em>executor_factory=None</em>, <em>cond_cls=<function Condition></em>, <em>event_cls=<function Event></em>, <em>schedule_strategy='last_started'</em>, <em>now_func=<function monotonic></em>, <em>on_failure=None</em>, <em>args=()</em>, <em>kwargs={}</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.create" title="Permalink to this definition">¶</a></dt>
<dd><p>Automatically creates a worker by analyzing object(s) methods.</p>
<p>Only picks up methods that have been tagged/decorated with
the <a class="reference internal" href="#futurist.periodics.periodic" title="futurist.periodics.periodic"><code class="xref py py-func docutils literal"><span class="pre">periodic()</span></code></a> decorator (does not match against private
or protected methods unless explicitly requested to).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>objects</strong> (<em>iterable</em>) – the objects to introspect for decorated members</li>
<li><strong>exclude_hidden</strong> (<em>bool</em>) – exclude hidden members (ones that start with
an underscore)</li>
<li><strong>log</strong> (<em>logger</em>) – logger to use when creating a new worker (defaults
to the module logger if none provided), it is currently
only used to report callback failures (if they occur)</li>
<li><strong>executor_factory</strong> (<em>ExecutorFactory</em><em> or </em><em>any callable</em>) – factory callable that can be used to generate
executor objects that will be used to
run the periodic callables (if none is
provided one will be created that uses
the <a class="reference internal" href="#futurist.SynchronousExecutor" title="futurist.SynchronousExecutor"><code class="xref py py-class docutils literal"><span class="pre">SynchronousExecutor</span></code></a>
class)</li>
<li><strong>cond_cls</strong> (<em>callable</em>) – callable object that can
produce <code class="docutils literal"><span class="pre">threading.Condition</span></code>
(or compatible/equivalent) objects</li>
<li><strong>event_cls</strong> (<em>callable</em>) – callable object that can produce <code class="docutils literal"><span class="pre">threading.Event</span></code>
(or compatible/equivalent) objects</li>
<li><strong>schedule_strategy</strong> (<em>string</em>) – string to select one of the built-in
strategies that can return the
next time a callable should run</li>
<li><strong>now_func</strong> (<em>callable</em>) – callable that can return the current time offset
from some point (used in calculating elapsed times
and next times to run); preferably this is
monotonically increasing</li>
<li><strong>on_failure</strong> (<em>callable</em>) – callable that will be called whenever a periodic
function fails with an error, it will be provided
four positional arguments and one keyword
argument, the first positional argument being the
callable that failed, the second being the type
of activity under which it failed (<code class="docutils literal"><span class="pre">IMMEDIATE</span></code> or
<code class="docutils literal"><span class="pre">PERIODIC</span></code>), the third being the spacing that the
callable runs at and the fourth <code class="docutils literal"><span class="pre">exc_info</span></code> tuple
of the failure. The keyword argument <code class="docutils literal"><span class="pre">traceback</span></code>
will also be provided that may be be a string
that caused the failure (this is required for
executors which run out of process, as those can not
<em>currently</em> transfer stack frames across process
boundaries); if no callable is provided then a
default failure logging function will be used
instead (do note that
any user provided callable should not raise
exceptions on being called)</li>
<li><strong>args</strong> (<em>tuple</em>) – positional arguments to be passed to all callables</li>
<li><strong>kwargs</strong> (<em>dict</em>) – keyword arguments to be passed to all callables</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="futurist.periodics.PeriodicWorker.iter_watchers">
<code class="descname">iter_watchers</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.iter_watchers" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterator/generator over all the currently maintained watchers.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.periodics.PeriodicWorker.reset">
<code class="descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.reset" title="Permalink to this definition">¶</a></dt>
<dd><p>Resets the workers internal state.</p>
</dd></dl>
<dl class="method">
<dt id="futurist.periodics.PeriodicWorker.start">
<code class="descname">start</code><span class="sig-paren">(</span><em>allow_empty=False</em>, <em>auto_stop_when_empty=False</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.start" title="Permalink to this definition">¶</a></dt>
<dd><p>Starts running (will not return until <a class="reference internal" href="#futurist.periodics.PeriodicWorker.stop" title="futurist.periodics.PeriodicWorker.stop"><code class="xref py py-meth docutils literal"><span class="pre">stop()</span></code></a> is called).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>allow_empty</strong> (<em>bool</em>) – instead of running with no callbacks raise when
this worker has no contained callables (this can be
set to true and <a class="reference internal" href="#futurist.periodics.PeriodicWorker.add" title="futurist.periodics.PeriodicWorker.add"><code class="xref py py-meth docutils literal"><span class="pre">add()</span></code></a> can be used to add
new callables on demand), note that when enabled
and no callbacks exist this will block and
sleep (until either stopped or callbacks are
added)</li>
<li><strong>auto_stop_when_empty</strong> (<em>bool</em>) – when the provided periodic functions have
all exited and this is false then the
thread responsible for executing those
methods will just spin/idle waiting for
a new periodic function to be added;
switching it to true will make this
idling not happen (and instead when no
more periodic work exists then the
calling thread will just return).</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="futurist.periodics.PeriodicWorker.stop">
<code class="descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.stop" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the tombstone (this stops any further executions).</p>
</dd></dl>
<dl class="method">
<dt id="futurist.periodics.PeriodicWorker.wait">
<code class="descname">wait</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.PeriodicWorker.wait" title="Permalink to this definition">¶</a></dt>
<dd><p>Waits for the <a class="reference internal" href="#futurist.periodics.PeriodicWorker.start" title="futurist.periodics.PeriodicWorker.start"><code class="xref py py-meth docutils literal"><span class="pre">start()</span></code></a> method to gracefully exit.</p>
<p>An optional timeout can be provided, which will cause the method to
return within the specified timeout. If the timeout is reached, the
returned value will be False.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timeout</strong> (<em>float/int</em>) – Maximum number of seconds that the <a class="reference internal" href="#futurist.periodics.PeriodicWorker.wait" title="futurist.periodics.PeriodicWorker.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a>
method should block for</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="futurist.periodics.periodic">
<code class="descclassname">futurist.periodics.</code><code class="descname">periodic</code><span class="sig-paren">(</span><em>spacing</em>, <em>run_immediately=False</em>, <em>enabled=True</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.periodic" title="Permalink to this definition">¶</a></dt>
<dd><p>Tags a method/function as wanting/able to execute periodically.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>spacing</strong> (<em>float/int</em>) – how often to run the decorated function (required)</li>
<li><strong>run_immediately</strong> (<em>boolean</em>) – option to specify whether to run
immediately or wait until the spacing provided has
elapsed before running for the first time</li>
<li><strong>enabled</strong> (<em>boolean</em>) – whether the task is enabled to run</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="class">
<dt id="futurist.periodics.Watcher">
<em class="property">class </em><code class="descclassname">futurist.periodics.</code><code class="descname">Watcher</code><span class="sig-paren">(</span><em>metrics</em>, <em>work</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.periodics.Watcher" title="Permalink to this definition">¶</a></dt>
<dd><p>A <strong>read-only</strong> object representing a periodic callback’s activities.</p>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.average_elapsed">
<code class="descname">average_elapsed</code><a class="headerlink" href="#futurist.periodics.Watcher.average_elapsed" title="Permalink to this definition">¶</a></dt>
<dd><p>Avg. amount of time the periodic callback has ran for.</p>
<p>This may raise a <code class="docutils literal"><span class="pre">ZeroDivisionError</span></code> if there has been no runs.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.average_elapsed_waiting">
<code class="descname">average_elapsed_waiting</code><a class="headerlink" href="#futurist.periodics.Watcher.average_elapsed_waiting" title="Permalink to this definition">¶</a></dt>
<dd><p>Avg. amount of time the periodic callback has waited to run for.</p>
<p>This may raise a <code class="docutils literal"><span class="pre">ZeroDivisionError</span></code> if there has been no runs.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.elapsed">
<code class="descname">elapsed</code><a class="headerlink" href="#futurist.periodics.Watcher.elapsed" title="Permalink to this definition">¶</a></dt>
<dd><p>Total amount of time the periodic callback has ran for.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.elapsed_waiting">
<code class="descname">elapsed_waiting</code><a class="headerlink" href="#futurist.periodics.Watcher.elapsed_waiting" title="Permalink to this definition">¶</a></dt>
<dd><p>Total amount of time the periodic callback has waited to run for.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.failures">
<code class="descname">failures</code><a class="headerlink" href="#futurist.periodics.Watcher.failures" title="Permalink to this definition">¶</a></dt>
<dd><p>How many times the periodic callback ran unsuccessfully.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.requested_stop">
<code class="descname">requested_stop</code><a class="headerlink" href="#futurist.periodics.Watcher.requested_stop" title="Permalink to this definition">¶</a></dt>
<dd><p>If the work unit being ran has requested to be stopped.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.runs">
<code class="descname">runs</code><a class="headerlink" href="#futurist.periodics.Watcher.runs" title="Permalink to this definition">¶</a></dt>
<dd><p>How many times the periodic callback has been ran.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.successes">
<code class="descname">successes</code><a class="headerlink" href="#futurist.periodics.Watcher.successes" title="Permalink to this definition">¶</a></dt>
<dd><p>How many times the periodic callback ran successfully.</p>
</dd></dl>
<dl class="attribute">
<dt id="futurist.periodics.Watcher.work">
<code class="descname">work</code><a class="headerlink" href="#futurist.periodics.Watcher.work" title="Permalink to this definition">¶</a></dt>
<dd><p><strong>Read-only</strong> named work tuple this object watches.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="miscellaneous">
<h2>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="futurist.ExecutorStatistics">
<em class="property">class </em><code class="descclassname">futurist.</code><code class="descname">ExecutorStatistics</code><span class="sig-paren">(</span><em>failures=0</em>, <em>executed=0</em>, <em>runtime=0.0</em>, <em>cancelled=0</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.ExecutorStatistics" title="Permalink to this definition">¶</a></dt>
<dd><p>Holds <em>immutable</em> information about a executors executions.</p>
<dl class="attribute">
<dt id="futurist.ExecutorStatistics.average_runtime">
<code class="descname">average_runtime</code><a class="headerlink" href="#futurist.ExecutorStatistics.average_runtime" title="Permalink to this definition">¶</a></dt>
<dd><p>The average runtime of all submissions executed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">average runtime of all submissions executed</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body">ZeroDivisionError when no executions have occurred.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="futurist.ExecutorStatistics.cancelled">
<code class="descname">cancelled</code><a class="headerlink" href="#futurist.ExecutorStatistics.cancelled" title="Permalink to this definition">¶</a></dt>
<dd><p>How many submissions were cancelled before executing.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">how many submissions were cancelled before executing</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="futurist.ExecutorStatistics.executed">
<code class="descname">executed</code><a class="headerlink" href="#futurist.ExecutorStatistics.executed" title="Permalink to this definition">¶</a></dt>
<dd><p>How many submissions were executed (failed or not).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">how many submissions were executed</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="futurist.ExecutorStatistics.failures">
<code class="descname">failures</code><a class="headerlink" href="#futurist.ExecutorStatistics.failures" title="Permalink to this definition">¶</a></dt>
<dd><p>How many submissions ended up raising exceptions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">how many submissions ended up raising exceptions</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="futurist.ExecutorStatistics.runtime">
<code class="descname">runtime</code><a class="headerlink" href="#futurist.ExecutorStatistics.runtime" title="Permalink to this definition">¶</a></dt>
<dd><p>Total runtime of all submissions executed (failed or not).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">total runtime of all submissions executed</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="exceptions">
<h2>Exceptions<a class="headerlink" href="#exceptions" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="futurist.RejectedSubmission">
<em class="property">class </em><code class="descclassname">futurist.</code><code class="descname">RejectedSubmission</code><a class="headerlink" href="#futurist.RejectedSubmission" title="Permalink to this definition">¶</a></dt>
<dd><p>Exception raised when a submitted call is rejected (for some reason).</p>
</dd></dl>
</div>
<div class="section" id="waiters">
<h2>Waiters<a class="headerlink" href="#waiters" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="futurist.waiters.wait_for_any">
<code class="descclassname">futurist.waiters.</code><code class="descname">wait_for_any</code><span class="sig-paren">(</span><em>fs</em>, <em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.waiters.wait_for_any" title="Permalink to this definition">¶</a></dt>
<dd><p>Wait for one (<strong>any</strong>) of the futures to complete.</p>
<p>Works correctly with both green and non-green futures (but not both
together, since this can’t be guaranteed to avoid dead-lock due to how
the waiting implementations are different when green threads are being
used).</p>
<p>Returns pair (done futures, not done futures).</p>
</dd></dl>
<dl class="function">
<dt id="futurist.waiters.wait_for_all">
<code class="descclassname">futurist.waiters.</code><code class="descname">wait_for_all</code><span class="sig-paren">(</span><em>fs</em>, <em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.waiters.wait_for_all" title="Permalink to this definition">¶</a></dt>
<dd><p>Wait for all of the futures to complete.</p>
<p>Works correctly with both green and non-green futures (but not both
together, since this can’t be guaranteed to avoid dead-lock due to how
the waiting implementations are different when green threads are being
used).</p>
<p>Returns pair (done futures, not done futures).</p>
</dd></dl>
<dl class="class">
<dt id="futurist.waiters.DoneAndNotDoneFutures">
<em class="property">class </em><code class="descclassname">futurist.waiters.</code><code class="descname">DoneAndNotDoneFutures</code><span class="sig-paren">(</span><em>done</em>, <em>not_done</em><span class="sig-paren">)</span><a class="headerlink" href="#futurist.waiters.DoneAndNotDoneFutures" title="Permalink to this definition">¶</a></dt>
<dd><p>Named tuple returned from <code class="docutils literal"><span class="pre">wait_for*</span></code> calls.</p>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="docs-actions">
<a href="../user/history.html"><i class="fa fa-angle-double-left" data-toggle="tooltip" data-placement="top" title="Previous: CHANGES"></i></a>
<a href="../install/index.html"><i class="fa fa-angle-double-right" data-toggle="tooltip" data-placement="top" title="Next: Installation"></i></a>
<a id="logABugLink3" href="" target="_blank" title="Found an error? Report a bug against this page"><i class="fa fa-bug" data-toggle="tooltip" data-placement="top" title="Report a Bug"></i></a>
</div>
<div class="row docs-byline bottom">
<div class="docs-updated">updated: 2018-01-24 15:40</div>
</div>
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8 docs-license">
<a href="https://creativecommons.org/licenses/by/3.0/">
<img src="../_static/images/docs/license.png" alt="Creative Commons Attribution 3.0 License"/>
</a>
<p>
Except where otherwise noted, this document is licensed under
<a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons
Attribution 3.0 License</a>. See all <a href="http://www.openstack.org/legal">
OpenStack Legal Documents</a>.
</p>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 docs-actions-wrapper">
<!-- ID buglinkbottom added so that pre-filled doc bugs
are sent to Launchpad projects related to the
document -->
<a href="#" id="logABugLink2" class="docs-footer-actions"><i class="fa fa-bug"></i> found an error? report a bug</a>
<a href="http://ask.openstack.org" class="docs-footer-actions"><i class="fa fa-question-circle"></i> questions?</a>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-4 col-lg-pull-9 col-md-pull-8 col-sm-pull-8 docs-sidebar">
<div class="btn-group docs-sidebar-releases">
<button onclick="location.href='/'" class="btn docs-sidebar-home" data-toggle="tooltip" data-placement="top" title="Docs Home"><i class="fa fa-arrow-circle-o-left"></i></button>
<button href="#" type="button" data-toggle="dropdown" class="btn docs-sidebar-release-select">OpenStack Documentation<i class="fa fa-caret-down"></i></button>
<ul class="dropdown-menu docs-sidebar-dropdown" role="menu" aria-labelledby="dLabel">
<li role="presentation" class="dropdown-header">Guides</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/index.html#install-guides">Install Guides</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/index.html#user-guides">User Guides</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/index.html#configuration-guides">Configuration Guides</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/index.html#ops-and-admin-guides">Operations and Administration Guides</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/index.html#api-guides">API Guides</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/index.html#contributor-guides">Contributor Guides</a></li>
<li role="presentation" class="dropdown-header">Languages</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/de/">Deutsch (German)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/fr/">Français (French)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/id/">Bahasa Indonesia (Indonesian)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/it/">Italiano (Italian)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/ja/">日本語 (Japanese)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/ko_KR/">한국어 (Korean)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/pt_BR/">Português (Portuguese)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://docs.openstack.org/zh_CN/">简体中文 (Simplified Chinese)</a></li>
</ul>
</div>
<div class="docs-sidebar-toc">
<div class="docs-sidebar-section" id="table-of-contents">
<a href="../index.html" class="docs-sidebar-section-title"><h4>futurist </h4></a>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../user/index.html">Using futurist</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#executors">Executors</a></li>
<li class="toctree-l2"><a class="reference internal" href="#futures">Futures</a></li>
<li class="toctree-l2"><a class="reference internal" href="#periodics">Periodics</a></li>
<li class="toctree-l2"><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
<li class="toctree-l2"><a class="reference internal" href="#exceptions">Exceptions</a></li>
<li class="toctree-l2"><a class="reference internal" href="#waiters">Waiters</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../install/index.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributor/index.html">Contributing</a></li>
</ul>
</div>
<div class="docs-sidebar-toc">
<div class="docs-sidebar-section" id="local-table-of-contents">
<h4 class="docs-sidebar-section-title">Page Contents</h4>
<ul>
<li><a class="reference internal" href="#">API Reference</a><ul>
<li><a class="reference internal" href="#executors">Executors</a></li>
<li><a class="reference internal" href="#futures">Futures</a></li>
<li><a class="reference internal" href="#periodics">Periodics</a></li>
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
<li><a class="reference internal" href="#exceptions">Exceptions</a></li>
<li><a class="reference internal" href="#waiters">Waiters</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="container">
<div class="row footer-links">
<div class="col-lg-2 col-sm-2">
<h3>OpenStack</h3>
<ul>
<li><a href="http://openstack.org/projects/">Projects</a></li>
<li><a href="http://openstack.org/projects/openstack-security/">OpenStack Security</a></li>
<li><a href="http://openstack.org/projects/openstack-faq/">Common Questions</a></li>
<li><a href="http://openstack.org/blog/">Blog</a></li>
<li><a href="http://openstack.org/news/">News</a></li>
</ul>
</div>
<div class="col-lg-2 col-sm-2">
<h3>Community</h3>
<ul>
<li><a href="http://openstack.org/community/">User Groups</a></li>
<li><a href="http://openstack.org/community/events/">Events</a></li>
<li><a href="http://openstack.org/community/jobs/">Jobs</a></li>
<li><a href="http://openstack.org/foundation/companies/">Companies</a></li>
<li><a href="http://docs.openstack.org/infra/manual/developers.html">Contribute</a></li>
</ul>
</div>
<div class="col-lg-2 col-sm-2">
<h3>Documentation</h3>
<ul>
<li><a href="http://docs.openstack.org">OpenStack Manuals</a></li>
<li><a href="http://openstack.org/software/start/">Getting Started</a></li>
<li><a href="http://developer.openstack.org">API Documentation</a></li>
<li><a href="https://wiki.openstack.org">Wiki</a></li>
</ul>
</div>
<div class="col-lg-2 col-sm-2">
<h3>Branding & Legal</h3>
<ul>
<li><a href="http://openstack.org/brand/">Logos & Guidelines</a></li>
<li><a href="http://openstack.org/brand/openstack-trademark-policy/">Trademark Policy</a></li>
<li><a href="http://openstack.org/privacy/">Privacy Policy</a></li>
<li><a href="https://wiki.openstack.org/wiki/How_To_Contribute#Contributor_License_Agreement">OpenStack CLA</a></li>
</ul>
</div>
<div class="col-lg-4 col-sm-4">
<h3>Stay In Touch</h3>
<a href="https://twitter.com/OpenStack" target="_blank" class="social-icons footer-twitter"></a>
<a href="https://www.facebook.com/openstack" target="_blank" class="social-icons footer-facebook"></a>
<a href="https://www.linkedin.com/company/openstack" target="_blank" class="social-icons footer-linkedin"></a>
<a href="https://www.youtube.com/user/OpenStackFoundation" target="_blank" class="social-icons footer-youtube"></a>
<p class="fine-print">
The OpenStack project is provided under the
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 license</a>. Openstack.org is powered by
<a href="http://rackspace.com" target="_blank">Rackspace Cloud Computing</a>.
</p>
</div>
</div>
</div>
</footer>
<!-- jQuery -->
<script type="text/javascript" src="../_static/js/jquery-3.2.1.min.js"></script>
<!-- Bootstrap JavaScript -->
<script type="text/javascript" src="../_static/js/bootstrap.min.js"></script>
<!-- The rest of the JS -->
<script type="text/javascript" src="../_static/js/navigation.js"></script>
<!-- Docs JS -->
<script type="text/javascript" src="../_static/js/docs.js"></script>
<!-- Popovers -->
<script type="text/javascript" src="../_static/js/webui-popover.js"></script>
<!-- standard sphinx include libraries, which allow search highlighting -->
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/searchtools.js"></script>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
SOURCELINK_SUFFIX: '.txt',
HAS_SOURCE: true
};
</script>
<!-- Javascript for page -->
<script language="JavaScript">
/* build a description of this page including SHA, source location on git repo,
build time and the project's launchpad bug tag. Set the HREF of the bug
buttons */
var lineFeed = "%0A";
var gitURL = "Source: Can't derive source file URL";
/* there have been cases where "pagename" wasn't set; better check for it */
/* The URL of the source file on Git is based on the giturl variable
in conf.py, which must be manually initialized to the source file
URL in Git.
"pagename" is a standard sphinx parameter containing the name of
the source file, without extension. */
var sourceFile = "reference/index" + ".rst";
gitURL = "Source: https://git.openstack.org/cgit/openstack/futurist/tree/doc/source" + "/" + sourceFile;
/* gitsha, project and bug_tag rely on variables in conf.py */
var gitSha = "SHA: unknown";
var bugProject = "futurist";
var bugTitle = "API Reference in futurist";
var fieldTags = "";
var useStoryboard = "";
/* "last_updated" is the build date and time. It relies on the
conf.py variable "html_last_updated_fmt", which should include
year/month/day as well as hours and minutes */
var buildstring = "Release: on 2018-01-24 15:40";
var fieldComment = encodeURI(buildstring) +
lineFeed + encodeURI(gitSha) +
lineFeed + encodeURI(gitURL) ;
logABug(bugTitle, bugProject, fieldComment, fieldTags);
</script>
</body>
</html>
|