mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Add load_contents attribute to data inputs
If set to a non-zero value will make Galaxy deposit the first n bytes of content within in the job.<param_name>.<content> dict. This is similar to the `loadContents` flag in the CWL input binding which will load the first 64KB. See https://www.commonwl.org/v1.0/CommandLineTool.html#CommandLineBinding
This commit is contained in:
@@ -95,6 +95,7 @@ class ToolParameter(Dictifiable):
|
||||
self.name = self.__class__.parse_name(input_source)
|
||||
self.type = input_source.get("type")
|
||||
self.hidden = input_source.get_bool("hidden", False)
|
||||
self.load_contents = int(input_source.get("load_contents", 0))
|
||||
self.refresh_on_change = input_source.get_bool("refresh_on_change", False)
|
||||
self.optional = input_source.parse_optional()
|
||||
self.is_dynamic = False
|
||||
|
||||
@@ -66,7 +66,11 @@ def _json_wrap_input(input, value, handle_files="skip"):
|
||||
if value:
|
||||
if isinstance(value, list):
|
||||
value = value[0]
|
||||
return _hda_to_object(value)
|
||||
json_value = _hda_to_object(value)
|
||||
if input.load_contents:
|
||||
with open(str(value), mode='rb') as fh:
|
||||
json_value['contents'] = fh.read(input.load_contents).decode('utf-8', errors='replace')
|
||||
return json_value
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
|
||||
@@ -113,7 +113,7 @@ class XmlToolSource(ToolSource):
|
||||
return ((command_el is not None) and command_el.text) or None
|
||||
|
||||
def parse_expression(self):
|
||||
""" Return string contianing command to run.
|
||||
""" Return string containing command to run.
|
||||
"""
|
||||
expression_el = self.root.find("expression")
|
||||
if expression_el is not None:
|
||||
|
||||
@@ -2098,7 +2098,7 @@ parameter being described. All the attributes for the ``param`` element are
|
||||
documented below for completeness, but here are the common ones for each
|
||||
type are as follows:
|
||||
|
||||
$attribute_list:name,type,optional,label,help,argument,refresh_on_change:4
|
||||
$attribute_list:name,type,optional,label,help,argument,load_contents:refresh_on_change:4
|
||||
|
||||
### Parameter Types
|
||||
|
||||
@@ -2364,6 +2364,13 @@ tool form just below the associated field to provide information about the
|
||||
field.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="load_contents" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation xml:lang="en">Number of bytes that should be
|
||||
loaded into the `contents` attribute of the jobs dictionary provided to Expression
|
||||
Tools. Applies only to type="data" inputs.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="value" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation xml:lang="en">The default value for this
|
||||
|
||||
Reference in New Issue
Block a user