...
- JS starts as soon as file matching with Regular Expression found in the directory.
No Format This directory is set in the "File Order Sources" area in the "Steps/Nodes" view of the "load_files" job chain. as shown in the screenshot below:
- JobScheduler's
aquire_lock
job matches files using regular expressions and determines the file's category - for example, Berlin or Munich.No Format The regular expressions are also defined in the "File Order Sources" area shown in the screenshot. Note that for simplicity the regular expressions match the prefixes "a" and "b" in the file names and not directly "Berlin" or "Munich". The {{aquire_lock}} job uses a Rhino JavaScript to try to aquire the lock and either wait if the lock is not available or proceed to the next node if it is. This script is listed below:
...
The following screenshot from the JobScheduler's JOE interface shows the nodes in the load_files
job chain and their related states:
The release_lock
job uses a similar Rhino JavaScript to the aquire_lock
as can be seen in the following listing:
Code Block | ||
---|---|---|
| ||
function spooler_process() \{ try \{ var parameters = spooler_task.order().params(); var filePath = "" + String(parameters.value("scheduler_file_path")); spooler_log.info( " scheduler_file_path : " + filePath ); var lockName = "" + String(parameters.value( "lock_name" )); spooler_log.info( " lock_name : " + lockName ); /* var fileParts = filePath.split("\\"); var fileName = fileParts[fileParts.length-1]; spooler_log.info( "fileName : " + fileName ); if(fileName.match("^a[A-Za-z0-9_]*\.csv$")) \{ var lockName = "BERLIN_PROC"; var lock_name = "BERLIN_PROC"; spooler_log.info( "File matched with berlin lock_name : "+ lockName ); \} if(fileName.match("^b[A-Za-z0-9_]*\.csv$")) \{ var lockName = "MUNICH_PROC"; spooler_log.info( "File matched with berlin lock_name : "+ lockName ); \} */ if (spooler.locks().lock_or_null( lockName )) \{ spooler.locks().lock( lockName ).remove(); \} return true; \} catch (e) \{ spooler_log.warn("error occurred: " + String(e)); return false; \} \} |
...