3bbbcc6842
Create an example which can be extended to create a simplistic review checkout, tox running system which can be used to run some set of actions on every review posted. This could be expanded and connected into a gerrit pipeline to create a mini-jenkins like trigger/build/result system. Part of ongoing blueprint more-examples Change-Id: I5cf1bf02eeddf897ac7f098f1d73377f262a267b
345 lines
7.0 KiB
ReStructuredText
345 lines
7.0 KiB
ReStructuredText
Hello world
|
|
===========
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`hello_world`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/hello_world.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Passing values from and to tasks
|
|
================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`simple_linear_pass`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/simple_linear_pass.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Using listeners
|
|
===============
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`echo_listener`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/echo_listener.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Dumping a in-memory backend
|
|
===========================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`dump_memory_backend`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/dump_memory_backend.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Making phone calls
|
|
==================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`simple_linear`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/simple_linear.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Making phone calls (automatically reverting)
|
|
============================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`reverting_linear`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/reverting_linear.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Building a car
|
|
==============
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`build_a_car`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/build_a_car.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Iterating over the alphabet (using processes)
|
|
=============================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`alphabet_soup`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/alphabet_soup.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Watching execution timing
|
|
=========================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`timing_listener`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/timing_listener.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Distance calculator
|
|
===================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`distance_calculator`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/distance_calculator.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Table multiplier (in parallel)
|
|
==============================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`parallel_table_multiply`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/parallel_table_multiply.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Linear equation solver (explicit dependencies)
|
|
==============================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`calculate_linear`.
|
|
|
|
.. literalinclude:: ../../taskflow/examples/calculate_linear.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Linear equation solver (inferred dependencies)
|
|
==============================================
|
|
|
|
``Source:`` :example:`graph_flow.py`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/graph_flow.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Linear equation solver (in parallel)
|
|
====================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`calculate_in_parallel`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/calculate_in_parallel.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Creating a volume (in parallel)
|
|
===============================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`create_parallel_volume`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/create_parallel_volume.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Summation mapper(s) and reducer (in parallel)
|
|
=============================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`simple_map_reduce`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/simple_map_reduce.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Sharing a thread pool executor (in parallel)
|
|
============================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`share_engine_thread`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/share_engine_thread.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Storing & emitting a bill
|
|
=========================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`fake_billing`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/fake_billing.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Suspending a workflow & resuming
|
|
================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`resume_from_backend`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/resume_from_backend.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Creating a virtual machine (resumable)
|
|
======================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`resume_vm_boot`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/resume_vm_boot.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Creating a volume (resumable)
|
|
=============================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`resume_volume_create`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/resume_volume_create.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Running engines via iteration
|
|
=============================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`run_by_iter`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/run_by_iter.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Controlling retries using a retry controller
|
|
============================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`retry_flow`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/retry_flow.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Distributed execution (simple)
|
|
==============================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`wbe_simple_linear`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/wbe_simple_linear.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Distributed notification (simple)
|
|
=================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`wbe_event_sender`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/wbe_event_sender.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Distributed mandelbrot (complex)
|
|
================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`wbe_mandelbrot`
|
|
|
|
Output
|
|
------
|
|
|
|
.. image:: img/mandelbrot.png
|
|
:height: 128px
|
|
:align: right
|
|
:alt: Generated mandelbrot fractal
|
|
|
|
Code
|
|
----
|
|
|
|
.. literalinclude:: ../../taskflow/examples/wbe_mandelbrot.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Jobboard producer/consumer (simple)
|
|
===================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`jobboard_produce_consume_colors`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/jobboard_produce_consume_colors.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|
|
|
|
Conductor simulating a CI pipeline
|
|
==================================
|
|
|
|
.. note::
|
|
|
|
Full source located at :example:`tox_conductor`
|
|
|
|
.. literalinclude:: ../../taskflow/examples/tox_conductor.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 16-
|