mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 05:45:37 +08:00
Enhance data_source.py to take advantage of the content length when known. If content length provided by external application is
greater than config.output_size_limit, no data will be retrieved and an error message will be provided to the user. Tools using this script have been updated to provide the max file size on the command line. Resolves ticket #93.
This commit is contained in:
@@ -595,7 +595,7 @@ class JobWrapper( object ):
|
||||
self.real_path = real_path
|
||||
self.false_path = false_path
|
||||
def __str__( self ):
|
||||
if false_path is None:
|
||||
if self.false_path is None:
|
||||
return self.real_path
|
||||
else:
|
||||
return self.false_path
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
-->
|
||||
<tool name="BioMart" id="biomart" tool_type="data_source" URL_method="get" version="1.0.1">
|
||||
<description>Central server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://www.biomart.org/biomart/martview" check_values="false" method="get" target="_top">
|
||||
<display>go to BioMart Central $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner/biomart" />
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
-->
|
||||
<tool name="BioMart" id="biomart_test" tool_type="data_source" URL_method="get" version="1.0.1">
|
||||
<description>Test server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://test.biomart.org/biomart/martview" check_values="false" method="get" target="_top">
|
||||
<display>go to BioMart Central $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner/biomart" />
|
||||
|
||||
@@ -21,6 +21,10 @@ def check_gzip( filename ):
|
||||
|
||||
def __main__():
|
||||
filename = sys.argv[1]
|
||||
try:
|
||||
max_file_size = int( sys.argv[2] )
|
||||
except:
|
||||
max_file_size = 0
|
||||
params = {}
|
||||
for line in open( filename, 'r' ):
|
||||
try:
|
||||
@@ -50,6 +54,10 @@ def __main__():
|
||||
page = urllib.urlopen( URL, urllib.urlencode( params ) )
|
||||
except Exception, e:
|
||||
stop_err( 'The remote data source application may be off line, please try again later. Error: %s' % str( e ) )
|
||||
if max_file_size:
|
||||
file_size = int( page.info().get( 'Content-Length', 0 ) )
|
||||
if file_size > max_file_size:
|
||||
stop_err( 'The size of the data (%d bytes) you have requested exceeds the maximum allowed (%d bytes) on this server.' % ( file_size, max_file_size ) )
|
||||
out = open( filename, 'w' )
|
||||
while 1:
|
||||
chunk = page.read( CHUNK_SIZE )
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-->
|
||||
<tool name="EpiGRAPH" id="epigraph_import" tool_type="data_source" URL_method="get">
|
||||
<description> server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://epigraph.mpi-inf.mpg.de/WebGRAPH/faces/Login.jsp" check_values="false" method="get">
|
||||
<display>go to EpiGRAPH server $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=epigraph_import" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-->
|
||||
<tool name="EpiGRAPH" id="epigraph_import_test" tool_type="data_source" URL_method="get">
|
||||
<description> test server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://epigraph.mpi-inf.mpg.de/WebGRAPH_Public_Test/faces/Login.jsp" check_values="false" method="get">
|
||||
<display>go to EpiGRAPH server $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=epigraph_import_test" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
-->
|
||||
<tool name="EuPathDB" id="eupathdb" tool_type="data_source" url_method="post">
|
||||
<description>server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://galaxy.eupathdb.org/eupathdb.galaxy/queries_tools.jsp" check_values="false" method="post">
|
||||
<display>go to EuPathDB server $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=eupathdb" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-->
|
||||
<tool name="Flymine" id="flymine" tool_type="data_source" URL_method="post">
|
||||
<description>server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://www.flymine.org" check_values="false" method="get" target="_top">
|
||||
<display>go to Flymine server $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=flymine" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-->
|
||||
<tool name="Flymine test" id="flymine_test" tool_type="data_source" URL_method="post">
|
||||
<description>server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://preview.flymine.org/preview/begin.do" check_values="false" method="get" target="_top">
|
||||
<display>go to Flymine server $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=flymine" />
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
-->
|
||||
<tool name="GrameneMart" id="gramenemart" tool_type="data_source" URL_method="get" version="1.0.1">
|
||||
<description> Central server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://www.gramene.org/biomart/martview" check_values="false" method="get" target="_top">
|
||||
<display>go to GrameneMart Central $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner/biomart" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-->
|
||||
<tool name="UCSC Main" id="ucsc_table_direct1" tool_type="data_source" URL_method="post">
|
||||
<description>table browser</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://genome.ucsc.edu/cgi-bin/hgTables" check_values="false" method="get">
|
||||
<display>go to UCSC Table Browser $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-->
|
||||
<tool name="UCSC Archaea" id="ucsc_table_direct_archaea1" tool_type="data_source" URL_method="post">
|
||||
<description>table browser</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://archaea.ucsc.edu/cgi-bin/hgTables" check_values="false" method="get">
|
||||
<display>go to UCSC Table Browser $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-->
|
||||
<tool name="UCSC Test" id="ucsc_table_direct_test1" tool_type="data_source" URL_method="post">
|
||||
<description>table browser</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://genome-test.cse.ucsc.edu/cgi-bin/hgTables" check_values="false" method="get">
|
||||
<display>go to UCSC Table Browser $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<tool name="Wormbase" id="wormbase" tool_type="data_source" URL_method="post">
|
||||
<description>server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://www.wormbase.org/db/seq/gbgff/c_elegans/" check_values="false" target="_top">
|
||||
<display>go to Wormbase server $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=wormbase" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<tool name="Wormbase" id="wormbase_test" tool_type="data_source" URL_method="post">
|
||||
<description>test server</description>
|
||||
<command interpreter="python">data_source.py $output</command>
|
||||
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
|
||||
<inputs action="http://dev.wormbase.org/db/seq/gbrowse/c_elegans/" check_values="false" target="_top">
|
||||
<display>go to Wormbase test server $GALAXY_URL</display>
|
||||
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=wormbase_test" />
|
||||
|
||||
Reference in New Issue
Block a user