API:EPrints/Index/Daemon

From EPrints Documentation
Revision as of 18:29, 11 August 2009 by Tdb01r (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Latest Source Code (3.3, 3.2) | Revision Log | Before editing this page please read Pod2Wiki

NAME

EPrints::Index::Daemon - indexer process

DESCRIPTION

This module provides utility wrappers around the indexing engine to provide a daemonised service.

You probably don't want to use anything here directly, instead use the bin/indexer script or EPrints::Plugin::Screen::Admin::IndexerControl.

METHODS

Class Methods

new

 EPrints::Index::Daemon->new( %opts )

Return a new daemon control object. May optionally specify 'session', 'logfile', 'noise' and 'Handler' to control log output.

Accessors

get_timeout

 $daemon->get_timeout

Returns the maximum time to allow an indexing process to take. Defaults to 10 minutes.

get_respawn

 $daemon->get_respawn

Returns the time between respawns. On respawn the log files are rotated. Defaults to 1 day.

In practise respawns are likely to take slightly longer than the time given.

get_interval

 $daemon->get_interval

Returns the time between checks on the indexing queues, when we're idling. Defaults to 30 seconds.

get_pid

 $daemon->get_pid

Get the current indexer pid or undef.

remove_pid

 $daemon->remove_pid

If is_running() is true but you still want to force a new indexer start, remove the existing pid file. Otherwise, you shouldn't have any need to call this method.

is_running

 $daemon->is_running()

Returns true if the indexer appears to be running. Returns undef if no PID was found.

is_child_running

 $daemon->is_child_running()

Returns true if a child process appears to be running.

has_stalled

 $daemon->has_stalled()

Returns true if the indexer appears to have stopped running (i.e. no tick for 10 minutes).

get_last_tick

 $daemon->get_last_tick

Seconds since last tick, based on when the current script started.

log

 $daemon->log( LEVEL, MESSAGE )

Prints MESSAGE to STDERR if noise >= LEVEL.

Control Methods

start

 $daemon->start( $session )

Starts the indexer process from an existing EPrints session.

stop

 $daemon->stop( $session )

Stops the indexer process from an existing EPrints session.

start_daemon

 $daemon->start_daemon()

Starts the indexer process from the current process. You should check the indexer isn't running before calling this method.

This method will fork() then redirect STDOUT and STDERR to logfile (if configured), otherwise messages will be output to STDERR.

Returns true if successful.

stop_daemon

 $daemon->stop_daemon

Stops the indexer process from the current process. You should check the indexer is running before calling this method.

Returns true if successful.

run_index

 $daemon->run_index

Runs a single indexing process for all repositories.

SEE ALSO

EPrints::Index

UNDOCUMENTED METHODS

Warning These methods were found in the source code but didn't have any POD associated with them. This may be because we haven't got around to documenting them yet or it could be because they are internal to the API and not intended for use by other parts of EPrints.

cleanup

get_all_sessions

get_pidfile

handler

real_exit

roll_logs

safe_fork

should_respawn

suicidal

tick

write_pid