Parallel Gateway

When creating branches as shown below:

get_posts_and_friends = get_user_by_id >> (

You are implicitly using the gloe.gateways.parallel gateway. The above code has the same behavior as the following:

from gloe.gateways import parallel

get_posts_and_friends = get_user_by_id >> parallel(

Currently, the parallelism of transformers is supported only by executing async transformers concurrently. So, if fetch_user_posts and fetch_user_friends are async transformers, they will execute concurrently. If a mix of sync and async transformers are used, the async transformers will still run concurrently, but the sync transformers will run sequentially.

The key point to note is that parallelism means that none of the transformers used in the branches depend on the others, considering the order of execution. In future versions, we plan to support more complex parallelism strategies, such as using threads or third-party libraries. By keeping independent transformers in parallel branches, they will soon be able to run under truly parallel mechanisms.

Sequential Gateway

If you have transformers that don’t depend on the output of the previous one but need to be run sequentially for some reason, you can use the gloe.gateways.sequential gateway. For example:

from gloe.gateways import sequential

write_on_disk = get_file_path >> sequential(

In this case, all the transformers only require the file path as input, so they don’t depend on the output of the previous one. However, due to IO operations, the transformers must be executed in order.

Common use cases include IO operations, such as writing to disk or a database, or dealing with mutable objects where internal state changes by reference.


We have plans to support more gateway types in the future.