Commit Graph
40 Commits
Author SHA1 Message Date
John Chilton cf8fd5c597 Add test case demonstrating data params don't need namespace...
... unlike other parameters. Is this a bug? Has been this way for at least three releases it seems.

https://github.com/galaxyproject/tools-devteam/commit/c01b354711d982f61f1fd086148692cb084aa8a5#commitcomment-9922496
2015-02-25 20:07:20 -05:00
John Chilton b56bd85b6a Expose $__tool_directory__ to tools.
Repeatedly one wants to do things like create symbolic links and then call a helper script - the 'interpreter' tag doesn't allow shell commands before calling a helper script so they could not be used in this fashion. The previous pattern for doing this was then to use the ToolShed only 'set_environment' requirement tag. These were onerous to setup and the resulting tools were no longer portable to non-ToolShed installed contexts - I believe this variant is more robust and elegant.

More information https://trello.com/c/0pgF5PBQ and here https://trello.com/c/XK5SqE1i.
2015-02-03 10:29:34 -05:00
John Chilton 2f15eb0d78 Expose improved sample tracking to tools for implicit map/reduce ops.
Tools may now use $input.element_identifier during tool evalution for input 'data' parameters with the following semantics:

 - If the input was specified as a single dataset by the user - this just fallbacks to providing the $input.name.
 - If the input was mapped over a collection (to produce many jobs) or if the input is a 'multiple="true"' input that was provided a collection - the $input.element_identifier will be the element identifier for the corresponding collection item (generally much more useful the dataset name - since if preserved throughout workflows).

'data_collection' parameters already can access this kind of information - but it is something of a best practice to use simple 'data' parameters since they are compatible with more traditional un-collected datasets.

This commit really needs more comments - but Philip Mabon has been patiently waiting for this functionality for a long time.
2015-02-02 16:29:42 -05:00
John Chilton 08ab0c6376 A simpler way to configure output pairs (exploiting static structure).
See example and comments in test/functional/tools/collection_creates_pair_from_type.xml.
2015-01-15 09:30:00 -05:00
John Chilton 2cb7c8d73e More configurable format and metadata handling for output collections.
Imporvements to testing code.
2015-01-15 09:30:00 -05:00
John Chilton 4c5c8a47db Allow tools to output collections with a dynamic number of datasets.
Models:

Track whether dataset collections have been populated yet.

Dataset collections are still effectively immutable once populated - but dynamic output collections require them to be sort of like `final` fields in Java (analogy courtesy of JJ) - allowing them to be declared before they are initialized or populated. This is tracked by the `populated_state` field.

Tools:

Output collections can now describe `discover_datasets` elements just like datasets - except in this case instead of dynamically populating new datasets in the history - they will comprise the collection. `designation` has been reused to serve as the element_identifier for the collection element corresponding to the dataset.

See Pull Request 356 for more information on the discover_datasets tag https://bitbucket.org/galaxy/galaxy-central/pull-request/356/enhancements-for-runtime-discovered.

Workflows:

Update workflow execution and recovery for dynamic output collections.

Galaxy workflow data flow before collections

* - * - * - * - * - *

Galaxy worfklow data flow after collections (iteration 1)

* - * - * \
           * - * - *
* - * - * /         \
                     * - * - *
* - * - * \         /
           * - * - *
* - * - * /

Galaxy worfklow data flow after this commit

              / * - * \
         * - *         * - *
        /     \ * - * /     \
       /                     \
      /                       \
     /        / * - * \        \
* - * -- * - *         * - * -- * - *
     \        \ * - * /        /
      \                       /
       \                     /
        \     / * - * \     /
         * - *         * - *
              \ * - * /
2015-01-15 09:30:00 -05:00
John Chilton 44f7317fa5 Allow tools to output collections with static or determinable structure.
By "static" I mean tools such as a FASTQ de-interlacer that would produce a "paired" collection with two datasets everytime. By "determinable" I mean tools that perform N->N operations within the same job - such as a tool that needs to normalize a bunch of datasets all at once and not in separate jobs. (For N->N collection operations that should or can be done in N separate jobs tool authors should just write tools that operate over a dataset and produce a dataset and let the end-user 'map over' that operation.)

There are still large classes of operations where the structure of the output collection cannot be pre-determined - such as splitting files (e.g. bam files by read group) - that are not implemented in this commit.

