def deleteJob(cur, job_id): print "deleting job id", job_id jrids = bu.jobResultIds(cur, job_id) for jrid in jrids: bu.deleteJobResult(cur, jrid) bu.deleteJobIdFromQueue(cur, job_id) cur.execute('DELETE FROM Jobs WHERE Jobs.id = %s;', job_id) bu.printDeleted(int(cur.rowcount), "Jobs") print "deleting job id", job_id, "done"
def dumpCSVForJob(cur, job_number, stat_ids, stat_names): job_result_ids = bu.jobResultIds(cur, job_number) stats_for_job_results = [] for job_result_id in job_result_ids : stat_values = statValuesForCSV(cur, job_number, job_result_id, stat_ids) stats_for_job_results.append( stat_values) #Sort by problem_id stats_for_job_results.sort(cmp = lambda x,y:cmp(x[1],y[1])) outfile_name=str(job_number) + '.csv' outfile = open(outfile_name, 'w') writeDelimLn(outfile, CSVHeaders(stat_names)); for stat_values in stats_for_job_results: writeDelimLn(outfile, stat_values) outfile.close()