Make Omero scripts aware of global variables or resources

Hi, All,

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

  1. (somehow) obtaining a global Lock or Semaphore,
  2. writing a microservice, or
  3. 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,

Hi Michael,

of the choices you’ve listed, I’d suspect the most straight-forward would be using a scheduler especially if you already have one available. That’s exactly what they are there for. I don’t have links to them this evening, but I know other OMEROistas have created scripts which use their own institutional scheduler. (Perhaps the wider community memory could help us out.)