Project

General

Profile

Configuration » History » Version 2

Marc Dequènes, 2018-06-18 17:39

1 1 Marc Dequènes
h1. Logging
2
3
The following verbosity levels are available:
4
* quiet: display only errors
5
* normal: informative and warning, as well as errors
6
* verbose: everything above plus debug information
7
8
Logging is always done on console, and verbosity can be adjusted in log/console_level.
9
10
Logging to file can be done if a log directory with proper permissions is given in log.file.directory. The verbosity can be adjusted in log/file/level.
11
12
13
h1. Scheduling and Processing
14
15
The spooling/watch_path directory is watched (using inotify).
16
17
If spooling/file_name_pattern is set to a regex, then the file MUST match or be rejected. If the regex contains named "capture groups":http://ruby.runpaint.org/regexps#captures, then the corresponding data will be associated to the file for later pattern replacement.
18
19 2 Marc Dequènes
If spooling/file_content_patterns is set to a list of regex, then the file is read and each regex is tested against each line of the file. Contrary to spooling/file_name_pattern, these regex may not match, and are only useful to fetch data using named capture groups. If file_content_patterns_case_insensitive then the regex will ignore case for matching.
20 1 Marc Dequènes
21 2 Marc Dequènes
A file is considered unique based on its key, which is by default its file name. if you need a more flexible method, you can override the spooling/file_keys list of strings, with each %<var>% being replaced by previously fetched data. The first resulting string in the list to be fully determined (all
22
%%<var>%% are defined) will be the final key; this allows for fallbacks when file content does not always contains all patterns.
23 1 Marc Dequènes
24
If two files have the same key, they are considered identical, and the second file is not scheduled but deleted. You may wish to consider cancelling an operation instead, which can be done by setting spooling/cancel_key to a string similar to spooling/file_key. In this case, if both files have the same key but a different cancel key, both are deleted (if the cancel key is identical, the new file is considered a duplicate and deleted as usual).
25
26
If spooling/min_age is set to a number of seconds, then a new file won't be considered for scheduling until it is old enough. If spooling/max_age is set to a number of seconds, then a file this old will be rejected and deleted.
27
28
Each time a file comes in, or has finished to be processed, and every spooling/reschedule_interval seconds, the program tries to process scheduled files. it will run as many as spooling/max_concurrency file processing at the same time.
29
30
The file processing is done by invoking spooling/command. The fetched file data can be used to provide arguments to the command using %<var>% patterns as seen previously.
31
32
h1. Load Check
33
34
If you want to check an external condition to allow processing, for example when the system load is not too high, then you can specify either an external script or a Ruby plugin in load_check/script. The method (exec/plugin) must be set in load_check/type. It will be invoked every load_check/interval seconds (defaults to 120s).
35
36
An external script must echo "0" or "1", and a Ruby plugin a boolean. "1" or true everything's all right and processing of files will occur, while "0" or false means no job will be scheduled. If the script returns a non-null exit code or echo an unexpected string (or nothing), or if the Ruby plugin raise an exception, the load status will not be updated. The load is considered to be OK at startup.
37
38
A Ruby plugin must provide a 'check' method in the top namespace. It will be loaded in an anonymous Module and transformed into a module function. You are free to load external libraries, create others methods or inner classes/modules but the simpler the better.
39
40
The script or plugin processing may run for a long time without endangering the files processing, nevertheless no
41
more than one will be run at the same, so if it never ends the load status will remain unchanged forever.