Hi - I’m very new to prefect (previously and curre...
# prefect-community
v
Hi - I’m very new to prefect (previously and currently using Airflow) and engineering, so I apologize if these seem like silly questions. Wondering: • What is the ideal structure? For example, airflow wants a separate project dedicated to just airflow stuff (dags, operators, hooks, plugins, etc) independent from the actual app. Ideally, I would like to host all prefect stuff in a separate ec2 from the app. Which leads to the next question… • My app is in Django; as a result, I would need to import models to use the django ORM. The app is a private project in github running on an ec2. Currently, with Airflow, I need to import the entire app into the dags folder in order to access the models. Is it possible to pip install a github repo into the prefect stuff and import into each model as needed (without running
django.setup()
)? • Is there a way to manually trigger a Flow? For example, I design a flow to do some calculations, and I only want it to run if a user clicks a button. Is there an API endpoint I can use to fire it off? THANKS!
👋 4
n
Hi @Viv Ian and welcome to Prefect! 👋 I'll go through your questions individually: 1. There's not necessarily an ideal structure for setting up Prefect Server; setting it up on a dedicated ec2 makes sense. Note that since there's no auth layer in Prefect Server, you'll want to limit traffic to that VPC network. 2. Prefect doesn’t require any particular folder structures; instead, when you register a Flow it's pickled and stored in a location of your choosing. At runtime, it's unpickled and run by an Agent (You can read a bit about agents here: https://docs.prefect.io/api/latest/agent/agent.html#agent). This means that the only requirement is that the same imports that were available when you built the flow need to be available where the flow is run. So as long as your models are importable in your Agent’s environment (if using a Local Agent) you should be good to go, although I’m not as familiar with Django so there might be a gotcha lurking in there 3. Definitely! Prefect Server comes with a GraphQL server out of the box. See #1 on restricting traffic for that endpoint and https://docs.prefect.io/orchestration/concepts/api.html#graphql for more information on the API! Let me know if you have any more questions 😄 !
v
Thanks @nicholas! I’m going to try some stuff out; I’m sure I’ll definitely have questions. 😅
n
Happy to help! 😄