Skip to content

Instantly share code, notes, and snippets.

@yadudoc
Last active November 15, 2019 17:02
Show Gist options
  • Save yadudoc/31e8d38439789580b947a0fb39c9e275 to your computer and use it in GitHub Desktop.
Save yadudoc/31e8d38439789580b947a0fb39c9e275 to your computer and use it in GitHub Desktop.
@python_app
def square(x):
return x**2
@python_app
def average(x):
return sum(x)/len(x)
output_list = []
for i in range(1,5):
output_list.append(square(i))
mean = average(output_list)
# Original <----------------------
# Edits ----------------->
@python_app
def square(x):
return x**2
# inputs is a special kwarg that allows parsl apps to take a collection of futures
# If you pass an app a list or dict of futures, parsl doesn't inspect the data structure to see if there are futures in it.
@python_app
def average(inputs=[]):
return sum(inputs)/len(inputs)
output_list = []
for i in range(1,5):
output_list.append(square(i))
mean = average(inputs=output_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment