ProductOpener::Producers - functions specific to the platform for producers
ProductOpener::Producers
contains the functions specific to the producers platform:
- Functions to import CSV / Excel files, match column names, convert to OFF csv format - Minion tasks for import and export
..
Function to get the backend minion
None
The backend minion $minion
Load a CSV or Excel file in a Perl structure.
- CSV files should be in UTF-8 and separated with a comma. They are processed with Text::CSV. - Excel files are first converted to CSV with gnumeric's ssconvert.
CSV or Excel file
A hash ref with:
A reference to an array of header names.
A reference to an array of rows, containing each an array of column values
Populates global $fields_columns_names_for_lang for the specified language.
The function creates a hash of all the possible localized column names that we can automatically recognize, and maps them to the corresponding field in OFF.
Language code (string)
Reference to the column names hash.
Minion tasks that can be added to the queue by standalone scripts or the web site, that are then executed by the minion-off and minion-off-pro daemons.
The daemons are configured in /etc/systemd/system
e.g. /etc/systemd/system/minion-off.service
[Unit] Description=off minion workers After=postgresql.service
[Service] Type=simple User=off WorkingDirectory=/srv/off/scripts Environment="PERL5LIB=/srv/off/lib/" ExecStart=/srv/off/scripts/minion_producers.pl minion worker -m production -q openfoodfacts.org KillMode=process
[Install] WantedBy=multi-user.target