l.b.s.c._.CheckwatchesMaster(WorkingBase) : class documentation

Part of lp.bugs.scripts.checkwatches View In Hierarchy

Takes responsibility for updating remote bug watches.
Method __init__ Initialize a CheckwatchesMaster.
Method updateBugTrackers Update all the bug trackers that have watches pending.
Method updateBugTracker Updates the given bug trackers's bug watches.
Method forceUpdateAll Update all the watches for bug_tracker_name.
Method updateBugWatches Update the given bug watches.
Method importBug Import a remote bug into Launchpad.
Method _bugTrackerUpdaters Yields functions that can be used to update each bug tracker.
Method _getExternalBugTrackersAndWatches Return an ExternalBugTracker instance for bug_tracker.
Method _updateBugTracker Updates the given bug trackers's bug watches.
Method _getRemoteIdsToCheck Return the remote bug IDs to check for a set of bug watches.

Inherited from WorkingBase:

Method init Undocumented
Method initFromParent Undocumented
Method interaction Context manager for interaction as the given user.
Method transaction Context manager to ring-fence database activity.
Method statement_logging Context manager to start and stop SQL statement logging.
Method warning Record a warning.
Method error Record an error.
Method _statement_logging_start Start logging SQL statements and other database activity.
Method _statement_logging_stop Stop logging SQL statements.
Method _statement_logging_reset Reset the SQL statement log, if enabled.
def __init__(self, transaction_manager, logger=default_log, syncable_gnome_products=None):
Initialize a CheckwatchesMaster.
Parameterstransaction_managerA transaction manager on which begin(), abort() and commit() can be called. Additionally, it should be safe for different threads to use its methods to manage their own transactions (i.e. with thread-local storage).
logAn instance of logging.Logger, or something that provides a similar interface.
@with_interaction
def _bugTrackerUpdaters(self, bug_tracker_names=None):
Yields functions that can be used to update each bug tracker.
@commit_before
def updateBugTrackers(self, bug_tracker_names=None, batch_size=None, scheduler=None):
Update all the bug trackers that have watches pending.

If bug tracker names are specified in bug_tracker_names only those bug trackers will be checked.

A custom scheduler can be passed in. This should inherit from BaseScheduler. If no scheduler is given, SerialScheduler will be used, which simply runs the jobs in order.

@commit_before
@with_interaction
def updateBugTracker(self, bug_tracker, batch_size):
Updates the given bug trackers's bug watches.

If there is an error, logs are updated, and the transaction is aborted.

Parametersbug_trackerAn IBugTracker or the ID of one, so that this method can be called from a different interaction.
ReturnsA boolean indicating if the operation was successful.
@commit_before
@with_interaction
def forceUpdateAll(self, bug_tracker_name, batch_size):
Update all the watches for bug_tracker_name.
Parametersbug_tracker_nameThe name of the bug tracker to update.
batch_sizeThe number of bug watches to update in one go. If zero, all bug watches will be updated.
def _getExternalBugTrackersAndWatches(self, bug_tracker, bug_watches):
Return an ExternalBugTracker instance for bug_tracker.
def _updateBugTracker(self, bug_tracker, batch_size=None):
Updates the given bug trackers's bug watches.
def _getRemoteIdsToCheck(self, remotesystem, bug_watches, server_time=None, now=None, batch_size=None):
Return the remote bug IDs to check for a set of bug watches.

The remote bug tracker is queried to find out which of the
remote bugs in `bug_watches` have changed since they were last
checked. Those which haven't changed are excluded.

:param bug_watches: A set of `BugWatch`es to be checked.
:param remotesystem: The `ExternalBugtracker` on which
    `getModifiedRemoteBugs`() should be called
:param server_time: The time according to the remote server.
    This may be None when the server doesn't specify a remote time.
:param now: The current time (used for testing)
:return: A list of remote bug IDs to be updated.
@commit_before
def updateBugWatches(self, remotesystem, bug_watches_to_update, now=None, batch_size=None):
Update the given bug watches.
def importBug(self, external_bugtracker, bugtracker, bug_target, remote_bug):
Import a remote bug into Launchpad.
Parametersexternal_bugtrackerAn ISupportsBugImport, which talks to the external bug tracker.
bugtrackerAn IBugTracker, to which the created bug watch will be linked.
bug_targetAn IBugTarget, to which the created bug will be linked.
remote_bugThe remote bug id as a string.
ReturnsThe created Launchpad bug.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.