I have a few Python scripts that I’ve written for Omero. Some of these use a resource that is limited, globally. As an example, a script may use the Server’s GPU, and I would like to control these scripts so that each subsequent instance of the script pauses until the resource becomes available. It may also be that multiple scripts are competing for the same resource (for example, again, two independent scripts may use the GPU). Can anyone recommend a good way to accomplish this?
I have considered
- (somehow) obtaining a global Lock or Semaphore,
- writing a microservice, or
- using a third-party tool like a scheduler.
But, I thought the community might have advice on the correct/easiest path, so I don’t go down the wrong road.
Thanks for any advice,