Skip to content

Commit

Permalink
Merge pull request #1488 from martenson/fix-jobparam-hack
Browse files Browse the repository at this point in the history
fix old jobparam hack for importing files to library
  • Loading branch information
jmchilton committed Jan 14, 2016
2 parents 84fd89d + 74afe41 commit f41550f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
7 changes: 5 additions & 2 deletions lib/galaxy/tools/actions/upload_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def _chown( path ):
return json_file_path


def create_job( trans, params, tool, json_file_path, data_list, folder=None, history=None ):
def create_job( trans, params, tool, json_file_path, data_list, folder=None, history=None, job_params=None ):
"""
Create the upload job.
"""
Expand Down Expand Up @@ -395,7 +395,10 @@ def create_job( trans, params, tool, json_file_path, data_list, folder=None, his
# open( dataset.file_name, "w" ).close()
job.object_store_id = object_store_id
job.set_state( job.states.NEW )
job.set_handler(tool.get_job_handler(None))
job.set_handler( tool.get_job_handler( None ) )
if job_params:
for name, value in job_params.iteritems():
job.add_parameter( name, value )
trans.sa_session.add( job )
trans.sa_session.flush()

Expand Down
8 changes: 4 additions & 4 deletions lib/galaxy/webapps/galaxy/api/lda_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,10 @@ def load( self, trans, **kwd ):
abspath_datasets.append( ud )
json_file_path = upload_common.create_paramfile( trans, abspath_datasets )
data_list = [ ud.data for ud in abspath_datasets ]
job, output = upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=folder )
# HACK: Prevent outputs_to_working_directory from overwriting inputs when "linking"
job.add_parameter( 'link_data_only', dumps( kwd.get( 'link_data_only', 'copy_files' ) ) )
job.add_parameter( 'uuid', dumps( kwd.get( 'uuid', None ) ) )
job_params = {}
job_params['link_data_only'] = dumps( kwd.get( 'link_data_only', 'copy_files' ) )
job_params['uuid'] = dumps( kwd.get( 'uuid', None ) )
job, output = upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=folder, job_params=job_params )
trans.sa_session.add( job )
trans.sa_session.flush()
job_dict = job.to_dict()
Expand Down
8 changes: 4 additions & 4 deletions lib/galaxy/webapps/galaxy/controllers/library_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,10 +1115,10 @@ def upload_dataset( self, trans, cntrller, library_id, folder_id, replace_datase
status='error' ) )
json_file_path = upload_common.create_paramfile( trans, uploaded_datasets )
data_list = [ ud.data for ud in uploaded_datasets ]
job, output = upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=library_bunch.folder )
# HACK: Prevent outputs_to_working_directory from overwriting inputs when "linking"
job.add_parameter( 'link_data_only', dumps( kwd.get( 'link_data_only', 'copy_files' ) ) )
job.add_parameter( 'uuid', dumps( kwd.get( 'uuid', None ) ) )
job_params = {}
job_params['link_data_only'] = dumps( kwd.get( 'link_data_only', 'copy_files' ) )
job_params['uuid'] = dumps( kwd.get( 'uuid', None ) )
job, output = upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=library_bunch.folder, job_params=job_params )
trans.sa_session.add( job )
trans.sa_session.flush()
return output
Expand Down

0 comments on commit f41550f

Please sign in to comment.