Exemplo n.º 1
0
 def ReadCronJobRun(self, job_id, run_id):
   """Reads a single cron job run from the db."""
   for run in itervalues(self.cronjob_runs):
     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))
Exemplo n.º 2
0
  def ReadCronJobRun(self, job_id, run_id, cursor=None):
    """Reads a single cron job run from the db."""
    query = ("SELECT run, write_time FROM cron_job_runs "
             "WHERE job_id = %s AND run_id = %s")
    num_runs = cursor.execute(query, [job_id, 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])