I am sorry if this is a simple question, but I spe...
# marvin-ai
b
I am sorry if this is a simple question, but I spent some time last night working through a chunk of the documentation. Just now, I started to play around.
Copy code
import controlflow as cf

emails = [
    "Hello, I need an update on the project status.",
    "Subject: Exclusive offer just for you!",
    "Urgent: Project deadline moved up by one week.",
]

# Create a ControlFlow task to generate an reply
reply = cf.run(
    "Write a polite reply to an email",
    context=dict(email=emails[0]),
)

print(reply)
If this is in
app.py
and I run it via
python app.py
I get the expected output. My question: where is this running? With prefect server running, I could see a flow running. I read references to prefect from the docs, but zooming out is the path to execute scripts as I did above? Trying to learn about how to organize and actually deploy work, along with observability and logging.
j
Hey @Brock -- as written, this is running on your local machine (exactly as if you ran it as a script) and reporting its state updates to your Prefect server. That's a typical setup for CF - all internal function calls are instrumented for Prefect visibility, but you can run it wherever and however you like (and it will send those updates to the Prefect API). If you decorate a function as
cf.flow()
, it is also automatically a Prefect flow and can be deployed with Prefect e.g. to run in a Prefect work pool. However that's not required here.
b
Thanks @Jeremiah , I appreciate the fast response. I have a personal cloud account on the free tier, but I dont think I have logged in for at least month, probably closer to two. I checked that dashboard, and blam, there are runs. I don't quite understand how ( or why) these simple examples are being sent to the cloud (or anywhere other than my laptop) when I haven't done anything to deploy the simple python script. I figured these would be local until I deploy them elsewhere. I even started a prefect server locally and but clearly that is not where the messages landed. I don't want to overload this thread, but I would expect everything to run locally until I explicitly perform some form of a "push" for the execution to run elsewhere. I am not complaining, it just doesn't map mentally for me. I would have figured my scripts failed until I ran
prefect server start
on my local laptop is the TLDR.
j
It sounds like your Cloud profile must be active on your machine -- if you run
prefect profile ls
you can see the active profile, then
prefect profile inspect <name>
to see how its configured
Importantly, your execution is still local - its the metadata that is going to Cloud (or the local server instance, once configured). In other words, as the script is running it's sending information to the orchestration server for governance and observability, but the code execution will remain on your laptop.
b
Ahh I didn’t realize that is what was happening. Thanks for your patience, I didn’t pick up on that flow.
j
No problem!