Model:

The models have been updated to do a more thorough job of tracking collection outputs. Jobs just producing HistoryDatasetCollectionAssociations works fine for simple jobs producing collections - but you don't want to map a list over a tool that produces a pair and produce a bunch of pairs HDCAs and a list:pair HDCA- you just want a bunch of pieces and the one list:pair at that the top.

Workflow:

Workflows containing such operations can be executed - but the workflow editor has not been updated to handle this complexity (and it will require a significant overhaul) so such tools are not available in the workflow editor.

Tool Testing:

This commit also introduces a new tool XML syntax for describing tests on output collections. See files test/functional/tools/collection_creates_list.xml and test/functional/tools/collection_creates_pair.xml for examples.

Tests:

Includes two tools to test this - one that uses explicit pair output names and one that iterates over the structure of input list to produce an output list.

Includes several new tools API tests that test the tools described above via the API and implicit mapping over such tools. Includes two new workflow API tests - one that verifies a simple workflow with output collections works and one that verifies mapping over workflow steps in collections works.
2015-01-15 09:30:00 -05:00
John Chilton 7e45ca2a72 Allow multiple tools with the same id in ToolBox.
How to use:

 1.) Place multiple tools with different IDs in your tool conf.
 2.) ... ummm ... no step 2 - just use the tools.

Implementation:

The Tool Shed allows tool lineages by assigning each tool version a GUID and tracking versions in a database. This
implementation works by simply allowing the ToolBox to contain multiple tools with the same ID and orders them by the version specified by the tool author.

To track enable this a second tool lineage has been introduced that just uses tool versions instead of a database (non-toolshed installed tools are not longer placed into the Tool Shed install database). The ToolBox has been updated to allow multiple versions per tool id (defaulting to the 'latest' version for all operations which do not specify a version). Both jobs and workflow steps would track tool versions but did not use that version when fetching tools from the Toolbox - these components have been updated to try to use the tool version.

Unit tests working through most of the ToolBox and tool panel have been added, as well as functional tests exercising the tools API and to ensure workflows now at least attempt to respect tool versions (still kind of silently switches versions in some cases). Manual tests against the new tool form seem to demonstrate the tool switching and tool re-running work with only minor changes to the tools API and the job handler.
2014-12-31 18:21:10 -05:00
John Chilton 77ee2ace67 Allow tool tests to assert properties about command, standard output, and standard error.
See test/functional/tools/job_properties.xml for example. Provides full access to assertion based XML tags - tabular and XML based assertions probably not so interesting so these include - has_text, has_line, not_has_text, has_text_matching, has_line_matching.
2014-12-17 12:34:39 -05:00
John Chilton 0a1a871fd0 Merge next-stable. 2014-12-17 09:41:26 -05:00
John Chilton c4d29ad1b6 Fix gz/zip upload of files to test framework.
With test case to ensure they don't break again. Problem was due to a small switch of an if to an elif in 7114d15a6d22 which had been sort of masking over an older bug.

