Hello! Let's say I have a python script deploy.py ...
# best-practices
r
Hello! Let's say I have a python script deploy.py that takes the best model from MLflow model registry and deploys it as a flask application. Is there a simple way I can add this script as a task in a prefect flow? Something like this:
Copy code
@task
def deploy_best_model():
      python deploy.py
1
a
In theory yes, you could use prefect-shell collection but I worry where would this flask app be deployed then? Prefect won't serve a flask application
r
@Anna Geller Hi Anna, I would like the flask application to run independent of Prefect. Just want the deployment to happen as part of the flow. Flask would run at port 9696 and prefect would run at port 4200
@Anna Geller This worked for me:
Copy code
@task
def deploy_best_model():
    import subprocess
    subprocess.run(["python", "deploy.py"])
a
in that case, it might work, have you tried running it?
r
yes it works! thanks!
🙌 1