commit/galaxy-central: inithello: Made genome tool backwards compatible with python 2.5.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/29b8e39db109/ changeset: 29b8e39db109 user: inithello date: 2012-06-04 19:18:58 summary: Made genome tool backwards compatible with python 2.5. affected #: 9 files diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c lib/galaxy/jobs/deferred/genome_transfer.py --- a/lib/galaxy/jobs/deferred/genome_transfer.py +++ b/lib/galaxy/jobs/deferred/genome_transfer.py @@ -1,6 +1,8 @@ """ Module for managing genome transfer jobs. """ +from __future__ import with_statement + import logging, shutil, gzip, bz2, zipfile, tempfile, tarfile, sys from galaxy import eggs @@ -212,13 +214,17 @@ transfer.state = 'done' self.sa_session.add( job ) self.sa_session.add( transfer ) + if transfer.state == 'done': + if params[ 'indexes' ] is not None: + for indexer in params[ 'indexes' ]: + incoming = dict(indexer=indexer, dbkey=params[ 'dbkey' ], intname=params[ 'intname' ], path=transfer.path, user=params['user'] ) + deferred = self.tool.execute( self, set_output_hid=False, history=None, incoming=incoming, transfer=transfer, deferred=job ) + job.params[ 'indexjobs' ].append( deferred[0].id ) + else: + job.state = self.app.model.DeferredJob.states.OK + self.sa_session.add( job ) + return self.app.model.DeferredJob.states.OK self.sa_session.flush() - if transfer.state == 'done' and params[ 'indexes' ] is not None: - for indexer in params[ 'indexes' ]: - incoming = dict(indexer=indexer, dbkey=params[ 'dbkey' ], intname=params[ 'intname' ], path=transfer.path, user=params['user'] ) - deferred = self.tool.execute( self, set_output_hid=False, history=None, incoming=incoming, transfer=transfer, deferred=job ) - job.params[ 'indexjobs' ].append( deferred[0].id ) - return self.app.model.DeferredJob.states.OK def _check_compress( self, filepath ): retval = '' diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c lib/galaxy/jobs/deferred/liftover_transfer.py --- a/lib/galaxy/jobs/deferred/liftover_transfer.py +++ b/lib/galaxy/jobs/deferred/liftover_transfer.py @@ -1,6 +1,8 @@ """ Module for managing genome transfer jobs. """ +from __future__ import with_statement + import logging, shutil, gzip, tempfile, sys from galaxy import eggs @@ -31,11 +33,11 @@ self.app = app self.sa_session = app.model.context.current - def create_job( self, trans, url, dbkey, from_genome, to_genome, destfile ): + def create_job( self, trans, url, dbkey, from_genome, to_genome, destfile, parentjob ): job = trans.app.transfer_manager.new( protocol='http', url=url ) params = dict( user=trans.user.id, transfer_job_id=job.id, protocol='http', type='init_transfer', dbkey=dbkey, from_genome=from_genome, - to_genome=to_genome, destfile=destfile ) + to_genome=to_genome, destfile=destfile, parentjob=parentjob ) deferred = trans.app.model.DeferredJob( state = self.app.model.DeferredJob.states.NEW, plugin = 'LiftOverTransferPlugin', params = params ) self.sa_session.add( deferred ) self.sa_session.flush() @@ -59,7 +61,19 @@ return self.job_states.WAIT elif job.transfer_job.state == 'new': assert job.params[ 'protocol' ] in [ 'http', 'ftp', 'https' ], 'Unknown protocol %s' % job.params[ 'protocol' ] - self.app.transfer_manager.run( job.transfer_job ) + ready = True + parent = self.sa_session.query( self.app.model.DeferredJob ).get( int( job.params[ 'parentjob' ] ) ) + if not hasattr( parent, 'transfer_job' ): + parent.transfer_job = self.sa_session.query( self.app.model.TransferJob ).get( int( parent.params[ 'transfer_job_id' ] ) ) + if parent.transfer_job.state not in [ 'ok', 'error', 'done' ]: + ready = False + for lo_job in parent.params[ 'liftover' ]: + liftoverjob = self.sa_session.query( self.app.model.TransferJob ).get( int( lo_job ) ) + if liftoverjob: + if liftoverjob.state not in [ 'ok', 'error', 'new', 'done' ]: + ready = False + if ready: + self.app.transfer_manager.run( job.transfer_job ) self.sa_session.add( job.transfer_job ) self.sa_session.flush() return self.job_states.WAIT @@ -116,6 +130,15 @@ job.params[ 'type' ] = 'finish_transfer' transfer.path = os.path.abspath(destfilepath) transfer.state = 'done' + parentjob = self.sa_session.query( self.app.model.DeferredJob ).get( int( job.params[ 'parentjob' ] ) ) + finished = True + for i in parentjob.params[ 'liftover' ]: + sibling = self.sa_session.query( self.app.model.DeferredJob ).get( int( i ) ) + if sibling.state not in [ 'done', 'ok', 'error' ]: + finished = False + if finished: + parentjob.state = self.app.model.DeferredJob.states.OK + self.sa_session.add( parentjob ) self.sa_session.add( job ) self.sa_session.add( transfer ) self.sa_session.flush() diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c lib/galaxy/tools/genome_index/__init__.py --- a/lib/galaxy/tools/genome_index/__init__.py +++ b/lib/galaxy/tools/genome_index/__init__.py @@ -1,4 +1,7 @@ +from __future__ import with_statement + import os, shutil, logging, tempfile, json, tarfile + from galaxy import model, util from galaxy.web.framework.helpers import to_unicode from galaxy.model.item_attrs import UsesAnnotations diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c lib/galaxy/tools/genome_index/index_genome.py --- a/lib/galaxy/tools/genome_index/index_genome.py +++ b/lib/galaxy/tools/genome_index/index_genome.py @@ -5,6 +5,8 @@ usage: %prog history_attrs dataset_attrs job_attrs out_file -G, --gzip: gzip archive file """ +from __future__ import with_statement + import optparse, sys, os, tempfile, time, subprocess, shlex, json, tarfile, shutil class ManagedIndexer(): diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c lib/galaxy/web/controllers/data_admin.py --- a/lib/galaxy/web/controllers/data_admin.py +++ b/lib/galaxy/web/controllers/data_admin.py @@ -30,6 +30,8 @@ @web.expose @web.require_admin def manage_data( self, trans, **kwd ): + if trans.app.config.get_bool( 'enable_beta_job_managers', False ) == False: + return trans.fill_template( '/admin/data_admin/betajob.mako' ) dbkeys = trans.db_builds return trans.fill_template( '/admin/data_admin/data_form.mako', dbkeys=dbkeys ) @@ -87,6 +89,7 @@ newlift = None pass ftp.retrlines('NLST /goldenPath/%s/bigZips/' % dbkey, checker.append) + ftp.quit() for filename in [ dbkey, 'chromFa' ]: for extension in [ '.tar.gz', '.tar.bz2', '.zip', '.fa.gz', '.fa.bz2' ]: testfile = '/goldenPath/%s/bigZips/%s%s' % ( dbkey, filename, extension ) @@ -129,7 +132,7 @@ from_genome = chain[1] to_genome = chain[2] destfile = liftover_url.split('/')[-1].replace('.gz', '') - chainjob.append( trans.app.job_manager.deferred_job_queue.plugins['LiftOverTransferPlugin'].create_job( trans, liftover_url, dbkey, from_genome, to_genome, destfile ) ) + chainjob.append( trans.app.job_manager.deferred_job_queue.plugins['LiftOverTransferPlugin'].create_job( trans, liftover_url, dbkey, from_genome, to_genome, destfile, jobid ) ) job = trans.app.job_manager.deferred_job_queue.plugins['GenomeTransferPlugin'].get_job_status( jobid ) job.params['liftover'] = chainjob trans.app.model.context.current.add( job ) diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c templates/admin/data_admin/betajob.mako --- /dev/null +++ b/templates/admin/data_admin/betajob.mako @@ -0,0 +1,35 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/library/common/common.mako" import="common_javascripts" /> + +<%! + def inherit(context): + if context.get('use_panels'): + return '/webapps/galaxy/base_panels.mako' + else: + return '/base.mako' +%> +<%inherit file="${inherit(context)}"/> + +<%def name="init()"> +<% + self.has_left_panel=False + self.has_right_panel=False + self.message_box_visible=False + self.active_view="user" + self.overlay_visible=False + self.has_accessible_datasets = False +%> +</%def> +<%def name="stylesheets()"> + ${parent.stylesheets()} + ${h.css( "autocomplete_tagging" )} +</%def> +<%def name="javascripts()"> + ${parent.javascripts()} + ${h.js("jquery.autocomplete", "autocomplete_tagging" )} +</%def> +## +## Override methods from base.mako and base_panels.mako +## +<p class="panel-error-message">This feature requires that enable_beta_job_managers be set to True in your Galaxy configuration.</p> \ No newline at end of file diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c templates/admin/data_admin/data_form.mako --- a/templates/admin/data_admin/data_form.mako +++ b/templates/admin/data_admin/data_form.mako @@ -52,7 +52,6 @@ <div class="form-row"><label for="source">Data Source</label><select id="datasource" name="source" label="Data Source"> - <option value="local">localhost</option><option value="UCSC">UCSC</option><option value="Broad">Broad Institute</option><option value="NCBI">NCBI</option> diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c templates/admin/data_admin/download_status.mako --- a/templates/admin/data_admin/download_status.mako +++ b/templates/admin/data_admin/download_status.mako @@ -39,6 +39,7 @@ <a href="${h.url_for( controller='data_admin', action='manage_data' )}">Return to the download form</a><script type="text/javascript"> jobs = ${jsonjobs} + finalstates = new Array('done', 'error', 'ok'); function makeHTML(jobrow) { jc = 'jobrow ' + jobrow['style']; @@ -50,18 +51,6 @@ '<td style="padding: 0px 5px;">' + jobrow['status'] + '</td></tr>'; } - function getNewHtml(jobid, jobtype, elm) { - $.get('${h.url_for( controller='data_admin', action='job_status' )}', { jobid: jobid, jobtype: jobtype }, function(data) { - jsondata = JSON.parse(data); - status = jsondata['status']; - htmldata = makeHTML(jsondata); - idval = '#' + jobtype + '-job-' + jobid; - if (htmldata != undefined) { - $(elm).replaceWith(htmldata); - } - }); - } - function checkJobs() { var alldone = true; var mainjob; @@ -70,9 +59,8 @@ if ($(this).attr('data-jobtype') == 'deferred') { mainjob = $(this).attr('data-jobid'); } - if (status != 'done' && status != 'error' && status != 'ok') { + if ($.inArray(status, finalstates) == -1) { alldone = false; - getNewHtml($(this).attr('data-jobid'), $(this).attr('data-jobtype'), $(this)); } }); if (!alldone) { @@ -88,10 +76,12 @@ $.get('${h.url_for( controller='data_admin', action='get_jobs' )}', { jobid: mainjob }, function(data) { jsondata = JSON.parse(data); for (i in jsondata) { + currentjob = jsondata[i] if (jobs[i] == undefined) { $('#jobStatus').append(makeHTML(jsondata[i])); jobs.push(jsondata[i]); } + $('#' + currentjob['type'] + '-job-' + currentjob['jobid']).replaceWith(makeHTML(currentjob)); } }); } diff -r e276278db3b01601b0432294fa0eef297a0e7937 -r 29b8e39db1094cb5a5586c4f7b404428641d518c templates/webapps/galaxy/admin/index.mako --- a/templates/webapps/galaxy/admin/index.mako +++ b/templates/webapps/galaxy/admin/index.mako @@ -57,7 +57,9 @@ <div class="toolSectionBg"><div class="toolTitle"><a href="${h.url_for( controller='admin', action='quotas', webapp=webapp )}" target="galaxy_main">Manage quotas</a></div><div class="toolTitle"><a href="${h.url_for( controller='library_admin', action='browse_libraries' )}" target="galaxy_main">Manage data libraries</a></div> - <div class="toolTitle"><a href="${h.url_for( controller='data_admin', action='manage_data' )}" target="galaxy_main">Manage local data</a></div> + %if trans.app.config.enable_beta_job_managers: + <div class="toolTitle"><a href="${h.url_for( controller='data_admin', action='manage_data' )}" target="galaxy_main">Manage local data</a></div> + %endif </div></div><div class="toolSectionPad"></div> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket