How can I make a distinction (run-time) to see wet...
# ask-community
j
How can I make a distinction (run-time) to see wether I’m running the flow directly or from the agent / server? Case: when running on production (i.e. from the kubernetes agent) it should perform a task (actually its a resource manager) - which deploys a cloudsql proxy and connect through that proxy - but if I’m developing I want to connect with localhost database. In theory, its fine if I deploy the cloudsql proxy (resource manager) while developing the flow, but I still need to know at runtime if which hostname it should use to connect with the database.
Could I use the
Copy code
if __name__ == "__main__":
check maybe? And, actually construct a different flow when running the script locally vs. when its triggered from the server?
j
Yeah that is one way you could do it! Another thing I have seen people do is using either environment variables or Prefect Secrets. e.g. Having a local environment variable set for the host and then in your RunConfig having a different one when running w/ the server.
j
Ohm.. of course, makes sense 😅 thanks 🙂