A bit more actual user cleaning.

This commit is contained in:
Nate Coraor
2012-01-18 14:34:00 -05:00
parent 61062a3ae5
commit c362e6202e
6 changed files with 29 additions and 33 deletions
+1
View File
@@ -589,3 +589,4 @@ class Registry( object ):
os.write( fd, '</sniffers>\n' )
os.write( fd, '</datatypes>\n' )
os.close( fd )
os.chmod( self.xml_filename, 0644 )
+1 -1
View File
@@ -2,7 +2,7 @@
Galaxy Security
"""
import logging, socket, operator, pwd
import logging, socket, operator
from datetime import datetime, timedelta
from galaxy.util.bunch import Bunch
from galaxy.util import listify
+9 -19
View File
@@ -30,8 +30,6 @@ from galaxy.datatypes import sniff
from cgi import FieldStorage
from galaxy.util.hash_util import *
from galaxy.util import listify
from galaxy.web import security
import socket
from galaxy.visualization.tracks.visual_analytics import TracksterConfig
@@ -1637,13 +1635,13 @@ class Tool:
DatasetFilenameWrapper( converted_dataset,
datatypes_registry = self.app.datatypes_registry,
tool = Bunch( conversion_name = Bunch( extensions = conv_ext ) ),
name = conversion_name, config_info = self.app.config )
name = conversion_name )
# Wrap actual input dataset
input_values[ input.name ] = \
DatasetFilenameWrapper( input_values[ input.name ],
datatypes_registry = self.app.datatypes_registry,
tool = self,
name = input.name, config_info = self.app.config )
name = input.name )
elif isinstance( input, SelectToolParameter ):
input_values[ input.name ] = SelectToolParameterWrapper(
input, input_values[ input.name ], self.app, other_values = param_dict )
@@ -1681,28 +1679,28 @@ class Tool:
param_dict[name] = DatasetFilenameWrapper( data,
datatypes_registry = self.app.datatypes_registry,
tool = self,
name = name, config_info = self.app.config )
name = name )
if data:
for child in data.children:
param_dict[ "_CHILD___%s___%s" % ( name, child.designation ) ] = DatasetFilenameWrapper( child,config_info = self.app.config )
param_dict[ "_CHILD___%s___%s" % ( name, child.designation ) ] = DatasetFilenameWrapper( child )
for name, hda in output_datasets.items():
# Write outputs to the working directory (for security purposes)
# if desired.
if self.app.config.outputs_to_working_directory:
try:
false_path = [ dp.false_path for dp in output_paths if dp.real_path == hda.file_name ][0]
param_dict[name] = DatasetFilenameWrapper( hda, false_path = false_path, config_info = self.app.config )
param_dict[name] = DatasetFilenameWrapper( hda, false_path = false_path )
open( false_path, 'w' ).close()
except IndexError:
log.warning( "Unable to determine alternate path for writing job outputs, outputs will be written to their real paths" )
param_dict[name] = DatasetFilenameWrapper( hda, config_info = self.app.config )
param_dict[name] = DatasetFilenameWrapper( hda )
else:
param_dict[name] = DatasetFilenameWrapper( hda, config_info = self.app.config )
param_dict[name] = DatasetFilenameWrapper( hda )
# Provide access to a path to store additional files
# TODO: path munging for cluster/dataset server relocatability
param_dict[name].files_path = os.path.abspath(os.path.join( job_working_directory, "dataset_%s_files" % (hda.dataset.id) ))
for child in hda.children:
param_dict[ "_CHILD___%s___%s" % ( name, child.designation ) ] = DatasetFilenameWrapper( child, config_info = self.app.config )
param_dict[ "_CHILD___%s___%s" % ( name, child.designation ) ] = DatasetFilenameWrapper( child )
for out_name, output in self.outputs.iteritems():
if out_name not in param_dict and output.filters:
# Assume the reason we lack this output is because a filter
@@ -2294,7 +2292,7 @@ class DatasetFilenameWrapper( ToolParameterValueWrapper ):
def items( self ):
return iter( [ ( k, self.get( k ) ) for k, v in self.metadata.items() ] )
def __init__( self, dataset, datatypes_registry = None, tool = None, name = None, false_path = None , config_info=None):
def __init__( self, dataset, datatypes_registry = None, tool = None, name = None, false_path = None ):
if not dataset:
try:
# TODO: allow this to work when working with grouping
@@ -2306,14 +2304,6 @@ class DatasetFilenameWrapper( ToolParameterValueWrapper ):
self.dataset = dataset
self.metadata = self.MetadataWrapper( dataset.metadata )
self.false_path = false_path
# create web_display_url attribute
sec = security.SecurityHelper( id_secret=config_info.id_secret )
try:
url = 'http://' + socket.getfqdn() + config_info.cookie_path + '/datasets/' + sec.encode_id(dataset.id) + '/display/?preview=True'
self.web_display_url = url
except:
self.web_display_url = None
def __str__( self ):
if self.false_path is not None:
+1 -1
View File
@@ -149,7 +149,7 @@ class DefaultToolAction( object ):
galaxy.tools.DatasetFilenameWrapper( input_values[ input.name ],
datatypes_registry = trans.app.datatypes_registry,
tool = tool,
name = input.name, config_info = trans.app.config)
name = input.name )
elif isinstance( input, SelectToolParameter ):
input_values[ input.name ] = galaxy.tools.SelectToolParameterWrapper( input, input_values[ input.name ], tool.app, other_values = incoming )
else:
+16 -12
View File
@@ -305,19 +305,19 @@ def add_file( dataset, registry, json_file, output_path ):
'<b>Copy files into Galaxy</b> instead of <b>Link to files without copying into Galaxy</b> so grooming can be performed.'
file_err( err_msg, dataset, json_file )
return
if link_data_only == 'copy_files' and converted_path is not None:
# Move the converted dataset to its "real" path
shutil.move( converted_path, output_path )
elif link_data_only == 'copy_files' and in_place:
# Dataset was not converted but should still be removed from original location
shutil.move( dataset.path, output_path )
if link_data_only == 'copy_files' and dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]:
# Move the dataset to its "real" path
if converted_path is not None:
shutil.copy( converted_path, output_path )
try:
os.remove( converted_path )
except:
pass
else:
# This should not happen, but it's here just in case
shutil.copy( dataset.path, output_path )
elif link_data_only == 'copy_files':
shutil.copy( dataset.path, output_path )
if link_data_only == 'copy_files' and datatype.dataset_content_needs_grooming( output_path ):
# Groom the dataset content if necessary
datatype.groom_dataset_content( output_path )
shutil.move( dataset.path, output_path )
# Write the job info
stdout = stdout or 'uploaded %s file' % data_type
info = dict( type = 'dataset',
@@ -328,6 +328,10 @@ def add_file( dataset, registry, json_file, output_path ):
line_count = line_count )
json_file.write( to_json_string( info ) + "\n" )
if link_data_only == 'copy_files' and datatype.dataset_content_needs_grooming( output_path ):
# Groom the dataset content if necessary
datatype.groom_dataset_content( output_path )
def add_composite_file( dataset, registry, json_file, output_path, files_path ):
if dataset.composite_files:
os.mkdir( files_path )
+1
View File
@@ -640,6 +640,7 @@ use_interactive = True
# run with the runner defined with default_cluster_job_runner.
[galaxy:tool_runners]
biomart = local:///
encode_db1 = local:///
hbvar = local:///