mardi 21 mai 2019

Manage multiple object instances running on distant server

I'm new to Python and I wrote a class object that we will call DummyClass. I have uploaded my .py file to a distant server and I want to be able to manage many DummyClass object instances.

    a = DummyClass() # Create an instance
    a.doSomethingImportant() # Managing my object
    b = DummyClass() # Create another instance
    ...

But once I'm disconnected from my distant server (ended the SSH connection), I'm not able to get access to my object instances (that are still running).

I think that I can use tmux to not loose my python terminal when I disconnect but I'm not sure that this is the way to go as I want to create a very simple a lightweight webapp (Flask for example) to manage and monitor my object instances.

Do you have any design pattern recommendation (wrap my DummyClass and use an API / Instantiate my objects directly from the webapp code / ...)

Aucun commentaire:

Enregistrer un commentaire