[hg] galaxy 1628: Fixes for the incorrect_gops_jobs script.
details: http://www.bx.psu.edu/hg/galaxy/rev/54f12bb6cb29 changeset: 1628:54f12bb6cb29 user: Greg Von Kuster <greg@bx.psu.edu> date: Wed Nov 12 15:19:27 2008 -0500 description: Fixes for the incorrect_gops_jobs script. 2 file(s) affected in this change: scripts/others/incorrect_gops_jobs.py scripts/others/incorrect_gops_jobs.sh diffs (106 lines): diff -r 2cf304a0c1c6 -r 54f12bb6cb29 scripts/others/incorrect_gops_jobs.py --- a/scripts/others/incorrect_gops_jobs.py Wed Nov 12 10:16:04 2008 -0500 +++ b/scripts/others/incorrect_gops_jobs.py Wed Nov 12 15:19:27 2008 -0500 @@ -1,6 +1,7 @@ #!/usr/bin/env python """ -Fetch jobs using gops_intersect, gops_merge, gops_subtract, gops_complement, gops_coverage wherein the second dataset doesn't have chr, start and end in standard columns 1,2 and 3. +Fetch jobs using gops_intersect, gops_merge, gops_subtract, gops_complement, gops_coverage +wherein the second dataset doesn't have chr, start and end in standard columns 1, 2 and 3. """ from galaxy import eggs @@ -38,39 +39,53 @@ file_path = configuration['file_path'] app = TestApplication( database_connection=database_connection, file_path=file_path ) jobs = {} - for job in app.model.Job.filter( - sa.and_( - app.model.Job.table.c.create_time.between('2008-05-23','2008-11-29'), - app.model.Job.table.c.state == 'ok', - sa.or_(app.model.Job.table.c.tool_id == 'gops_intersect_1', - app.model.Job.table.c.tool_id == 'gops_subtract_1', - app.model.Job.table.c.tool_id == 'gops_merge_1', - app.model.Job.table.c.tool_id == 'gops_coverage_1', - app.model.Job.table.c.tool_id == 'gops_complement_1', - ), - sa.not_(app.model.Job.table.c.command_line.like('%-2 1,2,3%')) - )).all(): - for od in job.output_datasets: - ds = app.model.Dataset.get(od.dataset_id) - if not ds.deleted: - for hda in ds.history_associations: - hist = app.model.History.get(hda.history_id) - if hist.user_id: - user = app.model.User.get(hist.user_id) - jobs[job.id] = {} - jobs[job.id]['dataset_id'] = ds.id - jobs[job.id]['dataset_create_time'] = ds.create_time - jobs[job.id]['dataset_name'] = hda.name - jobs[job.id]['hda_id'] = hda.id - jobs[job.id]['hist_id'] = hist.id - jobs[job.id]['hist_name'] = hist.name - jobs[job.id]['hist_modified_time'] = hist.update_time - jobs[job.id]['user_email'] = user.email + try: + for job in app.model.Job.filter( sa.and_( app.model.Job.table.c.create_time.between( '2008-05-23', '2008-11-29' ), + app.model.Job.table.c.state == 'ok', + sa.or_( app.model.Job.table.c.tool_id == 'gops_intersect_1', + app.model.Job.table.c.tool_id == 'gops_subtract_1', + app.model.Job.table.c.tool_id == 'gops_merge_1', + app.model.Job.table.c.tool_id == 'gops_coverage_1', + app.model.Job.table.c.tool_id == 'gops_complement_1', + ), + sa.not_( app.model.Job.table.c.command_line.like( '%-2 1,2,3%' ) ) + ) + ).all(): + print "# processing job id %s" % str( job.id ) + for jtoda in job.output_datasets: + print "# --> processing JobToOutputDatasetAssociation id %s" % str( jtoda.id ) + hda = app.model.HistoryDatasetAssociation.get( jtoda.dataset_id ) + print "# ----> processing HistoryDatasetAssociation id %s" % str( hda.id ) + if not hda.deleted: + # Probably don't need this check, since the job state should suffice, but... + if hda.dataset.state == 'ok': + history = app.model.History.get( hda.history_id ) + print "# ------> processing history id %s" % str( history.id ) + if history.user_id: + user = app.model.User.get( history.user_id ) + jobs[ job.id ] = {} + jobs[ job.id ][ 'hda_id' ] = hda.id + jobs[ job.id ][ 'hda_name' ] = hda.name + jobs[ job.id ][ 'hda_info' ] = hda.info + jobs[ job.id ][ 'history_id' ] = history.id + jobs[ job.id ][ 'history_name' ] = history.name + jobs[ job.id ][ 'history_update_time' ] = history.update_time + jobs[ job.id ][ 'user_email' ] = user.email + except Exception, e: + print "# caught exception: %s" % str( e ) - print "Number of Incorrect Jobs: %d\n"%(len(jobs)) - print "#job_id\tdataset_id\tdataset_create_time\thda_id\thistory_id\thistory_name\thistory_modified_time\tuser_email" + print "\n\n# Number of incorrect Jobs: %d\n\n" % ( len( jobs ) ) + print "#job_id\thda_id\thda_name\thda_info\thistory_id\thistory_name\thistory_update_time\tuser_email" for jid in jobs: - print "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" %(jid,jobs[jid]['dataset_id'],jobs[jid]['dataset_create_time'],jobs[jid]['dataset_name'],jobs[jid]['hda_id'],jobs[jid]['hist_id'],jobs[jid]['hist_name'],jobs[jid]['hist_modified_time'],jobs[jid]['user_email'] ) + print "%s\t%s\t%s\t%s\t%s\t%s\t%s" % \ + ( jid, jobs[ jid ][ 'hda_id' ], + jobs[ jid ][ 'hda_name' ], + jobs[ jid ][ 'hda_info' ], + jobs[ jid ][ 'history_id' ], + jobs[ jid ][ 'history_name' ], + jobs[ jid ][ 'history_update_time' ], + jobs[ jid ][ 'user_email' ] + ) sys.exit(0) if __name__ == "__main__": diff -r 2cf304a0c1c6 -r 54f12bb6cb29 scripts/others/incorrect_gops_jobs.sh --- a/scripts/others/incorrect_gops_jobs.sh Wed Nov 12 10:16:04 2008 -0500 +++ b/scripts/others/incorrect_gops_jobs.sh Wed Nov 12 15:19:27 2008 -0500 @@ -1,4 +1,4 @@ #!/bin/sh cd `dirname $0`/../.. -python ./scripts/others/incorrect_gops_jobs.py ./universe_wsgi.ini +python ./scripts/others/incorrect_gops_jobs.py ./universe_wsgi.ini >> ./scripts/others/incorrect_gops_jobs.log
participants (1)
-
Greg Von Kuster