Currently we have many folders under a main “root” folder … I need to search for specific-named files being created in any of the folders.
We can discuss how this might be a bad way to query tasks from the web app to the execution of .gh scripts , indeed. But this what we have so far.
Listening to a file may not be enough, that same file would need to be read and maybe also edited at the same time… scary stuff.
Searching a “key” file (empty) in each folder seems inexpensive to me, and there is no risk of collision between read/write.
Back to the original question: do somebody know a way to make a .gh script (already open) to process some file from a “API” call or something similar?
Currently is the .gh itself recursively searching for new “key” files to start the job.
Btw just to sum it up on how I would approach this. I would create a command and control application with a connector middleware/plugin running in Rhino. This app would delegate having n-Rhino instances being either in “ready” or “running” state, while a fixed part of instances is in non-runnable (e.g. “start”, “shutdown”) state. It could also handle start actions etc.
This way you can orchestrate that the app is closing after a job has been done, which is what I would always prefer. How many instances are in ready state could depend on business hours and other metrics. This way you save performance for heavy jobs and you prevent various issues due to long uptime or when a job kills an instance or perform a timeout.
In any case I truly believe this is a simpler approach with medium implementation demand, than any hacky approach