Change-Id: Ie9f1ca14eed287f3c25553d029d4a4b2ca5274d0
8.4 KiB
Examples
While developing TaskFlow the team has worked hard to make sure the various concepts are explained by relevant examples. Here are a few selected examples to get started (ordered by perceived complexity):
To explore more of these examples please check out the examples directory in the TaskFlow source tree.
Note
If the examples provided are not satisfactory (or up to your standards) contributions are welcome and very much appreciated to help improve them. The higher the quality and the clearer the examples are the better and more useful they are for everyone.
Hello world
Note
Full source located at hello_world
.
../../../taskflow/examples/hello_world.py
Passing values from and to tasks
Note
Full source located at simple_linear_pass
.
../../../taskflow/examples/simple_linear_pass.py
Using listeners
Note
Full source located at echo_listener
.
../../../taskflow/examples/echo_listener.py
Using listeners (to watch a phone call)
Note
Full source located at simple_linear_listening
.
../../../taskflow/examples/simple_linear_listening.py
Dumping a in-memory backend
Note
Full source located at dump_memory_backend
.
../../../taskflow/examples/dump_memory_backend.py
Making phone calls
Note
Full source located at simple_linear
.
../../../taskflow/examples/simple_linear.py
Making phone calls (automatically reverting)
Note
Full source located at reverting_linear
.
../../../taskflow/examples/reverting_linear.py
Building a car
Note
Full source located at build_a_car
.
../../../taskflow/examples/build_a_car.py
Iterating over the alphabet (using processes)
Note
Full source located at alphabet_soup
.
../../../taskflow/examples/alphabet_soup.py
Watching execution timing
Note
Full source located at timing_listener
.
../../../taskflow/examples/timing_listener.py
Distance calculator
Note
Full source located at distance_calculator
../../../taskflow/examples/distance_calculator.py
Table multiplier (in parallel)
Note
Full source located at parallel_table_multiply
../../../taskflow/examples/parallel_table_multiply.py
Linear equation solver (explicit dependencies)
Note
Full source located at calculate_linear
.
../../../taskflow/examples/calculate_linear.py
Linear equation solver (inferred dependencies)
Source:
graph_flow.py
../../../taskflow/examples/graph_flow.py
Linear equation solver (in parallel)
Note
Full source located at calculate_in_parallel
../../../taskflow/examples/calculate_in_parallel.py
Creating a volume (in parallel)
Note
Full source located at create_parallel_volume
../../../taskflow/examples/create_parallel_volume.py
Summation mapper(s) and reducer (in parallel)
Note
Full source located at simple_map_reduce
../../../taskflow/examples/simple_map_reduce.py
Sharing a thread pool executor (in parallel)
Note
Full source located at share_engine_thread
../../../taskflow/examples/share_engine_thread.py
Storing & emitting a bill
Note
Full source located at fake_billing
../../../taskflow/examples/fake_billing.py
Suspending a workflow & resuming
Note
Full source located at resume_from_backend
../../../taskflow/examples/resume_from_backend.py
Creating a virtual machine (resumable)
Note
Full source located at resume_vm_boot
../../../taskflow/examples/resume_vm_boot.py
Creating a volume (resumable)
Note
Full source located at resume_volume_create
../../../taskflow/examples/resume_volume_create.py
Running engines via iteration
Note
Full source located at run_by_iter
../../../taskflow/examples/run_by_iter.py
Controlling retries using a retry controller
Note
Full source located at retry_flow
../../../taskflow/examples/retry_flow.py
Distributed execution (simple)
Note
Full source located at wbe_simple_linear
../../../taskflow/examples/wbe_simple_linear.py
Distributed notification (simple)
Note
Full source located at wbe_event_sender
../../../taskflow/examples/wbe_event_sender.py
Distributed mandelbrot (complex)
Note
Full source located at wbe_mandelbrot
Output
Code
../../../taskflow/examples/wbe_mandelbrot.py
Jobboard producer/consumer (simple)
Note
Full source located at jobboard_produce_consume_colors
../../../taskflow/examples/jobboard_produce_consume_colors.py
Conductor simulating a CI pipeline
Note
Full source located at tox_conductor
../../../taskflow/examples/tox_conductor.py
Conductor running 99 bottles of beer song requests
Note
Full source located at 99_bottles
../../../taskflow/examples/99_bottles.py