Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.tool_util package

Subpackages

Submodules

galaxy.tool_util.fetcher module

class galaxy.tool_util.fetcher.ToolLocationFetcher[source]

Bases: object

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

to_tool_path(path_or_uri_like, **kwds)[source]

galaxy.tool_util.lint module

This modules contains the functions that drive the tool linting framework.

galaxy.tool_util.lint.lint_tool_source(tool_source, level='all', fail_level='warn', extra_modules=None, skip_types=None, name=None)[source]
galaxy.tool_util.lint.lint_xml(tool_xml, level='all', fail_level='warn', extra_modules=None, skip_types=None, name=None)[source]
galaxy.tool_util.lint.lint_tool_source_with(lint_context, tool_source, extra_modules=None)[source]
galaxy.tool_util.lint.lint_xml_with(lint_context, tool_xml, extra_modules=None)[source]
class galaxy.tool_util.lint.LintContext(level, skip_types=None, object_name=None)[source]

Bases: object

__init__(level, skip_types=None, object_name=None)[source]

Initialize self. See help(type(self)) for accurate signature.

lint(name, lint_func, lint_target)[source]
valid(message, *args)[source]
info(message, *args)[source]
error(message, *args)[source]
warn(message, *args)[source]
failed(fail_level)[source]

galaxy.tool_util.loader module

galaxy.tool_util.loader.imported_macro_paths(root)[source]
galaxy.tool_util.loader.load_tool(path)
galaxy.tool_util.loader.load_tool_with_refereces(path)

Load XML documentation from file system and preprocesses XML macros.

Return the XML representation of the expanded tree and paths to referenced files that were imported (macros).

galaxy.tool_util.loader.raw_tool_xml_tree(path)

Load raw (no macro expansion) tree representation of XML represented at the specified path.

galaxy.tool_util.loader.template_macro_params(root)[source]

Look for template macros and populate param_dict (for cheetah) with these.

galaxy.tool_util.loader_directory module

Utilities for loading and reasoning about unparsed tools in directories.

galaxy.tool_util.loader_directory.find_possible_tools_from_path(path, recursive=False, enable_beta_formats=False)[source]

Walk a directory and find potential tool files.

galaxy.tool_util.loader_directory.is_a_yaml_with_class(path, classes)[source]

Determine if a file is a valid YAML with a supplied class entry.

galaxy.tool_util.loader_directory.is_tool_load_error(obj)[source]

Predicate to determine if object loaded for tool is a tool error.

galaxy.tool_util.loader_directory.load_tool_elements_from_path(path, load_exception_handler=<function load_exception_handler>, recursive=False, register_load_errors=False)[source]

Walk a directory and load tool XML elements.

galaxy.tool_util.loader_directory.load_tool_sources_from_path(path, load_exception_handler=<function load_exception_handler>, recursive=False, register_load_errors=False)[source]

Walk a directory and ToolSource objects.

galaxy.tool_util.loader_directory.looks_like_a_cwl_artifact(path, classes=None)[source]

Quick check to see if a file looks like it may be a CWL artifact.

galaxy.tool_util.loader_directory.looks_like_a_tool_cwl(path)[source]

Quick check to see if a file looks like it may be a CWL tool.

galaxy.tool_util.loader_directory.looks_like_a_tool_xml(path)[source]

Quick check to see if a file looks like it may be a Galaxy XML tool file.

galaxy.tool_util.loader_directory.looks_like_a_tool_yaml(path)[source]

Quick check to see if a file looks like it may be a Galaxy YAML tool file.

galaxy.tool_util.output_checker module

galaxy.tool_util.output_checker.check_output_regex(job_id_tag, regex, stream, stream_name, job_messages, max_error_level)[source]

check a single regex against a stream

regex the regex to check stream the stream to search in job_messages a list where the descriptions of the detected regexes can be appended max_error_level the maximum error level that has been detected so far returns the max of the error_level of the regex and the given max_error_level

galaxy.tool_util.output_checker.check_output(stdio_regexes, stdio_exit_codes, stdout, stderr, tool_exit_code, job_id_tag)[source]

Check the output of a tool - given the stdout, stderr, and the tool’s exit code, return DETECTED_JOB_STATE.OK if the tool exited succesfully or error type otherwise. No exceptions should be thrown. If this code encounters an exception, it returns OK so that the workflow can continue; otherwise, a bug in this code could halt workflow progress.

Note that, if the tool did not define any exit code handling or any stdio/stderr handling, then it reverts back to previous behavior: if stderr contains anything, then False is returned.

galaxy.tool_util.provided_metadata module

