PQEXPIRE

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
SIGNALS
STATISTICS
EXAMPLE
SEE ALSO
DIAGNOSTICS

NAME

pqexpire - program to delete old products from a Unidata LDM product queue

SYNOPSIS

pqexpire [-v] [-x] [-w] [-l logdest] [-q queue] [-i interval] [-a age] [-f feedtype] [-p pattern]

DESCRIPTION

This program deletes old data products from a local product queue (see pq(3)). It scans from the oldest product in the queue towards the most recent, deleting those which are older than age which also match the feedtype and pattern specifications.

If other programs insert products into a product queue, pqexpire may be run on the queue to keep it from eventually filling up, but it is no longer required. The pq library now automatically deletes oldest products from the queue efficiently to make space for inserting a new product, when needed.

Although not required, this program may be used with an ldmd(1) server that inserts products from one or more upstream nodes into a queue, or with pqing(1) ingesters that insert LDM products into a queue from a data source. It can be run manually or periodically by cron(1), or by ldmd(1) at startup, from an exec line in the configuration file.

Statistics are output about the number and size of products deleted and queue usage.

In typical use (see the -i interval option below), the program makes multiple scans through the queue. In this mode, we wish to keep the scans at the "old" end of the queue (away from the action). So, we terminate a scan by by conditions other than reaching the insertion end of the queue. A scan will be terminated by hitting a lock held by another process. It will also be terminated when it reaches a certain point in the queue, which is determined by a heuristic based upon the product latency encountered during the scan and the interval.

OPTIONS

-v

Verbose logging. When this option is specified, for every product that is deleted from the queue a line is emitted that contains information about the product. Queue usage statistics are emitted on each pass, as well.

-x

Debugging information is also emitted.

-w

Wait on region locks. The default is to treat hitting a locked region the same as end of queue.

−l logdest

Log to logdest. One of ’’ (system logging daemon), ’-’ (standard error stream), or file logdest. Default is the standard error stream if the process has a controlling terminal (i.e., the process isn’t a daemon); otherwise, either the LDM log file or the system logging daemon (execute this program with just the option ’-?’ to determine which).

-q queue

The pathname of the data product queue. The default is $(regutil /queue/path) The configuration default can be overridden by setting the environment variable LDMPQFNAME. Use of -q overrides the default and the environment variable.

−i interval

Looping interval, in seconds. The default is 300 seconds. If the interval is zero, the program makes one pass through the queue and exits. When interval is non-zero, the program performs multiple scans of the queue, sleeping interval seconds between each scan. In this case, the program will continue to run until terminated by an external signal. The time reference for product removal is reset on each pass. When you specify an interval of zero, you probably want to specify the -w flag as well.

−a age

Minimum product age, in hours, as a floating-point number. Only products that were created more than age hours ago will be removed from the queue. The default is 1.0833 hours (one hour + 300 seconds).

−f feedtype

Deletes from the queue only products that have a feedtype that is a member of the feedtype set. The default is ‘ANY’, specifying all feed types. See pqact(1) for a list of basic feed types and the use of feedtype expressions to specify combinations of basic feed types.

−p pattern

Deletes from the product queue only products whose identifier matches the regular expression pattern. The default is ‘.*’, specifying all products.

SIGNALS

SIGTERM

Graceful termination.

SIGINT

Immediate termination.

SIGUSR1

Refresh logging (if configure(1) executed without the "--with-ulog" option) and write statistics to log output.

SIGUSR2

Cyclically increment the verbosity of the program. Assumming the program was started without the -v or -x switches, the first SIGUSR2 will make it verbose and LOG_INFO priority messages will appear. The second will turn on the LOG_DEBUG priority messages as well. A third will take it back to the normal state.

STATISTICS

The program emits data rate statistics each time through the main loop. The time base for this rate is creation time of the newest product deleted minus the creation of the oldest, taken over the lifetime of the program. So, there is a smoothing effect.

EXAMPLE

The following invocation will delete WSI (NEXTRAD) products older than .23333 hours (14 minutes) from a product queue in /tmp/ldm.pq. It will loop every 120 seconds, deleting more products as they get old enough.

pqexpire -i 120 -a .23333 -f WSI -q /tmp/ldm.pq

SEE ALSO

ldmd(1), pqact(1), pqing(1), pq(3), ulog(3), syslogd(8), WWW URL http://www.unidata.ucar.edu/software/ldm/.

DIAGNOSTICS

Error and log messages are written using the ulog(3) interface. The lower layer pq(3) library will emit messages of the form "fcntl F_WRLCK failed for rgn ..." when pqexpire hits a lock. In the context of this program, these messages are normal and not indicative of a problem.