# First Steps¶

This tutorial is also available in the form of a Jupyter Notebook. Try it out, and play!

Noodles is there to make your life easier, in parallel! The reason why Noodles can be easy and do parallel Python at the same time is its functional approach. In one part you’ll define a set of functions that you’d like to run with Noodles, in an other part you’ll compose these functions into a workflow graph. To make this approach work a function should not have any side effects. Let’s not linger and just start noodling! First we define some functions to use.

[1]:

from noodles import schedule

@schedule
return x + y

@schedule
def mul(x,y):
return x * y


Now we can create a workflow composing several calls to this function.

[2]:

a = add(1, 1)
b = mul(a, 2)
d = mul(b, c)


That looks easy enough; the funny thing is though, that nothing has been computed yet! Noodles just created the workflow graphs corresponding to the values that still need to be computed. Until such time, we work with the promise of a future value. Using some function in pygraphviz we can look at the call graphs.

[3]:

from noodles.tutorial import display_workflows

display_workflows(prefix='first_steps-workflow',
a=a, b=b, c=c, d=d)

a b c d

Now, to compute the result we have to tell Noodles to evaluate the program.

[4]:

from noodles import run_parallel


[4]:

16