commit/galaxy-central: dan: Allow tool_runner rerun to accept a job_id instead of a dataset_id.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/dc74a95853b6/ Changeset: dc74a95853b6 User: dan Date: 2014-05-13 21:12:25 Summary: Allow tool_runner rerun to accept a job_id instead of a dataset_id. Affected #: 1 file diff -r f7de39159497fbcffb3f0ed785f26ecf56b40155 -r dc74a95853b6ebe05f811b78b9a6cfbe43211fc8 lib/galaxy/webapps/galaxy/controllers/tool_runner.py --- a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py +++ b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py @@ -106,33 +106,41 @@ **vars ) @web.expose - def rerun( self, trans, id=None, from_noframe=None, **kwd ): + def rerun( self, trans, id=None, from_noframe=None, job_id=None, **kwd ): """ Given a HistoryDatasetAssociation id, find the job and that created the dataset, extract the parameters, and display the appropriate tool form with parameters already filled in. """ - if not id: - error( "'id' parameter is required" ); - try: - id = int( id ) - - except: - # it's not an un-encoded id, try to parse as encoded + if job_id: try: - id = trans.security.decode_id( id ) + job_id = trans.security.decode_id( job_id ) + job = trans.sa_session.query( trans.app.model.Job ).get( job_id ) except: - error( "Invalid value for 'id' parameter" ) - - # Get the dataset object - data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( id ) - #only allow rerunning if user is allowed access to the dataset. - if not ( trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), data.dataset ) ): - error( "You are not allowed to access this dataset" ) - # Get the associated job, if any. - job = data.creating_job - if not job: - raise Exception("Failed to get job information for dataset hid %d" % data.hid) + error( "Invalid value for 'job_id' parameter" ) + param_error_text = "Failed to get parameters for job id %d " % job_id + else: + if not id: + error( "'id' parameter is required" ); + try: + id = int( id ) + except: + # it's not an un-encoded id, try to parse as encoded + try: + id = trans.security.decode_id( id ) + except: + error( "Invalid value for 'id' parameter" ) + + # Get the dataset object + data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( id ) + #only allow rerunning if user is allowed access to the dataset. + if not ( trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), data.dataset ) ): + error( "You are not allowed to access this dataset" ) + # Get the associated job, if any. + job = data.creating_job + if not job: + raise Exception("Failed to get job information for dataset hid %d" % data.hid) + param_error_text = "Failed to get parameters for dataset id %d " % data.id # Get the tool object tool_id = job.tool_id tool_version = job.tool_version @@ -172,7 +180,7 @@ try: params_objects = job.get_param_values( trans.app, ignore_errors = True ) except: - raise Exception( "Failed to get parameters for dataset id %d " % data.id ) + raise Exception( param_error_text ) upgrade_messages = tool.check_and_update_param_values( params_objects, trans, update_values=False ) # Need to remap dataset parameters. Job parameters point to original # dataset used; parameter should be the analygous dataset in the 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)
-
commits-noreply@bitbucket.org