Commit Graph
92 Commits
Author SHA1 Message Date
John Chilton dfd9839185 Fix test_job_configuration.py for job metrics PR.
Still need to go in and actually write some tests for the nested parsing that can happen.
2014-04-22 21:40:08 -05:00
John Chilton 2ec1f3e9af Merge pull request #352. 2014-04-22 21:06:03 -05:00
John Chilton 7ed40c36b5 Unit tests for job conf parsing.
Update advanced job sample to fix "bugs" discovered during testing limit parsing.
2014-04-22 20:50:18 -05:00
John Chilton d590921b6f Add unit test for extra primary dataset collection.
Tests overridding various output properties (ext, dbkey, name, visible) with file name and galaxy.json, collecting from new_file_path versus job_working_directory, setting job output associations, and logic related to adding outputs to copied histories.
2014-03-28 18:33:03 -05:00
John Chilton 03303e51f2 Merged in jmchilton/galaxy-central-fork-1 (pull request #348)
Enhance workflows API to allow extracting workflow from history.
2014-03-26 16:21:15 -05:00
John Chilton 95baa6950e Implement plugin framework for collecting data about runtime job execution.
An example job_metrics_conf.xml.sample is included that describes which plugins are enabled and how they are configured. This will be updated for each new plugin added. By default not instrumentation or data collection occurs - but if a job_metrics.xml file is present it will serve as the default for all job destination. Additionally, individual job destinations may disable, load a different job metrics file, or define metrics directly in job_conf.xml in an embedded fashion. See comment at top of job_metrics_conf.xml for more information.

This commit include an initial plugin (named 'core') to demonstrate the framework and capture the highest priority data - namely the number of cores allocated to the job and the runtime of the job on the cluster. These two pieces of information alone should provide a much clearer picture of what Galaxy is actually allocating cluster compute cycles to.

Current limitations - This only works with job runners utilizing the job script module and the LWR (it utilizes the job script module on the remote server), hence it won't yet work with...

 - Local job runner - I do have a downstream fork of Galaxy where I have reworked the local job runner to use the common job script template.

    https://github.com/jmchilton/galaxy-central/commits/local_job_script
    https://github.com/jmchilton/galaxy-central/commit/949db2cd14c7191cedf1febeb5f4a2f53123123e

 - CLI runner - CLI runner needs to be reworked to use the job script module anyway so GALAXY_SLOTS works - the LWR version of the CLI runner uses the job script module - this work just needs to be back ported to Galaxy.

If a job_metrics_conf.xml is present and some jobs route to the above destinations - the jobs won't fail but annoying errors will appear in the logs. Simply attach a 'metrics="off"' those these specific job destinations to disable any attempt to use metrics for these jobs and disable these errors.
2014-03-26 11:01:46 -05:00
John Chilton 99b346996a Layout models and mapping for a job metrics plugin framework. 2014-03-26 11:01:46 -05:00
John Chilton 0199b28dc1 Unit tests to exercise job and task mapping. 2014-03-26 11:01:46 -05:00
John Chilton ccafc2de5a Drop unit incorrect unit tests added in 410a13e and 01933aa.
Workflow run template was causing these methods to be called wrong (and has been for a LONG time), this in turn caused me to misunderstand what the spec for how other_values in tool parameters should operate when writing the tests.

The real underlying bug should be fixed with 55cf8bb.
2014-03-20 16:12:52 -05:00
John Chilton e892a28b1a Start work on stand-alone module for extracting workflows from histories.
In particular, this moves get_job_dict out of workflow controller. I am making big changes to this downstream in dataset collection work so I want unit tests - additionally get_job_dict isn't really a great name for what this becomes - so I am renaming it to summarize.
2014-03-17 10:44:09 -05:00
John Chilton 76d3c7aece PEP-8 fixes, var name fixes, and unit tests for SecurityHelper.
Tests cover nearly all functionality - in particular newly added per-kind key generation.
2014-03-16 19:55:47 -05:00
John Chilton be13bd26a7 Test cases for filtering tool parameters on other parameter values.
Includes test case that is broken without JJ's contributions in pull request #343.
2014-02-28 14:49:46 -06:00
John Chilton fb9d65f76e Add test cases for need_late_validation of select parameters.
Two of these fail without JJ's work in pull request 336, additionally these verify 336 doesn't break GATK support for instance.
2014-02-28 12:42:30 -06:00
John Chilton 4f2e94251c Introduce DatasetMatcher to simplify DatasetToolParameter...
This reduces code duplication related dataset_collectors now and abstracts out important functionality I reuse further to collect dataset collections downstream.

Was originally added in 28d43f4 as DatasetParamContext and backed out of right away. I have reworked it so that it no longer breaks implicit conversion, the relevant classes and methods have less generic names, and it has a healthy set of test cases.

In addition to basic tests on matching datasets to parameters, selections, and implicit conversions - these tests include testing of dataset security inconjuction with data_destination tools as well as filtering data parameters on other data parameters.
2014-02-21 22:09:57 -06:00
John Chilton f661553201 Rearrange unit tests.
Move tests that were in tests/unit but could logically be placed into tests/unit/tools or tests/unit/jobs into these directory.
2014-02-21 22:09:57 -06:00
John Chilton ec849c3741 Unit tests for various data tool parameter handling.
Test optional datasets can be used in tool evaluation (in test_evaluation.py).

Add test_data_parameters.py which test many random DataToolParameter behaviors. Test various paths to DataToolParameter.to_python - including recently enhanced ability to use optional dataset with 'multiple=True' data parameters. Test filtering on datatypes, implicit conversion options (both existing conversions and new ones) both when building HTML forms and picking intial values for workflows. Test special handling of hidden datasets. Tests picking intial datasets when optional and without repeats when used in subsequent calls.
2014-02-21 22:09:57 -06:00
John Chilton 11eb55edff Fix Python 2.7ism in test_evaluation.py. 2014-02-21 14:57:09 -06:00
John Chilton 05d885b53f Allow ComputeEnvironment to rewrite 'arbitrary' paths.
Previous changes enabled targetted rewriting of specific kinds of paths - working directory, inputs, outputs, extra files, version path, etc.... This change allows rewriting remaining 'unstructured' paths - namely data indices.

Right now tool evaluation framework uses this capability only for SelectParameter values and fields - which is where these paths will be for data indices. Changeset lays out the recipe for doing this and the functionality could easily be extended for arbitrary parameters or other specific kinds of inputs.

The default ComputeEnvironment does not rewrite any paths obviously, but the abstract base class docstring lays out how to extend a ComputeEnvironment to do this:

    def unstructured_path_rewriter( self ):
        """ Return a function that takes in a value, determines if it is path
        to be rewritten (will be passed non-path values as well - onus is on
        this function to determine both if its input is a path and if it should
        be rewritten.)
        """

The LwrComputeEnviroment has been updated to provide such a rewriter - it will rewrite such paths, and create a dict of paths that need to be transferred, etc.... The LWR server and client side infrastructure that enables this can be found in this changeset - https://bitbucket.org/jmchilton/lwr/commits/63981e79696337399edb42be5614bc7218cdf95f.

This changeset includes tests for changes to wrappers and the tool evaluation module to enable this.
2014-02-10 21:34:42 -06:00
John Chilton 4cd10edbab Rework version string handling for ComputeEnvironment abstraction.
Add version_path method to ComputeEnviornment interface - provide default implementation delegating to existing JobWrapper method as well as LwrComputeEnviornment piggy backing on recently added version command support.

Build full command to do this in JobWrapper.prepare so that ComputeEnviornment is available and potentially remote path can be used.
2014-02-10 21:34:42 -06:00
John Chilton b7c191cd48 Allow 'false_path' style replacing of extra files paths.
Updates DatasetFilenameWrapper and DatasetPath to allow this.
2014-02-10 21:34:42 -06:00
John Chilton 0954372f72 Move false_path logic out of tool evaluation code and into cheetah wrapper.
This should ease replacing extra_files_path in subsequent commits.
2014-02-10 21:34:42 -06:00
John Chilton 292be5b364 Rework interface between jobs and tools.
Pull code out of job wrapper and tool for building and evaluating against template environments and move them into a new ToolEvaluator class (in galaxy/tools/evalution.py). Introduce an abstraction (ComputeEnvironment) for various paths that get evaluated that may be different on a remote server (inputs, outputs, working directory, tools and config directory) and evaluate the template against an instance of this class. Created a default instance of this class (SharedComputeEnvironment). The idea will be that the LWR should be able to an LwrComputeEnvironment and send this to the JobWrapper when building up job inputs - nothing in this commit is LWR specific though so other runners should be able to remotely stage jobs using other mechanisms as well.

This commit adds extensive unit tests of this tool evaluation - testing many different branches through the code, with and without path rewriting, testing job hooks, config files, testing the cheetah evaluation of simple parameters, conditionals, repeats, and non-job stuff like $__app__ and $__root_dir__. As well as a new test case class for JobWrapper and TaskWrapper - though this just tests the relevant portions of that class - namely prepare and version handling.
2014-02-10 21:34:42 -06:00
John Chilton c87a0d7f4b Move cheetah wrappers into own module...
For clarity - more work toward reduces tools/__init__.py to a more managable size. This also includes an initial suite of test cases for these wrappers - testing simple select wrapper, select wrapper with file options, select wrapper with drilldown widget, raw object wrapper, input value wrapper, and the dataset file name wrapper with and without false paths.
2014-02-10 21:34:42 -06:00
John Chilton 48e2c4ace2 Refactor DatasetPath out into newer galaxy.jobs.datasets module.
Add unit test for DatasetPath class.
2014-02-10 21:34:42 -06:00
John Chilton 20f91ee61d Hack to fix test_executions for 0951e07.
This whole concept I had of using these models in unit tests without a database connection present probably needs to be done away with.
2014-02-10 21:34:42 -06:00
John Chilton 3f15a98302 Refactor duplicated get_display_name code out of galaxy.model.
Also added test cases. Need to use this downstream in for dataset collections.
2014-02-02 12:47:15 -06:00
John Chilton 2268302db9 Create unit test for some simple DefaultToolAction functionality.
Want to refactor some stuff around in DefaultToolAction so can be reused when dealing with dataset collections downstream in https://github.com/jmchilton/galaxy-central/tree/collections_1 - so creating unit tests to ensure functionality is not changing.

This changeset also reworks test_execution.py moving more stuff to test/unit/tools_support.py to share between test files.
2014-01-23 22:11:07 -06:00
John Chilton 7ad8845bb0 Refactor logic related to creating tools for unit tests.
So it can be reused by tool actions unit test.
2014-01-23 22:11:06 -06:00
John Chilton 548e66cd3d Slight improvement to test_execution.py 2014-01-23 22:11:06 -06:00
John Chilton 7e44ec4bb5 Add tool execution tests for various exceptional conditions.
Tool action raising exception, redirecting, and returning an error message.
2014-01-16 09:30:01 -06:00
Carl Eberhard 2926eb0075 Visualizations Registry: update unit test to remove expected visualizations, small fixes 2014-01-14 15:52:01 -05:00
John Chilton cddd727c05 Refactor tool so incoming dict isn't passed to __handle_tool_execute.
Slightly confusing that state params and raw incoming passed to that method, so pull out rerun_remap_job_id sooner and just pass that along (it was the only incoming was used for). Use the oppertunity to isolate potential errors with decoding rerun_remap_job_id and include more informative error message.

Add unit test to test invalid rerun_remap_job_ids.
2014-01-14 14:43:39 -06:00
John Chilton baac81143e Add tool execution unit test for rerun_remapping. 2014-01-14 14:43:39 -06:00
John Chilton 7bb726c80b Add data parameter tests to tool execution unit tests. 2014-01-14 08:00:57 -06:00
John Chilton b3fa048d97 Add more state handling tests...
... to tool execution unit tests.
2014-01-13 15:14:33 -06:00
John Chilton fbcf068e81 Initial work on tool execution unit tests.
Going to be doing some more work on tool state stuff so it will be good to have a way to test that. This also brings in test/unit/tools_support.py from Pull Request #287 (would be overkill for just these tests, but it is useful for future tests coming down the pipe.)
2014-01-13 08:58:22 -06:00
John Chilton edf064101f Fix history contents ordering broken with previous changeset.
Add stronger test cases, though these are still insufficient to exercise the error. The only way I was able to get the history contents to come out misordered was to use postgres. Nonetheless, using postgres this now orders datasets properly.
2014-01-03 21:58:13 -06:00
John Chilton e3757343d0 Backout of Backout of 714f5b1 for now.
... or would that be back-into 714f5b1?

714f5b1 - Move history contents filtering logic into model.

Filtering for deleted, visible, and ids with ORM should prevent loading unneeded objects into memory (a history with 1000 items and 5 visible will now only cause 5 items to be loaded instead of 1000 just to filter out 5). Simplifies history_contents API logic somewhat, allows easier 'unit' testing (included), and provides a clearer entry point for additional 'showing' additional contents types (read dataset collections).
2014-01-03 21:58:12 -06:00
John Chilton df442a0638 Work on unit test path problems.
Move test/unit/tool_shed to test/unit/tool_shed_unit_tests.
2014-01-02 17:50:14 -06:00
John Chilton 230c153e29 Backout of 714f5b1 for now.
jgoecks_: jmchilto1: 714f5b1 seems to have broken HDA ordering in history panel
2013-12-18 01:23:27 -06:00
John Chilton 35bfa476aa Move history contents filtering logic into model.
Filtering for deleted, visible, and ids with ORM should prevent loading unneeded objects into memory (a history with 1000 items and 5 visible will now only cause 5 items to be loaded instead of 1000 just to filter out 5). Simplifies history_contents API logic somewhat, allows easier 'unit' testing (included), and provides a clearer entry point for additional 'showing' additional contents types (read dataset collections).
2013-12-15 16:16:34 -06:00
Dannon Baker ce4bdd828c Merged in jmchilton/galaxy-central-fork-1 (pull request #272)
Resolve default package definitions if exact version is unavailable.
2013-12-11 13:11:06 -05:00
John Chilton dd25b4e8b6 Add more unit tests for command_factory.
In particular for for task splitting commands and copying work dir outputs.
2013-12-11 10:26:15 -06:00
John Chilton 9035eda982 command_factory cleanup - fix very poorly named input parameter. 2013-12-11 10:26:15 -06:00
John Chilton 6462742497 Allow new dependency_resolution destination for LWR runner.
It can be 'none', 'local', or 'remote'. At this point this allows one to disable command dependency injection if set to 'none' or 'remote'. Actually implementing logic for 'remote' resolution will follow.

In subsequent changes - 'remote' will make backward-imcompatiable API calls to the LWR - this is why 'none' is also provided as an option - it will be backward compatiable way to disable dependency resolution for an LWR destination.
2013-12-11 10:26:15 -06:00
John Chilton 6563cd5815 Refactor command_factory:build_command to reduce parameter count.
Grouping all parameters to tweak the building of this command line for remote servers (read LWR) - since I have at least one more to add.
2013-12-11 10:26:15 -06:00
John Chilton b27dc97655 Higher-level abstractions for defining annotation, tag, and rating mappings...
... as well unit tests.
2013-12-11 09:55:54 -06:00
John Chilton 2db01bbe52 Add some higher-level methods to mapping unit test. 2013-12-11 09:55:54 -06:00
John Chilton a655fa496c Resolve default package definitions if extact version is unavailable.
Old behavior can be reverted by setting up a dependency_resolvers_conf.xml with the following contents

```
<dependency_resolvers>
  <tool_shed_packages />
  <galaxy_packages />
</dependency_resolvers>
```

The new behavior corresponds to the following dependency_resolvers_conf.xml contents:

```
<dependency_resolvers>
  <tool_shed_packages />
  <galaxy_packages />
  <galaxy_packages versionless="true" />
</dependency_resolvers>
```

Still think galaxy_packages should come before tool_shed_packages in resolution order so that deployers can fix broken tool shed installs with manual installs or deploy optimized versions of packages without having to mess with a dependency_resolvers_conf.xml file.
2013-12-10 09:43:07 -06:00
John Chilton 18c3133599 Allow command_factory.build_command to pass in metadata kwds.
Add unit tests both for the old default parameters and the ability to replace these defaults.

This is all in case one wants to run the set metadata command on a remote server with different galaxy path, output paths, etc....
2013-12-09 17:14:39 -06:00