Let’s have defined variable
EVL_RUN_ID_FILE with the path to the file which contains the high watermark of some incremental ID. (Let’s call such value
RUN_ID as the purpose is usually having unique ID of each job.)
The invocation of the command ‘evl_increment_run_id’ takes the value from the file defined by
EVL_RUN_ID_FILE, increase it by one and write it back to file and also to ‘stdout’.
So one can use it this way:
In each job, there would be
and then the value can be used in the mapping for example:
static long run_id = atol(std::getenv("EVL_RUN_ID"));
Data type of
RUN_ID is ‘long’.
EVL_RUN_ID_FILE is not defined, then ‘evl_increment_run_id’ command fail.
If it is defined, but the file doesn’t exist or is empty, then the file is created with the initial value~0.
When the file
EVL_RUN_ID_FILE is locked by other process, ‘evl_increment_run_id’ will try every 300\,ms to get access. It will wait at most
EVL_RUN_ID_FILE_LOCK_WAIT seconds before fail. Default is 30 seconds.