galaxy.tool_util.provided_metadata.parse_tool_provided_metadata(meta_file, provided_metadata_style=None, job_wrapper=None)[source]

Return a ToolProvidedMetadata object for specified file path.

If meta_file is absent, return a NullToolProvidedMetadata. If provided_metadata_style is None attempt to guess tool provided metadata type.

class galaxy.tool_util.provided_metadata.BaseToolProvidedMetadata[source]

Bases: object

get_new_datasets(output_name)[source]

Find new datasets for dataset discovery for specified output.

Return a list of such datasets.

Called only in the context of discovering datasets when discover_via=”tool_provided_metadata” is defined in the tool.

has_failed_outputs()[source]

Determine if generation of any of the outputs failed.

If True, this method should also log information about at least the first such failed output.

get_new_dataset_meta_by_basename(output_name, basename)[source]

For a discovered dataset, get the corresponding metadata entry.

The discovery may have been from explicit listing in this file (returned from get_new_datasets) or via file regex, either way the basename of the file is used to index the fetching of the metadata entry.

get_unnamed_outputs()[source]

Return unnamed outputs dataset introduced for upload 2.0.

Needs more formal specification but see output_collect for how destinations, types, elements, etc… are consumed.

get_dataset_meta(output_name, dataset_id, dataset_uuid)[source]

Return primary dataset metadata for specified output.

rewrite()[source]

Write metadata back to the file system.

If metadata has not changed via outputs specified as mutable, the implementation class may opt to not re-write the file.

get_new_datasets_for_metadata_collection()[source]

Return all datasets tracked that are not explicit primary outputs.

class galaxy.tool_util.provided_metadata.NullToolProvidedMetadata[source]

Bases: galaxy.tool_util.provided_metadata.BaseToolProvidedMetadata

class galaxy.tool_util.provided_metadata.LegacyToolProvidedMetadata(meta_file, job_wrapper=None)[source]

Bases: galaxy.tool_util.provided_metadata.BaseToolProvidedMetadata

__init__(meta_file, job_wrapper=None)[source]

Initialize self. See help(type(self)) for accurate signature.

get_dataset_meta(output_name, dataset_id, dataset_uuid)[source]

Return primary dataset metadata for specified output.

get_new_dataset_meta_by_basename(output_name, basename)[source]

For a discovered dataset, get the corresponding metadata entry.

The discovery may have been from explicit listing in this file (returned from get_new_datasets) or via file regex, either way the basename of the file is used to index the fetching of the metadata entry.

get_new_datasets(output_name)[source]

Find new datasets for dataset discovery for specified output.

Return a list of such datasets.

Called only in the context of discovering datasets when discover_via=”tool_provided_metadata” is defined in the tool.

has_failed_outputs()[source]

Determine if generation of any of the outputs failed.

If True, this method should also log information about at least the first such failed output.

get_unnamed_outputs()[source]

Return unnamed outputs dataset introduced for upload 2.0.

Needs more formal specification but see output_collect for how destinations, types, elements, etc… are consumed.

rewrite()[source]

Write metadata back to the file system.

If metadata has not changed via outputs specified as mutable, the implementation class may opt to not re-write the file.

get_new_datasets_for_metadata_collection()[source]

Return all datasets tracked that are not explicit primary outputs.

class galaxy.tool_util.provided_metadata.ToolProvidedMetadata(meta_file)[source]

Bases: galaxy.tool_util.provided_metadata.BaseToolProvidedMetadata

__init__(meta_file)[source]

Initialize self. See help(type(self)) for accurate signature.

get_dataset_meta(output_name, dataset_id, dataset_uuid)[source]

Return primary dataset metadata for specified output.

get_new_dataset_meta_by_basename(output_name, basename)[source]

For a discovered dataset, get the corresponding metadata entry.

The discovery may have been from explicit listing in this file (returned from get_new_datasets) or via file regex, either way the basename of the file is used to index the fetching of the metadata entry.

get_new_datasets(output_name)[source]

Find new datasets for dataset discovery for specified output.

Return a list of such datasets.

Called only in the context of discovering datasets when discover_via=”tool_provided_metadata” is defined in the tool.

has_failed_outputs()[source]

Determine if generation of any of the outputs failed.

If True, this method should also log information about at least the first such failed output.

get_unnamed_outputs()[source]

Return unnamed outputs dataset introduced for upload 2.0.

Needs more formal specification but see output_collect for how destinations, types, elements, etc… are consumed.

rewrite()[source]

Write metadata back to the file system.

If metadata has not changed via outputs specified as mutable, the implementation class may opt to not re-write the file.