Threads for unitech

  1. 1

    Really interesting points Vosper, thanks for sharing your thoughts and knowledge about the Python best practices.

    Article & PM2 author here —

    So basically as you may have understood, PM2 is currently a process manager specialized for Node.js, that in extra of the process management, also offers deep integration on the Node.js runtime (extracting more than 20 metrics automatically, exposing asynchronous actions that can be called via PM2 CLI…) and also a clustering system with 0 downtime reload capabilities. This has been proven to be really robust and popular among the Node.js community.

    Now today, with this article, I wanted to share the first proper PM2 integration to another language, here Python. Right now it’s only about starting and managing any kind of application like you could do with supervisord. So with PM2 you could start uwsgi, celery or any other process.

    About Systemd; Systemd is great and robust at making sure application are started and running properly. We rely on it to start PM2 at server boot too.

    But! After many years of managing long running apps, I found systemd not that much intuitive for rapid interventions and not great for managing micro services application. PM2 is much more flexible and simple for fast interventions.

    Wanna list your own applications running? pm2 ls or pm2 list or pm2 status

    Wanna check the logs of an application? Run pm2 logs <my-app-name>

    Flush the logs? pm2 flush

    Restart? pm2 restart or pm2 start

    There are aliases and lot of scripting to make this tool really human friendly.


    Depending on the Python community reaction, we will start to build tighter integrations to the Python runtime and as I can see, asyncio is starting to be popular among Python developers so at some point we could integrate concepts like custom actions (kind of asynchronous REPL), process metrics, exception management. And potentially a kind of cluster mode as we do for Node.js, based on UWSGI or Gunicorn.