Question
We run scripts in HTTP REST jobs and would like to set the limit number of concurrent scripts to be run in order to control the number of accesses.
Is it possible to set the limit number of concurrent executions for each script in HULFT Square?
Answer
HULFT Square does not have a function to control the number of simultaneous executions of script.
However, it might be possible to satisfy the requirement by using a flag file.
Example
Overview
Determine whether a script is running based on the current number of executions.
Detail
Add the following process.
It is assumed the number of concurrent executions is N.
- Create a file with a unique name in a specific directory when a script is executed.
- Check the number of files in the specified directory and wait one second if the number is N or more.
- Repeat the process described in step 2 until the number of files is less than N.
- If the number of files is less than N, execute any process you want.
- At the end of the process, delete the file with the unique name created in step 1.
Note
If multiple scripts perform the process in step 4 at the same timing, more than N scripts may be executed.
Applications
The use of flag files is also effective in the following cases:
- To prohibit multiple invocations of a script invoked by a job, control it as N=1.
- If you want to wait for one process to finish before starting another, judge from the presence or absence of a flag file.
Comments
0 comments
Article is closed for comments.