Thanks to Peter Cock for reporting the issue.
2014-12-17 09:38:49 -05:00
John Chilton 82e117fadd Add code_file example tool from Bjoern. 2014-12-15 14:37:22 -05:00
John Chilton ec24396140 Refactoring: Start abstracting XML processing out of Tool and param classes.
Long term this could allow Galaxy to support - multiple tooling formats (Galaxy-like YAML, CWL http://bit.ly/cwltooldesc, etc...). But I think it is also important from a purely design perspective - this is a core logic class integrating different components - they should not also be doing XML parsing.

To verify the interface for parsing tools is expressive enough to allow multiple useful implementations, I built a test YAML tool description that implements many of the same features as Galaxy but smooths out rough edges (uses exit codes for job failure by default for instance). Loading these tools is disabled by default and it is not documented how to enable them because they are not intended to be part of Galaxy's public API.
2014-12-11 00:26:13 -05:00
John Chilton 7ffccb7075 Implement tool test demonstrating pull request 569.
The new assign_primary_output attribute on discover_datasets tag.
2014-11-25 22:13:17 -05:00
John Chilton d57088409c Fix data column parameters pointed at multiple data parameters.
Before it would just die with an unhelpful server side exception - now it attempts to build, validate, and use a useful set of columns.
2014-09-26 10:49:43 -04:00
John Chilton 6ff787d769 More tool functional tests for validation stuff.
Test default sanitization in repeat. Basic test of simpler santizer and mapping.
2014-09-16 21:29:10 -04:00
John Chilton c5511cd747 Add very basic functional tests for tool param validation.
Including same test with workflow parameter substition - gotta admit I thought that workflow test was going to fail - so this week is looking pretty good :).
2014-09-08 10:33:54 -04:00
John Chilton abf4005749 Add another example tool - to illustrate three ways to collect files for concatenation. 2014-09-05 15:19:18 -04:00
John Chilton c1ee4c9b31 Add functional test tool demonstrating output filters.
Add new 'expect_num_outputs' attribute to 'test' element in tool XML to verify the produced number - needed to test output filtering.
2014-09-03 08:43:25 -04:00
John Chilton fcce8b8218 Add functional test tool demonstrating setting output dataset formats.
Directly setting format attribute, setting to format to 'input' (ambigious, non-deterministic and should be deprecated IMO), using format_source, and using change_format actions.
2014-09-03 08:43:25 -04:00
John Chilton db07824a12 Add functional test tool demonstrating special parameters.
:(
2014-09-03 08:43:25 -04:00
John Chilton 401fad5e25 Add some more basic test tools for building simple workflows for testing. 2014-08-27 16:32:26 -04:00
John Chilton 1c5691964e Implement optional collection params.
Was already parsing optional attribute but I put exactly zero thought into the implementation so these didn't work at all I don't think. This fills out the implementation, adds a test tool, and some cheetah helpers to facilitate this: "#if $collect_param" will fail if input not supplied or collection is empty and "#if $collect_param.is_input_supplied" will fail is input not supplied (i.e. empty collections will pass this check).
2014-07-25 10:28:50 -05:00
John Chilton 78fc3c9850 Add functional tool tests exercising multiple collection parameters at once. 2014-07-24 15:06:04 -05:00
John Chilton 3d9da261d1 Allow tool conf 'tool_path' resolution relative to conf file.
Relative 'tool_path' directories are resolved relative to GALAXY_ROOT (or really working directory). This is probably the expected behavior - but I think it is advantageous to be able to find tools relative to the tool_conf file also. This can now be done using string.Template resolution of ${tool_conf_dir}.
2014-06-23 16:32:24 -05:00
John Chilton 3688e02475 Add framework test tool that has both data and data_collection param - with test case.
Tool test is mildly useful to verify this works for single execution - but more useful as basis for future changesets testing mixed collection and subcollection mapping tool executions.
2014-05-07 15:39:03 -05:00
John Chilton f42d97fef3 Dataset collections - tool parameters - allow tool tests.
With example tool tests demonstrating some basic features available to cheetah for data_collection parameters.
2014-05-06 08:54:30 -05:00
John Chilton d0ca02415f Allow tool outputs to configure runtime dataset discovery.
Output tags on tool XML datasets may contain any number of child "discover_datasets" elements describing how Galaxy should discover datasests. This new method only works for job_working_directory collection - new_file_path based discovery should be considered deprecated.

Example unit and functional tests describe this new configurability in detail.
2014-03-29 17:11:17 -05:00
John Chilton cb40e02a51 Add tool functional test for parallelism with optional inputs.
This functionality is broken without patch from pull request #334. To run this broken test:

% # First two exports are optional but speed up testing and force newest test framework.
% export GALAXY_TEST_DEFAULT_INTERACTOR=api;
% export GALAXY_TEST_DB_TEMPLATE=https://github.com/jmchilton/galaxy-bootstrap/raw/master/src/main/resources/com/github/jmchilton/galaxybootstrap/universe.sqlite
% ./run_functional_tests.sh -framework -id parallelism_optional
2014-03-16 20:41:42 -05:00
John Chilton 17e935528d Add example tool with task splitting to tool functional framework tests.
Enable task splitting in functional tests to test this. Specify tool_dir in samples tool_conf.xml so it doesn't need to be explicitly set in scripts/functional_tests.py.
2014-01-28 14:34:26 -06:00
John Chilton db014a8559 Add test case for data param with multiple=True even if just 1 file used.
Add fix to twill driver to fix this use case.
2013-11-22 01:27:47 -06:00
John Chilton 48b7a50eb2 Fixes related to implicit defaults of param values.
Logic errors related to them being contained in repeat blocks and to picking the top value in a select by default when no other value is marked as default.

Other small adjustments - add another sample tool demonstrating the problem and clean up error messages.
2013-11-21 23:37:22 -06:00
John Chilton 4c4189c558 Fix API handling of tools containing repeat statement with min set. 2013-11-21 20:18:47 -06:00
John Chilton 1a6fbc5456 Allow robust disambiguation of repeat statements in tool tests.
Imagine a tool with a repeat statement like:

  <repeat name="rinst" title="Repeat Parameter">
    <param name="int_param" type="integer" value="1" />
    <param name="float_param" type="float" value="2.0" />
  </repeat>

3 test instances overidding int_param default in all three, but leaving the float_param default in place for the first and last can specified as follows:

  <param name="rinst_0|int_param" value="4" />
  <param name="rinst_1|int_param" value="5" />
  <param name="rtnst_2|int_param" value="6" />
  <param name="rinst_1|float_param" value="4.0" />

This syntax can be mixed and matched with specifing conditionals and nested repeats, etc....

One could imagine an alternative syntax like:

  <param name="rinst|int_param" value="4" />
  <param name="rinst|int_param" value="5" />
  <param name="rtnst|int_param" value="6" />
  <param name="rinst|float_param" value="4.0" />

Upon consideration, I have determined that this ambigious syntax is more difficult to reason about, leaves so much ambigiouity in place especially in the context of default and nested elements, and is harder to support. So the plan is to not support it at this time.

The following changeset will add "the right" way to do this anyway:

  <repeat name="rinst">
    <param name="rinst|int_param" value="4" />
  </repeat>
  <repeat name="rinst">
    <param name="rinst|int_param" value="5" />
    <param name="rinst|float_param" value="4.0" />
  </repeat>
  <repeat name="rinst">
    <param name="rinst|int_param" value="6" />
  </repeat>
2013-11-21 19:17:13 -06:00
John Chilton 8c54c91ab9 Allow outputs in tool functional tests to be specified in any order when using API interactor.
Outputs must specify name and must be specified in the same order with the Twill variant. This second restriction is entirely arbitrary using API so dropping it here.

Adding tool demonstrating this functionality (test/functional/tools/output_order.xml) which fails with twill interactor but works fine with API interactor.
2013-11-21 19:17:13 -06:00
John Chilton 1c40b4f359 Extend tool functional test framework to allow testing output dataset metadata.
Adding file test/functional/tools/metadata.xml demonstrating how to check output metadata - this file also demonstrates setting metadata on uploaded datasets and verifies both of these functionalities. Checking output metadata is only available for new API driven tool testing.
2013-11-21 19:17:13 -06:00
John Chilton a0d6d113ab Add more sample tools for tool testing framework.
Adding multi_select.xml, which demonstrates twill cannot deal with - at the beginning of select param values - this test works immediately with API interactor.

Also adding a multi_output.xml, this is a tool using variable number of outputs (force_refresh=True), both interactors pass this but it is a good test to verify that.

Also adding example to test multi-page tools (multi_page.xml) - both interactors pass this test. Though the API needed to be adjusted to allow its use (in a previous changeset).

Also adding example tool demonstrating extra_files output.

Finally, a tool simple_constructs.xml that just tests the basics, various parameter types, simple conditional, and simple repeat.
2013-11-21 19:17:12 -06:00
John Chilton 036fd68a44 Twill-less tool tests - handle composite inputs.
Add example tool test for composite data (worked with Twill based test framework prior to this commit, works with API based framework as a result of this commit).
2013-11-21 19:17:12 -06:00
John Chilton b001f73585 Tool functional tests - allow disambiguation of params in conditionals.
Disambiguate by add prefix for parent (or any number of direct ancestors) with pipe (|). See included test case for an example.

Should fix twill and API driven functional tests.
2013-11-21 19:17:12 -06:00
John Chilton 569c5db221 Add new option, tools, and data to functional test framework to test/demonstrate tool framework itself.
Add smaple repeat tool demonstrating some weaknesses of twill-based current framework.
2013-11-21 19:17:12 -06:00