https://prefect.io logo
h

Hamed Sheykhlou

12/10/2020, 3:20 PM
Hi guys. is there any way to securely pass the result of a task to the next task?
z

Zanie

12/10/2020, 3:48 PM
Hi! Could you explain in a bit more detail what you mean by securely / what your use-case is?
h

Hamed Sheykhlou

12/10/2020, 3:52 PM
consider this as an example code
Copy code
import requests
from prefect import Flow, task


@task(name='extract_task')
def extract():
    res = requests.get('<https://jsonplaceholder.typicode.com/todos/1>')
    res_txt = res.text
    return res_txt


@task()
def load(a):
    """Print the data to indicate it was received"""
    print("Here's your data1: {}".format(a))


with Flow("Callback-Example") as flow:
    e = extract()
    l = load(e)

flow.run()
I want to pass the result of
extract
(e) securely to
load
. maybe https://docs.prefect.io/api/latest/engine/results.html#secretresult be helpful. but I don't know how to use it.
d

Dylan

12/10/2020, 4:28 PM
Hi @Hamed Sheykhlou, Where are you planning to run your Prefect Flows? Generally, we use Results to make sure that your data never leaves your infrastructure. Securing the GCS/S3 buckets where the results live is usually a matter of putting proper permissions on the execution infrastructure and the buckets.
In your example, if you were to use a Result, Prefect would do the work to ensure that
load
is reading from the Result location
Does that answer your question?