def ReadCronJobRun(self, job_id, run_id): """Reads a single cron job run from the db.""" for run in self.cronjob_runs.values(): if run.cron_job_id == job_id and run.run_id == run_id: return run raise db.UnknownCronJobRunError( "Run with job id %s and run id %s not found." % (job_id, run_id))
def ReadCronJobRun(self, job_id, run_id, cursor=None): """Reads a single cron job run from the db.""" query = ("SELECT run, UNIX_TIMESTAMP(write_time) FROM cron_job_runs " "WHERE job_id = %s AND run_id = %s") num_runs = cursor.execute( query, [job_id, db_utils.CronJobRunIDToInt(run_id)]) if num_runs == 0: raise db.UnknownCronJobRunError( "Run with job id %s and run id %s not found." % (job_id, run_id)) return self._CronJobRunFromRow(cursor.fetchall()[0])