Commit Graph
62 Commits
Author SHA1 Message Date
John Chilton b1fe6fee93 Refactor collection mapping workflows toward independence from tools.
Refactor get_data_inputs into get_all_inputs and use the resulting dictionaries to reason about if collection mapping should occur during invocation of tools. Using these dictionaries instead of explicit tool input objects should allow reuse within other module types since they may produce the same interface.
2018-10-24 09:34:40 -04:00
Nicola Soranzo 6b3f672770 Replace deprecated assertEquals() method
Fix warnings during py34-unit tests like:

```
/home/travis/build/galaxyproject/galaxy/test/unit/workflows/test_extract_summary.py:46: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(job_dict[hda.job], [('out1', derived_hda_2)])
```

See e.g. https://travis-ci.org/galaxyproject/galaxy/jobs/438829277
2018-10-09 12:37:15 +01:00
mvdbeek 60c4162ffa Fix unit tests that access output label 2018-09-26 14:29:22 +02:00
mvdbeek a44baa5642 Look up collection_type if collection_type_source is set
We do this in the wf-editor and in the backend, so this works for
subworkflows. This should make quite some tools more usable in a
workflow scenario. Should fix
- https://github.com/galaxyproject/galaxy/issues/6514
- https://github.com/galaxyproject/galaxy/issues/6012
- https://github.com/galaxyproject/galaxy/issues/6569
- https://github.com/galaxyproject/galaxy/issues/1889
and perhaps more issues related to this.
2018-09-18 17:11:40 +02:00
John Chilton 7806a84d1c Implement runtime parameters in nested workflows. 2018-09-06 14:43:22 -04:00
mvdbeek 57f5b42974 py3: fix workflow extract summary 2018-07-05 02:49:51 +01:00
Nic Herndon 03a4172680 Fixed bugs with unit test on Python 3 2018-06-30 23:06:42 +00:00
guerler 028d07323d Adjust test case 2018-03-31 03:08:25 -04:00
John Chilton d5f98f4904 Formalize workflow invocation and invocation step outputs.
Workflow Invocations
--------------------

The workflow invocation outputs half of this is relatively straight forward. It is modelled somewhat on job outputs, output datasets and output dataset collections are now tracked for each workflow invocation and exposed via the workflow invocation API. This required adding new tables (linked to WorkflowInvocations and WorkflowOutputs) that track these output associations.

