l.s.g.BaseDatabaseGarbageCollector(LaunchpadCronScript) : class documentation

Part of lp.scripts.garbo View In Hierarchy

Known subclasses: lp.scripts.garbo.DailyDatabaseGarbageCollector, lp.scripts.garbo.FrequentDatabaseGarbageCollector, lp.scripts.garbo.HourlyDatabaseGarbageCollector

Abstract base class to run a collection of TunableLoops.
Method __init__ Construct new LaunchpadScript.
Method add_my_options Optionally customize this hook to define your own options.
Method main Define the meat of your script here. Must be defined.
Method get_remaining_script_time Undocumented
Method script_timeout Undocumented
Method get_loop_logger Retrieve a logger for use by a particular task.
Method get_loop_abort_time Undocumented
Method run_tasks_in_thread Worker thread target to run tasks.

Inherited from LaunchpadCronScript:

Method get_last_activity Return the last activity, if any.
Method record_activity Record the successful completion of the script.

Inherited from LaunchpadScript (via LaunchpadCronScript):

Method handle_options Undocumented
Method name Enable subclasses to override with command-line arguments.
Method dbuser Enable subclasses to override with command-line arguments.
Method login Super-convenience method that avoids the import.
Method lockfilename Return lockfilename.
Method lockfilepath Undocumented
Method setup_lock Create lockfile.
Method lock_or_die Attempt to lock, and sys.exit(1) if the lock's already taken.
Method unlock Release the lock. Do this before going home.
Method run Actually run the script, executing zcml and initZopeless.
Method lock_and_run Call lock_or_die(), and then run() the script.
Method _init_zca Initialize the ZCA, this can be overridden for testing purposes.
Method _init_db Initialize the database transaction.
def __init__(self, test_args=None):
Construct new LaunchpadScript.

Name is a short name for this script; it will be used to assemble a lock filename and to identify the logger object.

Use dbuser to specify the user to connect to the database; if not supplied a default will be used.

Specify test_args when you want to override sys.argv. This is useful in test scripts.

ParametersloggerUse this logger, instead of initializing global logging.
def add_my_options(self):

Optionally customize this hook to define your own options.

This method should contain only a set of lines that follow the template:

self.parser.add_option("-f", "--foo", dest="foo",
default="foobar-makes-the-world-go-round", help="You are joking, right?")
def main(self):
Define the meat of your script here. Must be defined.

Raise LaunchpadScriptFailure if you encounter an error condition that makes it impossible for you to proceed; sys.exit(1) will be invoked in that situation.

def get_remaining_script_time(self):
Undocumented
@property
def script_timeout(self):
Undocumented
def get_loop_logger(self, loop_name):
Retrieve a logger for use by a particular task.

The logger will be configured to add the loop_name as a prefix to all log messages, making interleaved output from multiple threads somewhat readable.

def get_loop_abort_time(self, num_remaining_tasks):
Undocumented
def run_tasks_in_thread(self, tunable_loops):
Worker thread target to run tasks.

Tasks are removed from tunable_loops and run one at a time, until all tasks that can be run have been run or the script has timed out.

API Documentation for Launchpad, generated by pydoctor at 2020-01-24 00:00:18.