Dependency perl program

Problems files

The likelihood is that they'll be some files that can't be created. This can be for any number of reasons, but will be because there's some exceptional circumstances involving the parent files that means that a member of a file type cannot be created while most of its fellow member can be created. Rather than the DPP attempt to create the file each time it's run, it's better to add the file to a list of files in the problems file, called config/problem_files.dat. The DPP reads this file and will not attempt to create any files listed in the problems file.

Example

The problems file is read after the dependency file and so any definitions found in the dependency file are also available when the DPP reads the problems file. Let's suppose the dependency files looks like

#--------------------------------------------
# Define the directories
#--------------------------------------------
Define;commandDir;/home/user/public_html/cgi-bin/update/commands;
Define;dataDir;/home/user/data;
Define;imageDir;/home/user/image;
#--------------------------------------------
# Define the measurement variables
#--------------------------------------------
Define;measVar;pres,temp,sal;
#--------------------------------------------
# Create image in home directory
#--------------------------------------------
$homeDir$/%measVar%YEAR-MONTH-MDAY.jpg;$dataDir$/raw_%measVar%YEAR-MONTH-MDAY.dat;
$commandDir$/createImage.scr DEPEND;

where the last two lines should be on one line, and createImage.scr is a script which has been written to read the /tmp/raw_%measVar%YEAR-MONTH-MDAY.dat and create an image. Now suppose the measurement of salinity failed for the whole of June 2007 and there was a problem on the 14th and 15th of September 2008 which meant that all the raw*.dat only has header information and no data. In this case the problems file might looks like
#-------------------------------------------
# Images that can't be created.
#-------------------------------------------
$homeDir$/sal2007-06-MDAY.jpg;measurement of salinity was not working;
$homeDir$/%measVar%2008-09-14.jpg;parent file only has header;
$homeDir$/%measVar%2008-09-15.jpg;parent file only has header;

where MDAY indicates that files for the whole of that month cannot be created (see Special variables section for more on MDAY), and %measVar$ indicates that the pres*.dat, temp*.dat and sal*.dat for those days cannot be created (see Define variables for more on loops).

Lines beginning with a hash (#) are again just comments. And each line has two parts separated by semi-colons: the filename of the file that cannot be created; and a comment describing the problem. The comment is not used by the DPP, but is a useful reference.

Finding the problems files

The best way of finding the problems file is usually to run the following lines in order:

perl update_files.pl --update
perl update_files.pl --passive

where the first line updates all the files that can be updated and the second line tell the user which files still need updating - so all the problem files that couldn't be updated by the first command.

For each problem, it's probably worth running the commands, which are shown in brackets below the file listing when using the --passive argument, because hopefully there's an error to explain the problem. The user then can either solve the problem or they should add the file into the problems file with the reason for error.

Things to do now

Contact

Page navigation