launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04569
[Merge] lp:~danilo/launchpad/bug-820511 into lp:launchpad
Данило Шеган has proposed merging lp:~danilo/launchpad/bug-820511 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #820511 in Launchpad itself: "Job scripts don't report job ids"
https://bugs.launchpad.net/launchpad/+bug/820511
For more details, see:
https://code.launchpad.net/~danilo/launchpad/bug-820511/+merge/71179
= Bug 820511 =
Log the job ID and class name on the INFO level in the runner.
== Tests ==
bin/test -cvvt test_runner
== Demo and Q/A ==
Run any jobs (eg. cronscripts/run_jobs.py packaging_translations) with no -v parameters and note how job ID is listed along with the class name.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/services/job/runner.py
lib/lp/services/job/tests/test_runner.py
--
https://code.launchpad.net/~danilo/launchpad/bug-820511/+merge/71179
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~danilo/launchpad/bug-820511 into lp:launchpad.
=== modified file 'lib/lp/services/job/runner.py'
--- lib/lp/services/job/runner.py 2011-06-21 13:24:57 +0000
+++ lib/lp/services/job/runner.py 2011-08-11 11:21:27 +0000
@@ -182,8 +182,11 @@
"""Attempt to run a job, updating its status as appropriate."""
job = IRunnableJob(job)
- self.logger.debug(
- 'Running job in status %s' % (job.status.title,))
+ class_name = job.__class__.__name__
+ job_id = removeSecurityProxy(job).job.id
+ self.logger.info(
+ 'Running %s (ID %d) in status %s' % (
+ class_name, job_id, job.status.title,))
job.start()
transaction.commit()
do_retry = False
@@ -262,7 +265,8 @@
def _logOopsId(self, oops_id):
"""Report oopses by id to the log."""
if self.logger is not None:
- self.logger.info('Job resulted in OOPS: %s' % oops_id)
+ self.logger.info('Job resulted in OOPS: %s' % (
+ oops_id))
self.oops_ids.append(oops_id)
@@ -402,10 +406,10 @@
packages=('_pythonpath', 'twisted', 'ampoule'), env=env)
super(TwistedJobRunner, self).__init__(logger, error_utility)
self.job_source = job_source
- import_name = '%s.%s' % (
+ self.import_name = '%s.%s' % (
removeSecurityProxy(job_source).__module__, job_source.__name__)
self.pool = pool.ProcessPool(
- JobRunnerProcess, ampChildArgs=[import_name, str(dbuser)],
+ JobRunnerProcess, ampChildArgs=[self.import_name, str(dbuser)],
starter=starter, min=0, timeout_signal=SIGHUP)
def runJobInSubprocess(self, job):