Previously one could imagine backtracking this information for simple tool steps via the WorkflowInvocationStep -> Job table, but for steps that have many jobs (i.e. mapping over a collection) or for non-tool steps such information was more difficult to recover (and simply couldn't be recovered from the API at all or even internally without significant knowledge of the underlying workflow).

Workflow Invocation Steps
-------------------------

Tracking the outputs of WorkflowInvocationSteps was not previously done at all, one would have to follow the Job table as well. A signficant downside to this is that one cannot map over empty collections in a workflow - since no such job would exist. Tracking job outputs for WorkflowInvocationSteps is not a simple matter of just attaching outputs to an existing table because we had no concept of a workflow step tracked - since there could be many WorklfowInvocationSteps corresponding to the same combination of WorkflowInvocation and WorkflowStep. That should feel wrong and that is because it is - when collections were added the possiblity of having many jobs for the same combination of WorkflowInvocation and WorkflowStep was added. I should have split WorkflowInvocationSteps into WorkflowInvocationSteps and WorkflowInvocationStepJobAssociations at that time but didn't. This commit now does it - effectively normalizing the ``workflow_invocation_step`` table by introducing the new ``workflow_invocation_step_job_association`` table.

Splitting up the WorkflowInvocationStep table this way allows recovering the mapped over output (e.g. the implicitly created collection from all the jobs) as well the outputs from the individual jobs (by walking WorkflowInvocationStep -> WorkflowInvocationStepJobAssociation -> Job -> JobToOutput*Association).

This split up involves failrly substantial changes to the workflow module interface. Any place a list of WorkflowInvocationSteps was assumed, I reworked it to just expect a single WorkflowInvocationStep. I vastly simplified recover_mapping to just use the persisted outputs (this was needed in order to also implment empty collection mapping in workflows). This also fixes a bug (or implements a missing feature) where Subworkflow moudles had no recover_mapping methods - so for instance if a tool that produces dynamic collections appeared anywhere in a workflow after a subworkflow step - that workflow would not complete scheduling properly.

Now that we have a way to reference the set of jobs corresponding to a workflow step within an invocation, we can start to track partial scheduling of such steps. This is outlined in https://github.com/galaxyproject/galaxy/issues/3883 and refactoring toward this goal is included here - including adding a state to WorkflowInvocationStep so Galaxy can determine if it has started scheduling this step and an index when scheduling jobs so it can tell how far into a scheduling things have gone as well as augmenting the tool executor to take a maximum number of jobs to execute and allow recovery of existing jobs for collection building purposes.

*Applications*

These changes will enable:

- A simple, consistent API for finding workflow outputs that can be consumed by Planemo for testing workflows.
- Mapping over empty collections in workflows.
- Re-scheduling workflow invocations that include subworkflow steps.
- Partial scheduling within steps requiring a large number of jobs when scheduling workflow invocations.
2017-11-30 10:02:01 -05:00
Nicola Soranzo 2cd95c48f6 Fix import order everywhere
- Add flake8-import-order to flake8 Pipfile and remove py27-lint-imports
  and py27-lint-imports-include-list tox envs
- Fix most E201 and E202 errors reported by flake8-import-order v0.15,
  but pin flake8-import-order to v0.14.3 until
  https://github.com/PyCQA/flake8-import-order/issues/123
  is fixed

This let us drop 2 jobs on Travis per each job.
2017-11-14 19:42:39 +00:00
E Rasche 32b85ecb59 Only permit yaml.safe_loading of data
Event trusted data, belt + suspenders method.
2017-09-25 11:39:12 +02:00
mvdbeek 64f8e74ade Fix subworkflow tests 2017-08-20 12:49:43 +02:00
Nicola Soranzo 21b44bf348 Fix all E201 and E202 style errors
using the following command:
```
autopep8 -i -r --exclude $(sed -e 's|^|./|' -e 's|/$||' .ci/flake8_blacklist.txt | paste -sd,) --select E201,E202 .
```
2017-08-17 11:35:39 +01:00
guerler 05687b8a19 Strip debug output 2017-02-22 13:03:43 -05:00
guerler ae751adac8 Adjust unit test to use labels instead of name through state 2017-02-22 12:14:23 -05:00
guerler 48ba525eb5 Merge branch 'dev' into fix_workflow_issues 2017-01-08 12:36:53 -05:00
John Chilton a0177fe2f4 Add ability to import workflows without Galaxy modifying tool version.
Needed to test workflow tool upgrades when loading workflows, but I think it is good to have a way to preserve the original tool state as well for the sake of absolute reproducibility/tracibility.
2017-01-08 08:13:42 -05:00
guerler c4c870991a Fix blank lines 2016-12-28 04:08:04 -05:00
guerler ebbeecd7b3 Adjust unit tests 2016-12-27 21:18:58 -05:00
guerler 648d717298 Improve state building resilience, fix test cases 2016-12-08 10:24:35 -05:00
guerler 61df5ac6f5 Remove redundant and unused update state from test cases, replace with recover state 2016-12-05 17:57:40 -05:00
guerler 9c069a21f6 Fix lint, unit tests 2016-12-05 17:32:47 -05:00
Nicola Soranzo a8746c4f52 Fix import order and Python3 compatibility for test/unit/ 2016-11-16 10:29:09 +00:00
Nicola Soranzo 1d17a29c79 Fixes for pycodestyle 2.2.0 2016-11-15 16:56:50 +00:00
guerler 5095fc02c4 Remove internal api endpoint, merge into invocations endpoint 2016-09-25 12:45:28 -04:00
Nicola Soranzo cc336f61c0 Make some files compatible with Python3
Also enlarge the set of files tested with flake8 under Python3
2016-06-03 19:24:46 +01:00
guerler 96b1274b12 Remove encode_runtime_state 2016-03-05 13:00:02 -05:00
guerler 9f5b7a5f66 Revise tool state encryption, remove copy/paste hacks 2016-03-05 12:34:14 -05:00
Dannon Baker 4dce3e35d7 Toolshed/test swaps from standalone_xml to tostring 2016-02-25 14:20:00 -05:00
Eric Rasche 5a441044fb Merge pull request #1308 from jmchilton/multi_collection_types
Allow input collections to specify multiple collection types.
2016-01-04 14:43:37 -06:00
John Chilton 355bb281e2 Finish swapping unencoded ids with order_index in workflows API.
Running a workflow or showing a workflow can both restore the previous behavior by passing legacy=True as an API parameter. By changing these two endpoints in tandem I believe backward compatiblity for most existing code should be maintained unless:

 - The external application saved these workflow IDs previously and re-runs workflows without refetching the workflow definition. I could imagine Refinery for instance might do this and will have to update indexed workflows or add legacy=True to workflow requests.
 - The external application contacted the database directly after using this API endpoint to fetch more information about the step (seems unlikely).

See conversation:
 - http://dev.list.galaxyproject.org/workflow-API-step-order-vs-step-id-in-bioblend-td4668367.html

Rebased with changes suggested by @nsoranzo.
2015-12-20 14:39:20 +00:00
John Chilton 157939aa8f Implement nested workflows.
Details:

 - Add a new workflow module describing subworkflows.
 - Add workflow list to editor side panel - with options to link in a subworkflow module or copy the target workflow into the workflow being editted node for node.
 - Update workflow, workflow step, and workflow invocation models to track subworkflow connections and execution.
 - Extend workflow outputs with concepts of labels (and UUIDs while I'm there) to match workflow inputs. This allow us to have something to label outputs with in the workflow editor and to reference in the format 2 workflow description language.
 - Extend workflow editor UI to allow labeling workflow outputs (and enforce that these are unique across a workflow).
 - Extend workflow invocation and progress tracking to allow invoking a subworkflow as part of another workflow invocation.
 - Extend workflow import and export code to allow a nested representation of workflows.
 - Update format 2 workflow description to allow testing nested workflows.

Most relevant new and modified test cases can be run using the following commands:

```
./run_tests.sh -api test/api/test_workflows.py:WorkflowsApiTestCase.test_run_subworkflow_simple
./run_tests.sh -api test/api/test_workflows_from_yaml.py:WorkflowsFromYamlApiTestCase.test_subworkflow_simple
./run_tests.sh -api test/api/test_workflows_from_yaml.py:WorkflowsFromYamlApiTestCase.test_outputs
nosetests test/unit/test_galaxy_mapping.py
nosetests test/unit/workflows/test_workflow_progress.py
```
2015-12-16 15:22:18 +00:00
John Chilton 8af5671953 Allow input collections to specify mutiple collection types.
Parallelling format specifier which can take multiple formats.
2015-12-13 13:38:50 +00:00
John Chilton f6d26c9ee6 Small refactor making workflow views and modules tad more generic.
- Reduce duplication between initializing generic modules and tool modules.
 - Switch tool_id to content_id as variable names throughout the client.
 - Rename get_tool_id to get_content_id on workflow modules.
 - Add some minimal documentation to the workflow module about get_content_id.

Downstream in the subworkflow commit I switch the over-the-wire communication to use content_id instead of tool_id also and use content_ids to refer to workflow ids in subworkflow moduls.
2015-12-06 10:43:09 +00:00
John Chilton 59944046b7 Fix for workflow progress unit testing. 2015-12-03 11:32:24 +00:00
John Chilton 48340b5829 Add TODO items to workflow progress unit tests. 2015-12-01 23:44:26 +00:00
John Chilton 07c3d10f31 Extend workflow recovery progress test case to include replacement check. 2015-12-01 23:44:26 +00:00
John Chilton 7974c1f334 Add unit tests for workflow progress initialization. 2015-12-01 23:44:26 +00:00
John Chilton cf367ff0c7 Add another workflow progress test case.
This one for replacing a tool input with an input dataset.
2015-12-01 23:44:26 +00:00
John Chilton 031a39aba8 Basic unit tests for workflow progress tracking. 2015-12-01 23:44:26 +00:00
John Chilton 21213ef70f Refactor workflow testing code to quickly bootstrap workflows. 2015-12-01 23:44:26 +00:00
Nate Coraor f334764627 Egg cleaning in test/ 2015-09-22 10:32:16 -04:00
Nicola Soranzo 9805294f97 Revert "Revert "[WIP] Mega flake8 linting""
This reverts commit 37f1976d38.
2015-07-12 21:25:44 +01:00
Dannon Baker 37f1976d38 Revert "[WIP] Mega flake8 linting" 2015-07-11 13:17:38 -04:00
Bjoern Gruening ad8175928d lint fixes for /test/unit/ 2015-07-05 19:50:35 +01:00
John Chilton facc29e8a9 Update workflow extraction backend for output collections. 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 974a4c124f Introduce abstraction shielding toolbox.tools_by_id from galaxy.workflow.modules.
That was the last module outside of ToolBox itself that was accessing tools_by_id directly.
2014-12-26 09:55:27 -05:00
John Chilton f5b085fbc5 More unit tests for workflow extraction summarize method. 2014-12-01 21:18:56 -05:00
John Chilton e6ea34c3f1 Fix for running test_extract_workflow.py stand-alone. 2014-12-01 21:18:56 -05:00