I am trying to build a process monitoring tool in python, with some basic task handling
- start a process, check running status or stop a process
consider process dependency before starting a process. eg config dependency file
` P1->P2,P3
P2->
P3->P4,P5
P4->
P5->`
So if we give command to start P1, it should infer from config that it is dependent on
P2,P3
, startP2
, startP3
, again infer thatP3
is dependent onP4,P5
, runP4,P5
, then finally runP1
once all dependent process are running.
This seems to be a common utility usage, what is the best way to achieve this using python. Should I be creating a full dependency list for each process in the config? eg. serializing dependency in the form P1->P2,P4,P5,P3
and then run for each P if(!isRunning(P)){run(P)}
Any suggestions to solve this problem efficiently wold be very helpful.