diff --git a/.circleci/config.yml b/.circleci/config.yml index 32dfbce7036..ef892c831e9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,9 +139,6 @@ jobs: <<: *set_workdir steps: - *restore_repo_cache - - run: sudo apt-get update - # For uwsgi - - run: sudo apt-get install -y libpython3.5-dev - *install_tox - run: tox -e py35-first_startup validate_test_tools: diff --git a/client/galaxy/scripts/admin.toolshed.js b/client/galaxy/scripts/admin.toolshed.js deleted file mode 100644 index 04182abfda5..00000000000 --- a/client/galaxy/scripts/admin.toolshed.js +++ /dev/null @@ -1,80 +0,0 @@ -import Backbone from "backbone"; -import { getGalaxyInstance } from "app"; -import mod_shed_list_view from "mvc/toolshed/shed-list-view"; -import mod_categories_view from "mvc/toolshed/categories-view"; -import mod_repositories_view from "mvc/toolshed/repositories-view"; -import mod_repository_view from "mvc/toolshed/repository-view"; -import mod_repoqueue_view from "mvc/toolshed/repository-queue-view"; -import mod_repo_status_view from "mvc/toolshed/repo-status-view"; -import mod_workflows_view from "mvc/toolshed/workflows-view"; - -var AdminToolshedRouter = Backbone.Router.extend({ - routes: { - "": "toolsheds", - sheds: "toolsheds", - queue: "queue", - workflows: "workflows", - "status/r/:repositories": "status", - status: "status", - "categories/s/:tool_shed": "categories", - "category/s/:tool_shed/c/:category_id/k/:sort_key/p/:page/t/:sort_order": "repositories", - "repository/s/:tool_shed/r/:repository_id": "repository" - } -}); - -var GalaxyAdminToolshedApp = Backbone.View.extend({ - app_config: { - known_views: ["toolsheds", "queue", "status", "categories", "repositories", "repository"] - }, - - initialize: function() { - const Galaxy = getGalaxyInstance(); - - Galaxy.admintoolshedapp = this; - this.admin_toolshed_router = new AdminToolshedRouter(); - - this.admin_toolshed_router.on("route:queue", () => { - Galaxy.admintoolshedapp.adminRepoQueueView = new mod_repoqueue_view.RepoQueueView(); - }); - this.admin_toolshed_router.on("route:toolsheds", () => { - Galaxy.admintoolshedapp.adminShedListView = new mod_shed_list_view.ShedListView(); - }); - this.admin_toolshed_router.on("route:categories", tool_shed => { - Galaxy.admintoolshedapp.adminShedCategoriesView = new mod_categories_view.CategoryView({ - tool_shed: tool_shed.replace(/\//g, "%2f") - }); - }); - this.admin_toolshed_router.on( - "route:repositories", - (tool_shed, category_id, sort_key = "name", page = 1, sort_order = "asc") => { - Galaxy.admintoolshedapp.adminShedCategoryView = new mod_repositories_view.Category({ - tool_shed: tool_shed.replace(/\//g, "%2f"), - category_id: category_id, - page: page, - sort_order: sort_order, - sort_key: sort_key - }); - } - ); - this.admin_toolshed_router.on("route:repository", (tool_shed, repository_id) => { - Galaxy.admintoolshedapp.adminRepositoryView = new mod_repository_view.RepoDetails({ - tool_shed: tool_shed.replace(/\//g, "%2f"), - repository_id: repository_id - }); - }); - this.admin_toolshed_router.on("route:status", repositories => { - Galaxy.admintoolshedapp.adminRepoStatusView = new mod_repo_status_view.RepoStatus({ - repositories: repositories.split("|") - }); - }); - this.admin_toolshed_router.on("route:workflows", () => { - Galaxy.admintoolshedapp.adminWorkflowsView = new mod_workflows_view.Workflows(); - }); - - Backbone.history.start({ pushState: false }); - } -}); - -export default { - GalaxyApp: GalaxyAdminToolshedApp -}; diff --git a/client/galaxy/scripts/bundleEntries.js b/client/galaxy/scripts/bundleEntries.js index 0390749fb83..4112b14bbb2 100644 --- a/client/galaxy/scripts/bundleEntries.js +++ b/client/galaxy/scripts/bundleEntries.js @@ -17,7 +17,6 @@ import Circster from "viz/circster"; export { PhylovizView as phyloviz } from "viz/phyloviz"; export { SweepsterVisualization, SweepsterVisualizationView } from "viz/sweepster"; import GalaxyLibrary from "galaxy.library"; -import AdminToolshed from "admin.toolshed"; export { default as pages } from "galaxy.pages"; export { createTabularDatasetChunkedView } from "mvc/dataset/data"; import { HistoryCollection } from "mvc/history/history-model"; @@ -36,10 +35,6 @@ export { default as IES } from "galaxy.interactive_environments"; export { Toast } from "ui/toast"; // TODO: remove when external consumers are updated/gone (IES right now) -export function adminToolshed(options) { - new AdminToolshed.GalaxyApp(options); -} - export function trackster(options) { new TracksterUIView(options); } diff --git a/client/galaxy/scripts/entry/panels/admin-panel.js b/client/galaxy/scripts/entry/panels/admin-panel.js index a91e6703a8e..f3070e35a96 100644 --- a/client/galaxy/scripts/entry/panels/admin-panel.js +++ b/client/galaxy/scripts/entry/panels/admin-panel.js @@ -171,7 +171,7 @@ const AdminPanel = Backbone.View.extend({ _templateSection: function(options) { return `
-
${_l(options.title)}
+
${_l(options.title)}
`; }, diff --git a/client/galaxy/scripts/mvc/library/library-folderlist-view.js b/client/galaxy/scripts/mvc/library/library-folderlist-view.js index cedc161f341..4c272c2e1a7 100644 --- a/client/galaxy/scripts/mvc/library/library-folderlist-view.js +++ b/client/galaxy/scripts/mvc/library/library-folderlist-view.js @@ -55,7 +55,6 @@ var FolderListView = Backbone.View.extend({ // start to listen if someone modifies the collection this.listenTo(this.collection, "add", this.renderOne); this.listenTo(this.collection, "remove", this.removeOne); - this.listenTo(this.collection, "sort", this.rePaint); this.listenTo(this.collection, "reset", this.rePaint); this.fetchFolder(); @@ -273,7 +272,8 @@ var FolderListView = Backbone.View.extend({ event.preventDefault(); this.current_sort_order = this.current_sort_order === "asc" ? "desc" : "asc"; this.current_sort_key = event.currentTarget.className.replace("sort-folder-", ""); - this.collection.sortFolder(this.current_sort_key, this.current_sort_order); + const sorted_folder = this.folder_container.sortFolder(this.current_sort_key, this.current_sort_order); + this.collection.reset(sorted_folder.models); this.renderSortIcon(); }, diff --git a/client/galaxy/scripts/mvc/library/library-model.js b/client/galaxy/scripts/mvc/library/library-model.js index 99f32568f0e..6ad5f054bde 100644 --- a/client/galaxy/scripts/mvc/library/library-model.js +++ b/client/galaxy/scripts/mvc/library/library-model.js @@ -75,11 +75,6 @@ var FolderAsModel = LibraryItem.extend({ var Folder = Backbone.Collection.extend({ model: LibraryItem, - - sortFolder: function(sort_key, sort_order) { - this.comparator = mod_util.generateComparator(sort_key, sort_order); - this.sort(); - } }); var FolderContainer = Backbone.Model.extend({ @@ -104,6 +99,12 @@ var FolderContainer = Backbone.Model.extend({ }); }, + sortFolder: function(sort_key, sort_order) { + this.get("folder").comparator = mod_util.generateComparator(sort_key, sort_order); + this.get("folder").sort(); + return this.get("folder"); + }, + parse: function(obj) { const Galaxy = getGalaxyInstance(); // empty the collection diff --git a/client/galaxy/scripts/mvc/tool/tool-form-base.js b/client/galaxy/scripts/mvc/tool/tool-form-base.js index b98d5f1929b..ba499e4d9b9 100644 --- a/client/galaxy/scripts/mvc/tool/tool-form-base.js +++ b/client/galaxy/scripts/mvc/tool/tool-form-base.js @@ -280,7 +280,7 @@ export default FormBase.extend({ } }).$mount(vm); } - if (options.xrefs) { + if (options.xrefs && options.xrefs.length) { var xrefInstance = Vue.extend(xrefs); vm = document.createElement("div"); $el.append(vm); diff --git a/client/galaxy/scripts/mvc/toolshed/categories-view.js b/client/galaxy/scripts/mvc/toolshed/categories-view.js deleted file mode 100644 index 226da29c9bc..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/categories-view.js +++ /dev/null @@ -1,98 +0,0 @@ -import _ from "underscore"; -import $ from "jquery"; -import Backbone from "backbone"; -import { getAppRoot } from "onload/loadConfig"; -import toolshed_model from "mvc/toolshed/toolshed-model"; -import toolshed_util from "mvc/toolshed/util"; -import "libs/jquery/jquery-ui"; - -var ToolShedCategories = Backbone.View.extend({ - el: "#center", - - initialize: function(options) { - this.options = _.defaults(this.options || options, this.defaults); - this.model = new toolshed_model.Categories(); - this.model.url = `${this.model.url}?tool_shed_url=${this.options.tool_shed}`; - this.model.tool_shed = options.tool_shed.replace(/\//g, "%2f"); - this.model.fetch(); - this.listenTo(this.model, "sync", this.render); - }, - - render: function(options) { - const category_list_template = this.templateCategoryList(); - this.options = _.extend(this.options, options); - this.options.categories = this.model.models; - this.options.queue = toolshed_util.queueLength(); - this.$el.html(category_list_template(this.options)); - this.bindEvents(); - $("#center").css("overflow", "auto"); - }, - - bindEvents: function() { - $("#search_box").autocomplete({ - source: (request, response) => { - var shed_url = this.model.tool_shed.replace(/%2f/g, "/"); - var base_url = `${getAppRoot()}api/tool_shed/search`; - var params = { - term: request.term, - tool_shed_url: shed_url - }; - $.post(base_url, params, data => { - console.log(data); - var result_list = toolshed_util.shedParser(data); - response(result_list); - }); - }, - minLength: 3, - select: (event, ui) => { - var tsr_id = ui.item.value; - var new_route = `repository/s/${this.model.tool_shed}/r/${tsr_id}`; - Backbone.history.navigate(new_route, { - trigger: true, - replace: true - }); - } - }); - }, - - templateCategoryList: function() { - return _.template( - `
-
-

Categories in <%= tool_shed.replace(/%2f/g, '/') %>

- Repository Queue (<%= queue %>) - -
- -
- - - - - - - - - <% _.each(categories, function(category) { %> - - - - - - <% }); %> -
NameDescriptionRepositories
- /k/name/p/1/t/asc'><%= category.get('name') %> - <%= category.get('description') %><%= category.get('repositories') %>
-
-
` - ); - } -}); - -export default { - CategoryView: ToolShedCategories -}; diff --git a/client/galaxy/scripts/mvc/toolshed/repo-status-view.js b/client/galaxy/scripts/mvc/toolshed/repo-status-view.js deleted file mode 100644 index ebdd99624b5..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/repo-status-view.js +++ /dev/null @@ -1,132 +0,0 @@ -import $ from "jquery"; -import Backbone from "backbone"; -import _ from "underscore"; -import _l from "utils/localization"; -import toolshed_model from "mvc/toolshed/toolshed-model"; -import toolshed_util from "mvc/toolshed/util"; - -var ToolShedRepoStatusView = Backbone.View.extend({ - el: "#center", - - initialize: function(options) { - this.options = _.defaults(this.options || [{}], options, this.defaults); - this.model = new toolshed_model.RepoStatus(); - this.listenTo(this.model, "sync", this.render); - this.model.url += `?repositories=${this.options.repositories.join("|")}`; - this.model.fetch(); - this.timer = window.setInterval(() => { - var terminal_states = ["installed", "error"]; - var all_done = true; - _.some(this.model.models, repository => { - var repo_status = repository.get("status").toLowerCase(); - if (terminal_states.indexOf(repo_status) === -1) { - all_done = false; - return true; - } - }); - if (all_done) { - window.clearInterval(this.timer); - } else { - this.model.fetch(); - } - }, 2000); - }, - - close: function() { - window.clearInterval(this.timer); - }, - - render: function(options) { - this.options = _.extend(this.options, options); - var repo_status_template = this.templateRepoStatus(); - this.$el.html( - repo_status_template({ - title: _l("Repository Status"), - repositories: this.model.models, - queue: toolshed_util.queueLength() - }) - ); - $("#center").css("overflow", "auto"); - }, - - templateRepoStatus: function() { - return _.template( - `
- -
- - - - - - - - - - - - - <% _.each(repositories, function(repository) { %> - - - - - - - - <% }); %> - - -
NameDescriptionOwnerRevisionInstallation Status
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
` - ); - } -}); - -export default { - RepoStatus: ToolShedRepoStatusView -}; diff --git a/client/galaxy/scripts/mvc/toolshed/repositories-view.js b/client/galaxy/scripts/mvc/toolshed/repositories-view.js deleted file mode 100644 index fca581d61f3..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/repositories-view.js +++ /dev/null @@ -1,222 +0,0 @@ -import _ from "underscore"; -import $ from "jquery"; -import Backbone from "backbone"; -import { getAppRoot } from "onload/loadConfig"; -import toolshed_model from "mvc/toolshed/toolshed-model"; -import toolshed_util from "mvc/toolshed/util"; -import "libs/jquery/jquery-ui"; - -var ToolShedCategoryContentsView = Backbone.View.extend({ - el: "#center", - - initialize: function(params) { - this.params = params; - this.model = new toolshed_model.CategoryCollection(); - this.listenTo(this.model, "sync", this.render); - var shed = params.tool_shed.replace(/\//g, "%2f"); - this.model.url += `?tool_shed_url=${shed}`; - this.model.url += `&category_id=${params.category_id}`; - this.model.url += `&sort_key=${params.sort_key}`; - this.model.url += `&sort_order=${params.sort_order}`; - this.model.url += `&page=${params.page}`; - this.model.tool_shed = shed; - this.model.category = params.category_id; - this.model.fetch(); - }, - - render: function(options) { - this.options = _.defaults(this.options || {}, options); - var category_contents_template = this.templateCategoryContents(); - var page_navigation_template = this.templatePageNavigation(); - var sorting = { - class: { owner: "fa-sort", description: "fa-sort", name: "fa-sort" }, - direction: { owner: "asc", description: "asc", name: "asc" } - }; - sorting.class[this.params.sort_key] = this.params.sort_order == "desc" ? "fa-sort-down" : "fa-sort-up"; - sorting.direction[this.params.sort_key] = this.params.sort_order == "asc" ? "desc" : "asc"; - var previous_page = Math.max(this.params.page - 1, 1); - var pages = parseInt(this.model.models[0].get("repository_count") % 25) + 1; - var next_page = Math.min(parseInt(this.params.page) + 1, pages); - var pagination_params = { - page: this.params.page, - next: next_page, - previous: previous_page, - pages: pages - }; - if (pages > 5) { - var page = parseInt(this.params.page); - var page_slice = Array(); - var slice_start = Math.max(page - 2, 2); - var i = slice_start; - var slice_end = Math.min(Math.min(page + 2, slice_start + 4), pages); - for (i = slice_start; i <= slice_end; i++) { - page_slice.push(i); - } - pagination_params["page_slice"] = page_slice; - } - this.$el.html( - category_contents_template({ - page_navigation: page_navigation_template(pagination_params), - category: this.model.models[0], - tool_shed: this.model.tool_shed, - queue: toolshed_util.queueLength(), - sorting: sorting, - page: this.params.page - }) - ); - $("#center").css("overflow", "auto"); - this.bindEvents(); - }, - - bindEvents: function() { - $("#search_box").autocomplete({ - source: (request, response) => { - var shed_url = this.model.tool_shed.replace(/%2f/g, "/"); - var base_url = `${getAppRoot()}api/tool_shed/search`; - var params = { - term: request.term, - tool_shed_url: shed_url - }; - $.post(base_url, params, data => { - var result_list = toolshed_util.shedParser(data); - response(result_list); - }); - }, - minLength: 3, - select: (event, ui) => { - var tsr_id = ui.item.value; - var new_route = `repository/s/${this.model.tool_shed}/r/${tsr_id}`; - Backbone.history.navigate(new_route, { - trigger: true, - replace: true - }); - } - }); - $(".fa-fw").on("click", ev => { - var parameters = {}; - parameters.field = $(ev.target).attr("data-field"); - parameters.direction = $(ev.target).attr("data-direction"); - var new_route = `category/s/${this.model.tool_shed}/c/${this.model.category}/k/${parameters.field}/p/${ - this.params.page - }/t/${parameters.direction}`; - Backbone.history.navigate(new_route, { - trigger: true, - replace: true - }); - }); - $(".pagenav").on("click", ev => { - var page = $(ev.target).attr("data-page"); - var new_route = `category/s/${this.model.tool_shed}/c/${this.model.category}/k/${ - this.params.sort_key - }/p/${page}/t/${this.params.sort_order}`; - Backbone.history.navigate(new_route, { - trigger: true, - replace: true - }); - }); - }, - - templatePageNavigation: function() { - return _.template( - `` - ); - }, - - templateCategoryContents: function() { - return _.template( - ` -
- -
-
- - <% if (category.get('repository_count') > 25) { %> - <%= page_navigation %> - <% } %> -
- - - - - - - - - - <% _.each(category.get("repositories"), function(repository) { %> - - - - - - - <% }); %> -
OwnerNameSynopsisType
<%= repository.owner %> - - <%= repository.description %><%= repository.type %>
-
-
` - ); - } -}); - -export default { - Category: ToolShedCategoryContentsView -}; diff --git a/client/galaxy/scripts/mvc/toolshed/repository-queue-view.js b/client/galaxy/scripts/mvc/toolshed/repository-queue-view.js deleted file mode 100644 index a00f7948c31..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/repository-queue-view.js +++ /dev/null @@ -1,166 +0,0 @@ -import _ from "underscore"; -import $ from "jquery"; -import Backbone from "backbone"; -import { getAppRoot } from "onload/loadConfig"; -import _l from "utils/localization"; -import toolshed_model from "mvc/toolshed/toolshed-model"; -import toolshed_util from "mvc/toolshed/util"; - -var View = Backbone.View.extend({ - el: "#center", - - defaults: [], - - initialize: function(options) { - this.model = new toolshed_model.RepoQueue(); - this.listenTo(this.model, "sync", this.render); - this.model.fetch(); - this.render(); - }, - - render: function(options) { - var repo_queue_template = this.templateRepoQueue(); - var repositories = this.model.models; - this.$el.html( - repo_queue_template({ - repositories: repositories, - queue: toolshed_util.queueLength() - }) - ); - $("#center").css("overflow", "auto"); - this.bindEvents(); - }, - - bindEvents: function() { - $(".install_one").on("click", ev => { - const repository_metadata = this.loadFromQueue($(ev.target).attr("data-repokey")); - this.installFromQueue(repository_metadata, $(ev.target).attr("data-repokey")); - }); - $(".remove_one").on("click", ev => { - const queue_key = $(ev.target).attr("data-repokey"); - const repo_queue = JSON.parse(window.localStorage.repositories); - if (repo_queue.hasOwnProperty(queue_key)) { - this.removeRow(repo_queue[queue_key].id); - delete repo_queue[queue_key]; - } - window.localStorage.repositories = JSON.stringify(repo_queue); - }); - $("#clear_queue").on("click", () => { - const repo_queue = JSON.parse(window.localStorage.repositories); - for (const key of Object.keys(repo_queue)) { - this.removeRow(repo_queue[key].id); - } - window.localStorage.repositories = "{}"; - }); - $("#from_workflow").on("click", () => { - Backbone.history.navigate("workflows", { - trigger: true, - replace: true - }); - }); - }, - - removeRow: function(row_id) { - $(`#queued_repository_${row_id}`).remove(); - }, - - installFromQueue: function(repository_metadata, queue_key) { - var params = {}; - params.install_tool_dependencies = repository_metadata.install_tool_dependencies; - params.install_repository_dependencies = repository_metadata.install_repository_dependencies; - params.install_resolver_dependencies = repository_metadata.install_resolver_dependencies; - params.tool_panel_section = repository_metadata.tool_panel_section; - params.shed_tool_conf = repository_metadata.shed_tool_conf; - params.repositories = JSON.stringify([ - [repository_metadata.repository.id, repository_metadata.changeset_revision] - ]); - params.tool_shed_repository_ids = JSON.stringify([repository_metadata.repository.id]); - params.tool_shed_url = queue_key.split("|")[0]; - params.changeset = repository_metadata.changeset_revision; - var url = `${getAppRoot()}api/tool_shed_repositories/install?async=True`; - $(`#queued_repository_${repository_metadata.repository.id}`).remove(); - if (window.localStorage.repositories) { - if (queue_key === undefined) { - queue_key = toolshed_util.queueKey(repository_metadata); - } - var repository_queue = JSON.parse(window.localStorage.repositories); - if (repository_queue.hasOwnProperty(queue_key)) { - delete repository_queue[queue_key]; - window.localStorage.repositories = JSON.stringify(repository_queue); - } - } - - $.post(url, params, data => { - var iri_params = JSON.parse(data); - var repositories = iri_params.repositories; - var new_route = `status/r/${repositories.join("|")}`; - $.post(`${getAppRoot()}admin_toolshed/install_repositories`, iri_params, data => { - console.log("Initializing repository installation succeeded"); - }); - Backbone.history.navigate(new_route, { - trigger: true, - replace: true - }); - }); - }, - - loadFromQueue: function(queue_key) { - var repository_queue = JSON.parse(window.localStorage.repositories); - if (repository_queue.hasOwnProperty(queue_key)) { - return repository_queue[queue_key]; - } - return this.defaults; - }, - - templateRepoQueue: function() { - return _.template( - `
-

- ${_l("Repository Queue")} -

-
- - - - - - - - - - - - - <% if (repositories.length > 0) { %> - <% _.each(repositories, function(repository) { %> - '> - - - - - - - - <% }); %> - <% } else { %> - - <% } %> - -
NameOwnerRevisionToolShedInstall
<%= repository.get('repository').name %><%= repository.get('repository').owner %><%= repository.get('changeset_revision') %><%= repository.get('tool_shed_url') %> - ' type='submit' id='install_repository_<%= repository.get('id') %>' name='install_repository' value='Install now' /> - - ' type='submit' id='unqueue_repository_<%= repository.get('id') %>' name='unqueue_repository' value='Remove from queue' /> -
- ${_l("No repositories in queue.")} -
- - -
-
` - ); - } -}); - -export default { - RepoQueueView: View -}; diff --git a/client/galaxy/scripts/mvc/toolshed/repository-view.js b/client/galaxy/scripts/mvc/toolshed/repository-view.js deleted file mode 100644 index 80f9869efc8..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/repository-view.js +++ /dev/null @@ -1,637 +0,0 @@ -import _ from "underscore"; -import $ from "jquery"; -import Backbone from "backbone"; -import { getAppRoot } from "onload/loadConfig"; -import "libs/jquery/jstree"; -import toolshed_model from "mvc/toolshed/toolshed-model"; -import Utils from "utils/utils"; -import Modal from "mvc/ui/ui-modal"; -import FormView from "mvc/form/form-view"; -import toolshed_util from "mvc/toolshed/util"; - -var ToolShedRepositoryView = Backbone.View.extend({ - el: "#center", - - initialize: function(params) { - this.options = _.defaults(this.options || {}, this.defaults); - this.model = new toolshed_model.RepositoryCollection(); - this.listenTo(this.model, "sync", this.render); - var shed = params.tool_shed.replace(/\//g, "%2f"); - this.model.url += `?tool_shed_url=${shed}&repository_id=${params.repository_id}`; - this.model.tool_shed_url = params.tool_shed.replace(/%2f/g, "/"); - this.model.tool_shed = shed; - this.model.category = params.repository_id; - this.model.fetch(); - }, - - render: function(options) { - var repo_details_template = this.templateRepoDetails(); - var models = this.model.models[0]; - this.options = { - repository: models.get("repository"), - tool_shed: this.model.tool_shed, - queue: toolshed_util.queueLength() - }; - var changesets = Object.keys(this.options.repository.metadata).sort(function(a, b) { - return parseInt(a.split(":")[0] - b.split(":")[0]); - }); - var ordered_metadata = {}; - var unordered_metadata = this.options.repository.metadata; - changesets.forEach(function(key) { - ordered_metadata[key] = unordered_metadata[key]; - }); - this.options.repository.metadata = ordered_metadata; - this.options.current_changeset = this.options.current_changeset || changesets[changesets.length - 1]; - this.options.current_metadata = this.options.repository.metadata[this.options.current_changeset]; - this.options.current_metadata.tool_shed_url = this.model.tool_shed_url; - this.options.tools = this.options.current_metadata.tools; - this.options.repository_dependencies_template = this.templateRepoDependencies(); - this.options.repository_dependency_template = this.templateRepoDependency(); - this.options.tps_template_global_select = this.templateGlobalSectionSelect(); - this.options.tps_template_global_create = this.templateGlobalSectionCreate(); - this.options.tps_template_tool_select = this.templateToolSectionSelect(); - this.options.tps_template_tool_create = this.templateToolSectionCreate(); - this.options.panel_section_options = this.templatePanelSelectOptions(); - this.options.tool_dependencies = models.get("tool_dependencies"); - this.options.shed_tool_conf = this.templateShedToolConf({ - shed_tool_confs: models.get("shed_conf") - }); - this.options.panel_section_dict = models.get("panel_section_dict"); - this.options.api_url = `${getAppRoot()}api/tool_shed_repositories/install?async=True`; - this.options = _.extend(this.options, options); - this.$el.html(repo_details_template(this.options)); - this.checkInstalled(this.options.current_metadata); - this.bindEvents(); - $("#center").css("overflow", "auto"); - }, - - bindEvents: function() { - $("#changeset").on("change", () => { - this.options.current_changeset = $("#changeset") - .find("option:selected") - .text(); - this.options.current_metadata = this.options.repository.metadata[this.options.current_changeset]; - this.checkInstalled(this.options.current_metadata); - this.reDraw(this.options); - }); - $("#tool_panel_section_select").on("change", () => { - this.tpsSelection(); - }); - $("#install_repository").on("click", ev => { - ev.preventDefault(); - var params = {}; - params.repositories = JSON.stringify([ - [ - $("#install_repository").attr("data-tsrid"), - $("#changeset") - .find("option:selected") - .val() - ] - ]); - params.tool_shed_repository_ids = JSON.stringify([$("#install_repository").attr("data-tsrid")]); - params.tool_shed_url = this.model.tool_shed_url; - params.install_tool_dependencies = $("#install_tool_dependencies").val(); - params.install_repository_dependencies = $("#install_repository_dependencies").val(); - params.install_resolver_dependencies = $("#install_resolver_dependencies").val(); - params.tool_panel_section = JSON.stringify(this.panelSelect(params)); - params.shed_tool_conf = $("select[name='shed_tool_conf']") - .find("option:selected") - .val(); - params.changeset = $("#changeset") - .find("option:selected") - .val(); - var url = $("#repository_installation").attr("action"); - this.prepareInstall(params, url); - }); - $("#queue_install").on("click", ev => { - this.options.current_changeset = $("#changeset") - .find("option:selected") - .text(); - this.options.current_metadata = this.options.repository.metadata[this.options.current_changeset]; - var repository_metadata = {}; - _.each(Object.keys(this.options.current_metadata), key => { - if (!repository_metadata[key]) { - repository_metadata[key] = this.options.current_metadata[key]; - } - }); - repository_metadata.install_tool_dependencies = $("#install_tool_dependencies").val(); - repository_metadata.install_repository_dependencies = $("#install_repository_dependencies").val(); - repository_metadata.install_resolver_dependencies = $("#install_resolver_dependencies").val(); - repository_metadata.tool_panel_section = JSON.stringify(this.panelSelect({})); - repository_metadata.shed_tool_conf = $("select[name='shed_tool_conf']") - .find("option:selected") - .val(); - repository_metadata.tool_shed_url = this.model.tool_shed_url; - if (repository_metadata.tool_shed_url.substr(-1) == "/") { - repository_metadata.tool_shed_url = repository_metadata.tool_shed_url.substr( - 0, - repository_metadata.tool_shed_url.length - 1 - ); - } - toolshed_util.addToQueue(repository_metadata); - this.checkInstalled(repository_metadata); - }); - this.toolTPSSelectionEvents(); - $(() => { - $("#repository_dependencies").jstree(); - }); - $(".tool_form").on("click", ev => { - var guid = $(ev.target).attr("data-guid"); - var name = $(ev.target).attr("data-name"); - var desc = $(ev.target).attr("data-desc"); - var tool_shed_url = this.model.tool_shed_url; - var tsr_id = $("#repository_details").attr("data-tsrid"); - var changeset = $("#changeset") - .find("option:selected") - .val(); - var api_url = `${getAppRoot()}api/tool_shed/tool_json`; - var params = { - guid: guid, - tool_shed_url: tool_shed_url, - tsr_id: tsr_id, - changeset: changeset - }; - $.get(api_url, params, data => { - var toolform = new FormView(data); - Utils.deepeach(data.inputs, input => { - if (input.type) { - if (["data", "data_collection"].indexOf(input.type) != -1) { - input.type = "hidden"; - input.info = `Data input '${input.name}' (${Utils.textify(input.extensions)})`; - } - } - }); - var modal = new Modal.View(); - var modal_title = `${name} ${desc}`; - modal.show({ - closing_events: true, - title: modal_title, - body: toolform.$el, - buttons: { - Close: function() { - modal.hide(); - } - } - }); - }); - }); - $(".select-tps-button").on("click", params => { - var changeset = this.selectedChangeset(); - var guid = params.target.attributes.getNamedItem("data-toolguid"); - this.showToolTPSSelect(guid, changeset); - }); - $(".create-tps-button").on("click", params => { - var changeset = this.selectedChangeset(); - var guid = params.target.attributes.getNamedItem("data-toolguid"); - this.showToolTPSCreate(guid, changeset); - }); - $(".global-select-tps-button").on("click", () => { - $("#tool_panel_section").replaceWith(this.options.tps_template_global_select(this.options)); - this.propagateTPS(); - this.bindEvents(); - }); - $(".global-create-tps-button").on("click", () => { - $("#tool_panel_section").replaceWith(this.options.tps_template_global_create()); - this.bindEvents(); - }); - }, - - checkInstalled: function(metadata) { - var params = { name: metadata.name, owner: metadata.owner }; - var already_installed = false; - $.get(`${getAppRoot()}api/tool_shed_repositories`, params, data => { - for (var index = 0; index < data.length; index++) { - var repository = data[index]; - var installed = !repository.deleted && !repository.uninstalled; - var changeset_match = - repository.changeset_revision == metadata.changeset_revision || - repository.installed_changeset_revision == metadata.changeset_revision; - if ( - repository.name == metadata.repository.name && - repository.owner == metadata.repository.owner && - installed && - changeset_match - ) { - already_installed = true; - } - if (already_installed) { - $("#install_repository").prop("disabled", true); - $("#install_repository").val("This revision is already installed"); - } else { - $("#install_repository").prop("disabled", false); - $("#install_repository").val("Install this revision"); - } - } - if (this.repoQueued(metadata) || already_installed) { - $("#queue_install").hide(); - $("#queue_install").val("This revision is already in the queue"); - } else { - $("#queue_install").show(); - $("#queue_install").val("Install this revision later"); - } - }); - }, - - panelSelect: function(params) { - var tool_panel_section = {}; - if ($("#tool_panel_section_select").length) { - params.tool_panel_section_id = $("#tool_panel_section_select") - .find("option:selected") - .val(); - } else { - params.new_tool_panel_section = $("#new_tool_panel_section").val(); - } - $(".tool_panel_section_picker").each(function() { - var element_name = $(this).attr("name"); - var tool_guid = $(this).attr("data-toolguid"); - if (element_name === "tool_panel_section_id") { - tool_panel_section[tool_guid] = { - tool_panel_section: $(this) - .find("option:selected") - .val(), - action: "append" - }; - } else { - tool_panel_section[tool_guid] = { - tool_panel_section: $(this).val(), - action: "create" - }; - } - }); - return tool_panel_section; - }, - - reDraw: function(options) { - this.$el.empty(); - this.render(options); - }, - - repoQueued: function(metadata) { - if (!window.localStorage.repositories) { - return; - } - var queue_key = this.queueKey(metadata); - var queued_repos; - if (window.localStorage.repositories) { - queued_repos = JSON.parse(window.localStorage.repositories); - } - if (queued_repos && queued_repos.hasOwnProperty(queue_key)) { - return true; - } - return false; - }, - - queueKey: function(metadata) { - var shed_url = this.model.tool_shed_url; - // Make sure there is never a trailing slash on the shed URL. - if (shed_url.substr(-1) == "/") { - shed_url = shed_url.substr(0, shed_url.length - 1); - } - return `${shed_url}|${metadata.repository_id}|${metadata.changeset_revision}`; - }, - - tpsSelection: function() { - var new_tps = $("#tool_panel_section_select") - .find("option:selected") - .val(); - $('.tool_panel_section_picker[default="active"]').each(function() { - $(this).val(new_tps); - }); - }, - - prepareInstall: function(params, api_url) { - $.post(api_url, params, data => { - var iri_parameters = JSON.parse(data); - this.doInstall(iri_parameters); - }); - }, - - doInstall: function(params) { - var controller_url = `${getAppRoot()}admin_toolshed/install_repositories`; - var repositories = params.repositories; - var new_route = `status/r/${repositories.join("|")}`; - $.post(controller_url, params, data => { - console.log("Initializing repository installation succeeded"); - }); - Backbone.history.navigate(new_route, { - trigger: true, - replace: true - }); - }, - - selectedChangeset: function() { - return $("#changeset") - .find("option:selected") - .val(); - }, - - showToolTPSCreate: function(guid, changeset) { - var metadata = this.options.current_metadata; - var tools = metadata.tools; - var tool = toolshed_util.toolByGuid(guid, changeset, tools); - var selector = "#tool_tps_" + tool.clean; - $(selector).empty(); - $(selector).append(this.options.tps_template_tool_create({ tool: tool })); - $(".select-tps-button").click(ev => { - var changeset = this.selectedChangeset(); - var guid = ev.target.attributes.getNamedItem("data-toolguid"); - this.showToolTPSSelect(guid, changeset); - }); - this.bindEvents(); - }, - - showToolTPSSelect: function(guid, changeset) { - var metadata = this.options.current_metadata; - var tools = metadata.tools; - var tool = toolshed_util.toolByGuid(guid, changeset, tools); - var selector = "#tool_tps_" + tool.clean; - $(selector).empty(); - $(selector).append( - this.options.tps_template_tool_select({ - tool: tool, - panel_section_dict: this.options.panel_section_dict, - panel_section_options: this.options.panel_section_options - }) - ); - $(".create-tps-button").click(ev => { - var changeset = this.selectedChangeset(); - var guid = ev.target.attributes.getNamedItem("data-toolguid"); - this.showToolTPSCreate(guid, changeset); - }); - this.bindEvents(); - }, - - propagateTPS: function() { - $("#tool_panel_section_select").change(() => { - var new_tps = $("#tool_panel_section_select") - .find("option:selected") - .val(); - $('.tool_panel_section_picker[default="active"]').each(obj => { - obj.val(new_tps); - }); - }); - this.toolTPSSelectionEvents(); - }, - - toolTPSSelectionEvents: function() { - $(".tool_panel_section_picker").on("change", ev => { - const element = $(ev.target); - var new_value = element.find("option:selected").val(); - var default_tps = $("#tool_panel_section_select") - .find("option:selected") - .val(); - if (new_value == default_tps) { - element.attr("default", "active"); - } else { - element.removeAttr("default"); - } - }); - }, - - templateRepoDetails: function() { - return _.template( - `
-
Repository information for <%= repository.name %> from <%= repository.owner %>Repository Queue (<%= queue %>)
-
-
-
- - -
-
Changeset
-
- - - -
Please select a revision and review the settings below before installing.
-
-
- <%= shed_tool_conf %> - <% if (current_metadata.has_repository_dependencies) { %> -
Repository dependencies for <%= current_changeset %>
-
-

- - -

- <% current_metadata.repository_dependency_template = repository_dependency_template; %> -
- - <%= repository_dependencies_template(current_metadata) %> -
-
- <% } %> - <% if (current_metadata.includes_tool_dependencies) { %> -
Tool dependencies
-
-

- - -

-

- - -

-
- - - - - - - - - - - <% _.each(tool_dependencies[current_changeset], function(dependency) { %> - - - - - - <% }); %> - -
NameVersionType
- <%= dependency.name %><%= dependency.version %><%= dependency.type %>
-
-
- <% } %> - <% if (current_metadata.includes_tools_for_display_in_tool_panel) { %> -
Tools – click the name to preview the tool and use the pop-up menu to inspect all metadata
-
-
- - - - - - - - - - <% _.each(current_metadata.tools, function(tool) { %> - - - - - - - <% }); %> - -
NameDescriptionVersion<%= tps_template_global_select({panel_section_dict: panel_section_dict, panel_section_options: panel_section_options}) %>
- - <%= tool.description %><%= tool.version %> - <%= tps_template_tool_select({tool: tool, panel_section_dict: panel_section_dict, panel_section_options: panel_section_options}) %> -
-
-
- <% } %> -
-
` - ); - }, - - templateRepoDependencies: function() { - return _.template( - `
Repository Dependencies
-
- -
` - ); - }, - - templateRepoDependency: function() { - return _.template( - `
  • - Repository <%= repository.name %> revision <%= changeset_revision %> owned by <%= repository.owner %> - <% if (has_repository_dependencies) { %> - - <% } %> -
  • ` - ); - }, - - templateShedToolConf: function() { - return _.template( - `
    Shed tool configuration file:
    -
    -
    - -
    Select the file whose tool_path setting you want used for installing repositories.
    -
    -
    ` - ); - }, - - // templateToolDependency: function(){ - // return _.template( - // `<% if (has_repository_dependencies) { %> - // <% _.each(repository_dependencies, function(dependency) { %> - // <% if (dependency.includes_tool_dependencies) { %> - // <% dependency.tool_dependency_template = tool_dependency_template %> - // <%= tool_dependency_template(dependency) %> - // <% } %> - // <% }); %> - // <% } %>` - // ); - // }, - - templateGlobalSectionCreate: function() { - return _.template( - `
    -
    - - -
    - Add a new tool panel section to contain the installed tools (optional). -
    -
    -
    ` - ); - }, - - templateGlobalSectionSelect: function() { - return _.template( - `
    -
    Tool Panel Section
    -
    -
    - - -
    - Select an existing tool panel section to contain the installed tools (optional). -
    -
    -
    -
    ` - ); - }, - - templateToolSectionCreate: function() { - return _.template( - `
    - - -
    ` - ); - }, - - templateToolSectionSelect: function() { - return _.template( - `
    - - -
    -
    ` - ); - }, - - templatePanelSelectOptions: function() { - return _.template( - `<% _.each(sections, function(section) { %> - - <% }); %>` - ); - } -}); - -export default { - RepoDetails: ToolShedRepositoryView -}; diff --git a/client/galaxy/scripts/mvc/toolshed/shed-list-view.js b/client/galaxy/scripts/mvc/toolshed/shed-list-view.js deleted file mode 100644 index e092ffae6f8..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/shed-list-view.js +++ /dev/null @@ -1,53 +0,0 @@ -import Backbone from "backbone"; -import $ from "jquery"; -import _ from "underscore"; -import _l from "utils/localization"; -import toolshed_model from "mvc/toolshed/toolshed-model"; -import toolshed_util from "mvc/toolshed/util"; - -var ShedListView = Backbone.View.extend({ - initialize: function(options) { - this.options = _.defaults(this.options || {}, this.defaults); - this.model = new toolshed_model.ShedsCollection(); - this.listenTo(this.model, "sync", this.render); - this.model.fetch(); - }, - - el: "#center", - - render: function(options) { - this.options = _.defaults(this.options || {}, options, this.defaults); - var toolshed_list_template = this.templateToolshedList(); - this.$el.html( - toolshed_list_template({ - title: _l("Configured Galaxy Tool Sheds"), - tool_sheds: this.model.models, - queue: toolshed_util.queueLength() - }) - ); - $("#center").css("overflow", "auto"); - }, - - templateToolshedList: function() { - return _.template( - `
    -
    -

    - ${_l("Configured Tool Sheds")} -

    - Repository Queue (<%= queue %>) -
    - - <% _.each(tool_sheds, function(shed) { %> -
    - '><%= shed.get('name') %> -
    - <% }); %> -
    ` - ); - } -}); - -export default { - ShedListView: ShedListView -}; diff --git a/client/galaxy/scripts/mvc/toolshed/toolshed-model.js b/client/galaxy/scripts/mvc/toolshed/toolshed-model.js deleted file mode 100644 index d13b742be18..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/toolshed-model.js +++ /dev/null @@ -1,106 +0,0 @@ -import _ from "underscore"; -import Backbone from "backbone"; -import { getAppRoot } from "onload/loadConfig"; - -var ToolShedModel = Backbone.Model.extend({ - defaults: { - url: "https://toolshed.g2.bx.psu.edu/", - name: "Galaxy Main Tool Shed" - }, - urlRoot: `${getAppRoot()}api/tool_shed` -}); - -var ToolShedsCollection = Backbone.Collection.extend({ - url: `${getAppRoot()}api/tool_shed`, - model: ToolShedModel -}); - -var ToolShedCategoriesModel = Backbone.Model.extend({ - defaults: [{}], - urlRoot: `${getAppRoot()}api/tool_shed/contents` -}); - -var ToolShedCategoriesCollection = Backbone.Collection.extend({ - url: `${getAppRoot()}api/tool_shed/contents`, - model: ToolShedCategoriesModel -}); - -var ToolShedCategoryModel = Backbone.Model.extend({ - defaults: [{}], - urlRoot: `${getAppRoot()}api/tool_shed/category` -}); - -var ToolShedCategoryCollection = Backbone.Collection.extend({ - url: `${getAppRoot()}api/tool_shed/category`, - model: ToolShedCategoryModel -}); - -var ToolShedRepositoryModel = Backbone.Model.extend({ - defaults: [{}], - urlRoot: `${getAppRoot()}api/tool_shed/repository` -}); - -var ToolShedRepositoryCollection = Backbone.Collection.extend({ - url: `${getAppRoot()}api/tool_shed/repository`, - model: ToolShedRepositoryModel -}); - -var RepoQueueModel = Backbone.Model.extend({ - url: "#" -}); - -var RepoQueueCollection = Backbone.Collection.extend({ - url: "#", - model: RepoQueueModel, - fetch: function() { - var repositories = Array(); - var repositories_enc; - if (window.localStorage.hasOwnProperty("repositories")) { - repositories_enc = JSON.parse(window.localStorage.repositories); - } else { - repositories_enc = []; - } - var queue_keys = Object.keys(repositories_enc); - _.each(queue_keys, key => { - var repo = repositories_enc[key]; - repo.queue_key = key; - repositories.push(repo); - }); - this.reset(repositories); - return Backbone.Collection.prototype.fetch.call(this); - } -}); - -var RepoStatusModel = Backbone.Model.extend({ - defaults: [{}], - urlRoot: `${getAppRoot()}api/tool_shed/status` -}); - -var RepoStatusCollection = Backbone.Collection.extend({ - url: `${getAppRoot()}api/tool_shed/status`, - model: RepoStatusModel -}); - -var WorkflowToolsModel = Backbone.Model.extend({ - defaults: [{}], - urlRoot: `${getAppRoot()}api/workflows?missing_tools=True` -}); - -var WorkflowToolsCollection = Backbone.Collection.extend({ - url: `${getAppRoot()}api/workflows?missing_tools=True`, - model: WorkflowToolsModel -}); - -export default { - ShedModel: ToolShedModel, - ShedsCollection: ToolShedsCollection, - Category: ToolShedCategoriesModel, - Categories: ToolShedCategoriesCollection, - CategoryModel: ToolShedCategoryModel, - CategoryCollection: ToolShedCategoryCollection, - RepositoryModel: ToolShedRepositoryModel, - RepositoryCollection: ToolShedRepositoryCollection, - RepoQueue: RepoQueueCollection, - RepoStatus: RepoStatusCollection, - WorkflowTools: WorkflowToolsCollection -}; diff --git a/client/galaxy/scripts/mvc/toolshed/util.js b/client/galaxy/scripts/mvc/toolshed/util.js deleted file mode 100644 index d11abbbf546..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/util.js +++ /dev/null @@ -1,65 +0,0 @@ -import $ from "jquery"; -import { getAppRoot } from "onload/loadConfig"; - -var searchShed = function(request, response) { - var shed_url = this.shed_url; - var base_url = `${getAppRoot()}api/tool_shed/search`; - $.get(base_url, { term: request.term, tool_shed_url: shed_url }, data => { - var result_list = this.shedParser(data); - response(result_list); - }); -}; - -var shedParser = jsondata => { - var results = []; - var hits = jsondata.hits; - $.each(hits, hit => { - var record = hits[hit]; - var label = `${record.repository.name} by ${record.repository.repo_owner_username}: ${ - record.repository.description - }`; - var result = { value: record.repository.id, label: label }; - results.push(result); - }); - return results; -}; - -var addToQueue = metadata => { - if (metadata.tool_shed_url.substr(-1) == "/") { - metadata.tool_shed_url = metadata.tool_shed_url.substr(0, metadata.tool_shed_url.length - 1); - } - var key = `${metadata.tool_shed_url}|${metadata.repository_id}|${metadata.changeset_revision}`; - var queued_repos = {}; - if (window.localStorage.repositories) { - queued_repos = JSON.parse(window.localStorage.repositories); - } - queued_repos[key] = metadata; - window.localStorage.repositories = JSON.stringify(queued_repos); -}; - -var queueLength = () => { - if (window.localStorage.hasOwnProperty("repositories")) { - var repo_queue = JSON.parse(window.localStorage.repositories); - return Object.keys(repo_queue).length; - } else { - return 0; - } -}; - -var toolByGuid = function(guid, changeset, tools) { - var returned_tool; - tools.forEach(function(tool) { - if (tool.guid == guid.value) { - returned_tool = tool; - } - }); - return returned_tool; -}; - -export default { - searchShed: searchShed, - shedParser: shedParser, - addToQueue: addToQueue, - queueLength: queueLength, - toolByGuid: toolByGuid -}; diff --git a/client/galaxy/scripts/mvc/toolshed/workflows-view.js b/client/galaxy/scripts/mvc/toolshed/workflows-view.js deleted file mode 100644 index e88192ce711..00000000000 --- a/client/galaxy/scripts/mvc/toolshed/workflows-view.js +++ /dev/null @@ -1,133 +0,0 @@ -import _ from "underscore"; -import $ from "jquery"; -import Backbone from "backbone"; -import { getAppRoot } from "onload/loadConfig"; -import _l from "utils/localization"; -import toolshed_model from "mvc/toolshed/toolshed-model"; -import toolshed_util from "mvc/toolshed/util"; - -var View = Backbone.View.extend({ - el: "#center", - - defaults: [{}], - - initialize: function(options) { - this.model = new toolshed_model.WorkflowTools(); - this.listenTo(this.model, "sync", this.render); - this.model.fetch(); - this.render(); - }, - - render: function(options) { - var workflows_missing_tools = this.templateWorkflows(); - var workflows = this.model.models; - this.$el.html( - workflows_missing_tools({ - title: _l("Workflows Missing Tools"), - workflows: workflows, - queue: toolshed_util.queueLength() - }) - ); - $("#center").css("overflow", "auto"); - this.bindEvents(); - }, - - bindEvents: function() { - var repository_id; - $(".show_wf_repo").on("click", ev => { - var tool_ids = $(ev.target).attr("data-toolids"); - var toolshed = $(ev.target).attr("data-shed"); - var api_url = `${getAppRoot()}api/tool_shed/repository`; - var params = { tool_ids: tool_ids }; - $.get(api_url, params, data => { - repository_id = data.repository.id; - var new_route = `repository/s/${toolshed.replace(/:/g, "%3a").replace(/\//g, "%2f")}/r/${ - data.repository.id - }`; - Backbone.history.navigate(new_route, { - trigger: true, - replace: true - }); - }); - }); - $(".queue_wf_repo").on("click", ev => { - var elem = $(ev.target); - var tool_ids = elem.attr("data-toolids"); - var toolshed = elem.attr("data-shed"); - var api_url = `${getAppRoot()}api/tool_shed/repository`; - var params = { tool_ids: tool_ids }; - $.get(api_url, params, data => { - repository_id = data.repository.id; - params = { - tool_shed_url: toolshed, - repository_id: repository_id - }; - $.get(api_url, params, data => { - var changesets = Object.keys(data.repository.metadata); - var current_changeset = changesets[0]; - var current_metadata = data.repository.metadata[current_changeset]; - current_metadata.tool_shed_url = toolshed; - toolshed_util.addToQueue(current_metadata); - elem.remove(); - }); - }); - }); - $("#from_workflow").on("click", this.loadWorkflows); - }, - - templateWorkflows: function() { - _.template( - ` - - - - - - - - - - - - - - <% _.each(workflows, function(workflow) { %> - - - - - - - - - <% }); %> - - ` - ); - } -}); - -export default { - Workflows: View -}; diff --git a/client/galaxy/scripts/mvc/workflow/workflow-canvas.js b/client/galaxy/scripts/mvc/workflow/workflow-canvas.js index 2f529d124d2..9ea70d5e101 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-canvas.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-canvas.js @@ -74,7 +74,7 @@ class ScrollPanel { } // Zoom levels to use for zooming the workflow canvas -const zoomLevels = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4]; +const zoomLevels = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.33, 1.5, 2, 2.5, 3, 4]; // Default zoome level (1) const defaultZoomLevel = 7; @@ -97,7 +97,7 @@ class CanvasManager { this.init_copy_paste(); } setZoom(zoomLevel) { - this.zoomLevel = Math.min(Math.max(0, zoomLevel), zoomLevels.length); + this.zoomLevel = Math.min(Math.max(0, zoomLevel), zoomLevels.length-1); this.canvasZoom = zoomLevels[this.zoomLevel]; // Set CSS transform to appropriate zoom level this.cv.css("transform-origin", "top left"); @@ -109,16 +109,33 @@ class CanvasManager { this.app.workflow.fit_canvas_to_nodes(); } initZoomControls() { - var zoomControl = $('
    ').css({ + var zoomControl = $('
    ').css({ position: "absolute", left: "1rem", - bottom: "1rem" + bottom: "1rem", + cursor: "pointer" }); + const zoomButton = $(`${zoomLevels[defaultZoomLevel] * 100}%`).css({ + width: "4rem" + }); + zoomControl.append( - $('
    ').click(() => this.setZoom(this.zoomLevel + 1)) + $('').click(() => { + this.setZoom(this.zoomLevel - 1); + zoomButton.text(Math.floor(zoomLevels[this.zoomLevel] * 100) + '%'); + }) ); zoomControl.append( - $('
    ').click(() => this.setZoom(this.zoomLevel - 1)) + zoomButton.click(() => { + this.setZoom(defaultZoomLevel); + zoomButton.text(Math.floor(zoomLevels[this.zoomLevel] * 100) + '%'); + }) + ); + zoomControl.append( + $('').click(() => { + this.setZoom(this.zoomLevel + 1); + zoomButton.text(Math.floor(zoomLevels[this.zoomLevel] * 100) + '%'); + }) ); this.cv.closest("#workflow-canvas-body").append(zoomControl); } diff --git a/client/galaxy/style/scss/base.scss b/client/galaxy/style/scss/base.scss index 2e2cb4c6ede..de554e1ae58 100644 --- a/client/galaxy/style/scss/base.scss +++ b/client/galaxy/style/scss/base.scss @@ -1429,7 +1429,7 @@ div.permissionContainer { .toolMenuContainer { color: $panel-text-color; a { - color: $panel-text-color; + color: $panel-text-color; } background: $panel-bg-color; min-height: 100%; @@ -1438,9 +1438,6 @@ div.permissionContainer { div.toolSectionTitle { font-weight: 500; font-size: $h4-font-size; - &:hover { - background: darken($panel-bg-color, 5%); - } } div.toolPanelLabel { @@ -1457,28 +1454,26 @@ div.toolSectionTitle, div.toolTitle, div.toolTitleNoSection { .labels { float: right; } - a { - @extend .px-3; - @extend .py-1; - text-decoration: none; - display: block; - &:hover { + @extend .px-3; + @extend .py-1; + text-decoration: none; + display: block; + &:hover { background: darken($panel-bg-color, 5%); - } + } } - &.text-muted a { - &:hover { - background: inherit; - } + &:hover { + background: inherit; + } } } div.toolSectionWrapper { - div.toolTitle a, div.toolPanelLabel { - @extend .pl-4; - font-size: inherit; + div.toolTitle a { + @extend .pl-4; + font-size: inherit; } } diff --git a/display_applications/icn3d/icn3d_simple.xml b/display_applications/icn3d/icn3d_simple.xml new file mode 100644 index 00000000000..25e182be0fd --- /dev/null +++ b/display_applications/icn3d/icn3d_simple.xml @@ -0,0 +1,7 @@ + + + + ${ url % { 'icn3d_file_type': $icn3d_file.ext, 'icn3d_file_url_qp': $icn3d_file.qp } } + + + diff --git a/doc/source/admin/apache.md b/doc/source/admin/apache.md index 9e32e2d4613..57969815d97 100644 --- a/doc/source/admin/apache.md +++ b/doc/source/admin/apache.md @@ -228,7 +228,7 @@ previous section: ```yaml uwsgi: #... - socket: unix:///srv/galaxy/var/uwsgi.sock + socket: /srv/galaxy/var/uwsgi.sock mount: /galaxy=galaxy.webapps.galaxy.buildapp:uwsgi_app() manage-script-name: true # `module` MUST NOT be set when `mount` is in use diff --git a/doc/source/admin/nginx.md b/doc/source/admin/nginx.md index 488c9ce0a08..f73f98a9f67 100644 --- a/doc/source/admin/nginx.md +++ b/doc/source/admin/nginx.md @@ -220,7 +220,7 @@ previous section: ```yaml uwsgi: #... - socket: unix:///srv/galaxy/var/uwsgi.sock + socket: /srv/galaxy/var/uwsgi.sock mount: /galaxy=galaxy.webapps.galaxy.buildapp:uwsgi_app() manage-script-name: true # `module` MUST NOT be set when `mount` is in use diff --git a/doc/source/lib/galaxy.config.rst b/doc/source/lib/galaxy.config.rst new file mode 100644 index 00000000000..30d5b67c3ee --- /dev/null +++ b/doc/source/lib/galaxy.config.rst @@ -0,0 +1,20 @@ +galaxy.config package +===================== + +.. automodule:: galaxy.config + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +galaxy.config.script module +--------------------------- + +.. automodule:: galaxy.config.script + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/galaxy.datatypes.util.rst b/doc/source/lib/galaxy.datatypes.util.rst index 8ac6f2c599d..9812c396a99 100644 --- a/doc/source/lib/galaxy.datatypes.util.rst +++ b/doc/source/lib/galaxy.datatypes.util.rst @@ -25,4 +25,12 @@ galaxy.datatypes.util.gff\_util module :undoc-members: :show-inheritance: +galaxy.datatypes.util.maf\_utilities module +------------------------------------------- + +.. automodule:: galaxy.datatypes.util.maf_utilities + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/lib/galaxy.rst b/doc/source/lib/galaxy.rst index 321bfcfcd7c..4c2425c5326 100644 --- a/doc/source/lib/galaxy.rst +++ b/doc/source/lib/galaxy.rst @@ -14,6 +14,7 @@ Subpackages galaxy.actions galaxy.auth galaxy.authnz + galaxy.config galaxy.containers galaxy.datatypes galaxy.dependencies @@ -30,6 +31,7 @@ Subpackages galaxy.openid galaxy.quota galaxy.security + galaxy.selenium galaxy.tool_util galaxy.tools galaxy.tours @@ -53,10 +55,10 @@ galaxy.app module :undoc-members: :show-inheritance: -galaxy.config module --------------------- +galaxy.config\_watchers module +------------------------------ -.. automodule:: galaxy.config +.. automodule:: galaxy.config_watchers :members: :undoc-members: :show-inheritance: diff --git a/doc/source/lib/galaxy.selenium.rst b/doc/source/lib/galaxy.selenium.rst new file mode 100644 index 00000000000..db4f0adfa64 --- /dev/null +++ b/doc/source/lib/galaxy.selenium.rst @@ -0,0 +1,83 @@ +galaxy.selenium package +======================= + +.. automodule:: galaxy.selenium + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + + galaxy.selenium.scripts + +Submodules +---------- + +galaxy.selenium.cli module +-------------------------- + +.. automodule:: galaxy.selenium.cli + :members: + :undoc-members: + :show-inheritance: + +galaxy.selenium.components module +--------------------------------- + +.. automodule:: galaxy.selenium.components + :members: + :undoc-members: + :show-inheritance: + +galaxy.selenium.data module +--------------------------- + +.. automodule:: galaxy.selenium.data + :members: + :undoc-members: + :show-inheritance: + +galaxy.selenium.driver\_factory module +-------------------------------------- + +.. automodule:: galaxy.selenium.driver_factory + :members: + :undoc-members: + :show-inheritance: + +galaxy.selenium.has\_driver module +---------------------------------- + +.. automodule:: galaxy.selenium.has_driver + :members: + :undoc-members: + :show-inheritance: + +galaxy.selenium.navigates\_galaxy module +---------------------------------------- + +.. automodule:: galaxy.selenium.navigates_galaxy + :members: + :undoc-members: + :show-inheritance: + +galaxy.selenium.sizzle module +----------------------------- + +.. automodule:: galaxy.selenium.sizzle + :members: + :undoc-members: + :show-inheritance: + +galaxy.selenium.smart\_components module +---------------------------------------- + +.. automodule:: galaxy.selenium.smart_components + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/galaxy.selenium.scripts.rst b/doc/source/lib/galaxy.selenium.scripts.rst new file mode 100644 index 00000000000..9b1ca62862e --- /dev/null +++ b/doc/source/lib/galaxy.selenium.scripts.rst @@ -0,0 +1,20 @@ +galaxy.selenium.scripts package +=============================== + +.. automodule:: galaxy.selenium.scripts + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +galaxy.selenium.scripts.dump\_tour module +----------------------------------------- + +.. automodule:: galaxy.selenium.scripts.dump_tour + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/galaxy.tool_util.linters.rst b/doc/source/lib/galaxy.tool_util.linters.rst new file mode 100644 index 00000000000..e87307309f8 --- /dev/null +++ b/doc/source/lib/galaxy.tool_util.linters.rst @@ -0,0 +1,92 @@ +galaxy.tool\_util.linters package +================================= + +.. automodule:: galaxy.tool_util.linters + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +galaxy.tool\_util.linters.citations module +------------------------------------------ + +.. automodule:: galaxy.tool_util.linters.citations + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.command module +---------------------------------------- + +.. automodule:: galaxy.tool_util.linters.command + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.cwl module +------------------------------------ + +.. automodule:: galaxy.tool_util.linters.cwl + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.general module +---------------------------------------- + +.. automodule:: galaxy.tool_util.linters.general + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.help module +------------------------------------- + +.. automodule:: galaxy.tool_util.linters.help + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.inputs module +--------------------------------------- + +.. automodule:: galaxy.tool_util.linters.inputs + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.outputs module +---------------------------------------- + +.. automodule:: galaxy.tool_util.linters.outputs + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.stdio module +-------------------------------------- + +.. automodule:: galaxy.tool_util.linters.stdio + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.tests module +-------------------------------------- + +.. automodule:: galaxy.tool_util.linters.tests + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.linters.xml\_order module +------------------------------------------- + +.. automodule:: galaxy.tool_util.linters.xml_order + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/galaxy.tool_util.rst b/doc/source/lib/galaxy.tool_util.rst index 02818574534..f09d5aa37f5 100644 --- a/doc/source/lib/galaxy.tool_util.rst +++ b/doc/source/lib/galaxy.tool_util.rst @@ -13,8 +13,10 @@ Subpackages galaxy.tool_util.cwl galaxy.tool_util.deps + galaxy.tool_util.linters galaxy.tool_util.locations galaxy.tool_util.parser + galaxy.tool_util.verify Submodules ---------- @@ -27,6 +29,14 @@ galaxy.tool\_util.fetcher module :undoc-members: :show-inheritance: +galaxy.tool\_util.lint module +----------------------------- + +.. automodule:: galaxy.tool_util.lint + :members: + :undoc-members: + :show-inheritance: + galaxy.tool\_util.loader module ------------------------------- diff --git a/doc/source/lib/galaxy.tool_util.verify.asserts.rst b/doc/source/lib/galaxy.tool_util.verify.asserts.rst new file mode 100644 index 00000000000..b252cd0806c --- /dev/null +++ b/doc/source/lib/galaxy.tool_util.verify.asserts.rst @@ -0,0 +1,52 @@ +galaxy.tool\_util.verify.asserts package +======================================== + +.. automodule:: galaxy.tool_util.verify.asserts + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +galaxy.tool\_util.verify.asserts.archive module +----------------------------------------------- + +.. automodule:: galaxy.tool_util.verify.asserts.archive + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.verify.asserts.hdf5 module +-------------------------------------------- + +.. automodule:: galaxy.tool_util.verify.asserts.hdf5 + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.verify.asserts.tabular module +----------------------------------------------- + +.. automodule:: galaxy.tool_util.verify.asserts.tabular + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.verify.asserts.text module +-------------------------------------------- + +.. automodule:: galaxy.tool_util.verify.asserts.text + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.verify.asserts.xml module +------------------------------------------- + +.. automodule:: galaxy.tool_util.verify.asserts.xml + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/galaxy.tool_util.verify.rst b/doc/source/lib/galaxy.tool_util.verify.rst new file mode 100644 index 00000000000..99469adf02d --- /dev/null +++ b/doc/source/lib/galaxy.tool_util.verify.rst @@ -0,0 +1,43 @@ +galaxy.tool\_util.verify package +================================ + +.. automodule:: galaxy.tool_util.verify + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + + galaxy.tool_util.verify.asserts + +Submodules +---------- + +galaxy.tool\_util.verify.interactor module +------------------------------------------ + +.. automodule:: galaxy.tool_util.verify.interactor + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.verify.script module +-------------------------------------- + +.. automodule:: galaxy.tool_util.verify.script + :members: + :undoc-members: + :show-inheritance: + +galaxy.tool\_util.verify.test\_data module +------------------------------------------ + +.. automodule:: galaxy.tool_util.verify.test_data + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/galaxy.tools.linters.rst b/doc/source/lib/galaxy.tools.linters.rst deleted file mode 100644 index f79ce27f18b..00000000000 --- a/doc/source/lib/galaxy.tools.linters.rst +++ /dev/null @@ -1,92 +0,0 @@ -galaxy.tools.linters package -============================ - -.. automodule:: galaxy.tools.linters - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -galaxy.tools.linters.citations module -------------------------------------- - -.. automodule:: galaxy.tools.linters.citations - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.command module ------------------------------------ - -.. automodule:: galaxy.tools.linters.command - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.cwl module -------------------------------- - -.. automodule:: galaxy.tools.linters.cwl - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.general module ------------------------------------ - -.. automodule:: galaxy.tools.linters.general - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.help module --------------------------------- - -.. automodule:: galaxy.tools.linters.help - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.inputs module ----------------------------------- - -.. automodule:: galaxy.tools.linters.inputs - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.outputs module ------------------------------------ - -.. automodule:: galaxy.tools.linters.outputs - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.stdio module ---------------------------------- - -.. automodule:: galaxy.tools.linters.stdio - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.tests module ---------------------------------- - -.. automodule:: galaxy.tools.linters.tests - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.linters.xml\_order module --------------------------------------- - -.. automodule:: galaxy.tools.linters.xml_order - :members: - :undoc-members: - :show-inheritance: - - diff --git a/doc/source/lib/galaxy.tools.rst b/doc/source/lib/galaxy.tools.rst index e544594648a..ad6b25686dc 100644 --- a/doc/source/lib/galaxy.tools.rst +++ b/doc/source/lib/galaxy.tools.rst @@ -18,12 +18,10 @@ Subpackages galaxy.tools.expressions galaxy.tools.filters galaxy.tools.imp_exp - galaxy.tools.linters galaxy.tools.parameters galaxy.tools.search galaxy.tools.toolbox galaxy.tools.util - galaxy.tools.verify Submodules ---------- @@ -76,22 +74,6 @@ galaxy.tools.execute module :undoc-members: :show-inheritance: -galaxy.tools.lint module ------------------------- - -.. automodule:: galaxy.tools.lint - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.lint\_util module ------------------------------- - -.. automodule:: galaxy.tools.lint_util - :members: - :undoc-members: - :show-inheritance: - galaxy.tools.repositories module -------------------------------- diff --git a/doc/source/lib/galaxy.tools.verify.asserts.rst b/doc/source/lib/galaxy.tools.verify.asserts.rst deleted file mode 100644 index 66b69426efb..00000000000 --- a/doc/source/lib/galaxy.tools.verify.asserts.rst +++ /dev/null @@ -1,52 +0,0 @@ -galaxy.tools.verify.asserts package -=================================== - -.. automodule:: galaxy.tools.verify.asserts - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -galaxy.tools.verify.asserts.archive module ------------------------------------------- - -.. automodule:: galaxy.tools.verify.asserts.archive - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.verify.asserts.hdf5 module ---------------------------------------- - -.. automodule:: galaxy.tools.verify.asserts.hdf5 - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.verify.asserts.tabular module ------------------------------------------- - -.. automodule:: galaxy.tools.verify.asserts.tabular - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.verify.asserts.text module ---------------------------------------- - -.. automodule:: galaxy.tools.verify.asserts.text - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.verify.asserts.xml module --------------------------------------- - -.. automodule:: galaxy.tools.verify.asserts.xml - :members: - :undoc-members: - :show-inheritance: - - diff --git a/doc/source/lib/galaxy.tools.verify.rst b/doc/source/lib/galaxy.tools.verify.rst deleted file mode 100644 index 4daf18a03de..00000000000 --- a/doc/source/lib/galaxy.tools.verify.rst +++ /dev/null @@ -1,43 +0,0 @@ -galaxy.tools.verify package -=========================== - -.. automodule:: galaxy.tools.verify - :members: - :undoc-members: - :show-inheritance: - -Subpackages ------------ - -.. toctree:: - - galaxy.tools.verify.asserts - -Submodules ----------- - -galaxy.tools.verify.interactor module -------------------------------------- - -.. automodule:: galaxy.tools.verify.interactor - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.verify.script module ---------------------------------- - -.. automodule:: galaxy.tools.verify.script - :members: - :undoc-members: - :show-inheritance: - -galaxy.tools.verify.test\_data module -------------------------------------- - -.. automodule:: galaxy.tools.verify.test_data - :members: - :undoc-members: - :show-inheritance: - - diff --git a/doc/source/lib/galaxy.util.rst b/doc/source/lib/galaxy.util.rst index 792c0dfabb9..06cfeee6814 100644 --- a/doc/source/lib/galaxy.util.rst +++ b/doc/source/lib/galaxy.util.rst @@ -14,6 +14,7 @@ Subpackages galaxy.util.logging galaxy.util.pastescript galaxy.util.path + galaxy.util.tool_shed Submodules ---------- diff --git a/doc/source/lib/galaxy.util.tool_shed.rst b/doc/source/lib/galaxy.util.tool_shed.rst new file mode 100644 index 00000000000..42b92b9bc7e --- /dev/null +++ b/doc/source/lib/galaxy.util.tool_shed.rst @@ -0,0 +1,36 @@ +galaxy.util.tool\_shed package +============================== + +.. automodule:: galaxy.util.tool_shed + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +galaxy.util.tool\_shed.common\_util module +------------------------------------------ + +.. automodule:: galaxy.util.tool_shed.common_util + :members: + :undoc-members: + :show-inheritance: + +galaxy.util.tool\_shed.encoding\_util module +-------------------------------------------- + +.. automodule:: galaxy.util.tool_shed.encoding_util + :members: + :undoc-members: + :show-inheritance: + +galaxy.util.tool\_shed.xml\_util module +--------------------------------------- + +.. automodule:: galaxy.util.tool_shed.xml_util + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/galaxy.web.base.rst b/doc/source/lib/galaxy.web.base.rst deleted file mode 100644 index f81bd29947a..00000000000 --- a/doc/source/lib/galaxy.web.base.rst +++ /dev/null @@ -1,20 +0,0 @@ -galaxy.web.base package -======================= - -.. automodule:: galaxy.web.base - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -galaxy.web.base.controller module ---------------------------------- - -.. automodule:: galaxy.web.base.controller - :members: - :undoc-members: - :show-inheritance: - - diff --git a/doc/source/lib/galaxy.web.rst b/doc/source/lib/galaxy.web.rst index dc3fd75cfd6..8bf2e29cc68 100644 --- a/doc/source/lib/galaxy.web.rst +++ b/doc/source/lib/galaxy.web.rst @@ -11,7 +11,6 @@ Subpackages .. toctree:: - galaxy.web.base galaxy.web.framework galaxy.web.proxy diff --git a/doc/source/lib/galaxy.webapps.base.rst b/doc/source/lib/galaxy.webapps.base.rst new file mode 100644 index 00000000000..57a5db43038 --- /dev/null +++ b/doc/source/lib/galaxy.webapps.base.rst @@ -0,0 +1,20 @@ +galaxy.webapps.base package +=========================== + +.. automodule:: galaxy.webapps.base + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +galaxy.webapps.base.controller module +------------------------------------- + +.. automodule:: galaxy.webapps.base.controller + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/galaxy.webapps.galaxy.rst b/doc/source/lib/galaxy.webapps.galaxy.rst index f5e0f2027ef..5256155b1ed 100644 --- a/doc/source/lib/galaxy.webapps.galaxy.rst +++ b/doc/source/lib/galaxy.webapps.galaxy.rst @@ -25,12 +25,4 @@ galaxy.webapps.galaxy.buildapp module :undoc-members: :show-inheritance: -galaxy.webapps.galaxy.config\_watchers module ---------------------------------------------- - -.. automodule:: galaxy.webapps.galaxy.config_watchers - :members: - :undoc-members: - :show-inheritance: - diff --git a/doc/source/lib/galaxy.webapps.rst b/doc/source/lib/galaxy.webapps.rst index 0ca4f9f0d3a..bcf4c1e750f 100644 --- a/doc/source/lib/galaxy.webapps.rst +++ b/doc/source/lib/galaxy.webapps.rst @@ -11,6 +11,7 @@ Subpackages .. toctree:: + galaxy.webapps.base galaxy.webapps.galaxy galaxy.webapps.reports galaxy.webapps.tool_shed diff --git a/doc/source/lib/galaxy.webapps.tool_shed.model.migrate.rst b/doc/source/lib/galaxy.webapps.tool_shed.model.migrate.rst index 3faeb2ab908..90e8d042ed1 100644 --- a/doc/source/lib/galaxy.webapps.tool_shed.model.migrate.rst +++ b/doc/source/lib/galaxy.webapps.tool_shed.model.migrate.rst @@ -6,6 +6,13 @@ galaxy.webapps.tool\_shed.model.migrate package :undoc-members: :show-inheritance: +Subpackages +----------- + +.. toctree:: + + galaxy.webapps.tool_shed.model.migrate.versions + Submodules ---------- diff --git a/doc/source/lib/galaxy.webapps.tool_shed.model.migrate.versions.rst b/doc/source/lib/galaxy.webapps.tool_shed.model.migrate.versions.rst new file mode 100644 index 00000000000..dd416885749 --- /dev/null +++ b/doc/source/lib/galaxy.webapps.tool_shed.model.migrate.versions.rst @@ -0,0 +1,220 @@ +galaxy.webapps.tool\_shed.model.migrate.versions package +======================================================== + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +galaxy.webapps.tool\_shed.model.migrate.versions.0001\_initial\_tables module +----------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0001_initial_tables + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0002\_add\_tool\_suite\_column module +-------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0002_add_tool_suite_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0003\_review\_and\_review\_association\_tables module +------------------------------------------------------------------------------------------------------ + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0003_review_and_review_association_tables + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0004\_repository\_tables module +-------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0004_repository_tables + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0005\_drop\_tool\_related\_tables module +----------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0005_drop_tool_related_tables + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0006\_add\_email\_alerts\_column module +---------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0006_add_email_alerts_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0007\_add\_long\_description\_times\_downloaded\_columns module +---------------------------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0007_add_long_description_times_downloaded_columns + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0008\_add\_repository\_metadata\_table module +---------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0008_add_repository_metadata_table + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0009\_add\_malicious\_column module +------------------------------------------------------------------------------------ + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0009_add_malicious_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0010\_add\_new\_repo\_alert\_column module +------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0010_add_new_repo_alert_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0011\_add\_tool\_versions\_column module +----------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0011_add_tool_versions_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0012\_add\_downloadable\_column module +--------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0012_add_downloadable_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0013\_add\_review\_tables module +--------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0013_add_review_tables + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0014\_add\_deprecated\_column module +------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0014_add_deprecated_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0015\_add\_api\_keys\_table module +----------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0015_add_api_keys_table + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0016\_add\_do\_not\_test\_tools\_functionally\_correct\_errors\_columns module +------------------------------------------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0016_add_do_not_test_tools_functionally_correct_errors_columns + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0017\_add\_galaxy\_utility\_columns\_to\_repository\_metadata\_table module +---------------------------------------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0017_add_galaxy_utility_columns_to_repository_metadata_table + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0018\_add\_repository\_metadata\_flag\_columns module +------------------------------------------------------------------------------------------------------ + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0018_add_repository_metadata_flag_columns + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0019\_add\_skip\_tool\_test\_table\_and\_test\_install\_error\_column module +----------------------------------------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0019_add_skip_tool_test_table_and_test_install_error_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0020\_add\_repository\_type\_column module +------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0020_add_repository_type_column + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0021\_change\_repository\_type\_value module +--------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0021_change_repository_type_value + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0022\_add\_repository\_admin\_roles module +------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0022_add_repository_admin_roles + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0023\_add\_repository\_url\_and\_hompeage\_url module +------------------------------------------------------------------------------------------------------ + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0023_add_repository_url_and_hompeage_url + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0024\_password\_reset module +----------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0024_password_reset + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0025\_session\_timeout module +------------------------------------------------------------------------------ + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0025_session_timeout + :members: + :undoc-members: + :show-inheritance: + +galaxy.webapps.tool\_shed.model.migrate.versions.0026\_add\_numeric\_revision\_column module +-------------------------------------------------------------------------------------------- + +.. automodule:: galaxy.webapps.tool_shed.model.migrate.versions.0026_add_numeric_revision_column + :members: + :undoc-members: + :show-inheritance: + + diff --git a/doc/source/lib/tool_shed.galaxy_install.migrate.rst b/doc/source/lib/tool_shed.galaxy_install.migrate.rst index 12d29998abc..578387dfd5f 100644 --- a/doc/source/lib/tool_shed.galaxy_install.migrate.rst +++ b/doc/source/lib/tool_shed.galaxy_install.migrate.rst @@ -6,6 +6,13 @@ tool\_shed.galaxy\_install.migrate package :undoc-members: :show-inheritance: +Subpackages +----------- + +.. toctree:: + + tool_shed.galaxy_install.migrate.versions + Submodules ---------- diff --git a/doc/source/lib/tool_shed.galaxy_install.migrate.versions.rst b/doc/source/lib/tool_shed.galaxy_install.migrate.versions.rst new file mode 100644 index 00000000000..f1db6f74f58 --- /dev/null +++ b/doc/source/lib/tool_shed.galaxy_install.migrate.versions.rst @@ -0,0 +1,108 @@ +tool\_shed.galaxy\_install.migrate.versions package +=================================================== + +.. automodule:: tool_shed.galaxy_install.migrate.versions + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +tool\_shed.galaxy\_install.migrate.versions.0001\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0001_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0002\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0002_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0003\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0003_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0004\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0004_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0005\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0005_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0006\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0006_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0007\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0007_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0008\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0008_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0009\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0009_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0010\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0010_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0011\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0011_tools + :members: + :undoc-members: + :show-inheritance: + +tool\_shed.galaxy\_install.migrate.versions.0012\_tools module +-------------------------------------------------------------- + +.. automodule:: tool_shed.galaxy_install.migrate.versions.0012_tools + :members: + :undoc-members: + :show-inheritance: + + diff --git a/lib/galaxy/app.py b/lib/galaxy/app.py index ce95e3f1d92..e08f698e6b2 100644 --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -23,6 +23,7 @@ from galaxy.model.database_heartbeat import DatabaseHeartbeat from galaxy.model.tags import GalaxyTagHandler from galaxy.queue_worker import GalaxyQueueWorker from galaxy.tool_util.deps.views import DependencyResolversView +from galaxy.tool_util.verify import test_data from galaxy.tools.cache import ( ToolCache, ToolShedRepositoryCache @@ -30,7 +31,6 @@ from galaxy.tools.cache import ( from galaxy.tools.data_manager.manager import DataManagers from galaxy.tools.error_reports import ErrorReports from galaxy.tools.special_tools import load_lib_tools -from galaxy.tools.verify import test_data from galaxy.tours import ToursRegistry from galaxy.util import ( ExecutionTimer, @@ -184,7 +184,9 @@ class UniverseApplication(config.ConfiguresGalaxyMixin): if self.config.enable_oidc: from galaxy.authnz import managers - self.authnz_manager = managers.AuthnzManager(self, self.config.oidc_config, self.config.oidc_backends_config) + self.authnz_manager = managers.AuthnzManager(self, + self.config.oidc_config, + self.config.oidc_backends_config) self.sentry_client = None if self.config.sentry_dsn: diff --git a/lib/galaxy/authnz/managers.py b/lib/galaxy/authnz/managers.py index be5e2269730..4f6cefeb29f 100644 --- a/lib/galaxy/authnz/managers.py +++ b/lib/galaxy/authnz/managers.py @@ -304,10 +304,14 @@ class AuthnzManager(object): ca = CloudAuthz() log.info("Requesting credentials using CloudAuthz with config id `{}` on be half of user `{}`.".format( cloudauthz.id, user_id)) - return ca.authorize(cloudauthz.provider, config) + credentials = ca.authorize(cloudauthz.provider, config) + return credentials except CloudAuthzBaseException as e: log.info(e) raise exceptions.AuthenticationFailed(e) + except NotImplementedError as e: + log.info(e) + raise exceptions.RequestParameterInvalidException(e) def get_cloud_access_credentials_in_file(self, new_file_path, cloudauthz, sa_session, user_id, request=None): """ diff --git a/lib/galaxy/config/__init__.py b/lib/galaxy/config/__init__.py index 851e657a00f..f5ba320ff6c 100644 --- a/lib/galaxy/config/__init__.py +++ b/lib/galaxy/config/__init__.py @@ -100,7 +100,7 @@ def resolve_path(path, root): def find_root(kwargs): - root = kwargs.get('root_dir', '.') + root = os.path.abspath(kwargs.get('root_dir', '.')) return root @@ -556,9 +556,10 @@ class GalaxyAppConfiguration(BaseAppConfiguration): involucro_path = kwargs.get('involucro_path', None) if involucro_path is None: - target_dir = resolve_path(kwargs.get("tool_dependency_dir", "dependencies"), self.data_dir) + target_dir = kwargs.get("tool_dependency_dir", "dependencies") if target_dir == "none": - target_dir = "database" + target_dir = "dependencies" + target_dir = resolve_path(target_dir, self.data_dir) involucro_path = os.path.join(target_dir, "involucro") self.involucro_path = resolve_path(involucro_path, self.root) self.involucro_auto_init = string_as_bool(kwargs.get('involucro_auto_init', True)) diff --git a/lib/galaxy/config/sample/datatypes_conf.xml.sample b/lib/galaxy/config/sample/datatypes_conf.xml.sample index 3613a6ee58c..8293795508a 100644 --- a/lib/galaxy/config/sample/datatypes_conf.xml.sample +++ b/lib/galaxy/config/sample/datatypes_conf.xml.sample @@ -593,6 +593,7 @@ + @@ -613,6 +614,7 @@ + @@ -624,7 +626,9 @@ - + + + diff --git a/lib/galaxy/config/sample/job_conf.xml.sample_advanced b/lib/galaxy/config/sample/job_conf.xml.sample_advanced index 471946d0e3a..ebb74e9514d 100644 --- a/lib/galaxy/config/sample/job_conf.xml.sample_advanced +++ b/lib/galaxy/config/sample/job_conf.xml.sample_advanced @@ -216,6 +216,11 @@ zero (no execution) and the stderr/stdout of the k8s job is reported in galaxy (and the galaxy job set to failed) --> + + + +
    WorkflowsTool IDsShedNameOwnerActions
    -
      - <% _.each(workflow.get("workflows"), function(name) { %> -
    • <%= name %>
    • - <% }); %> -
    -
    -
      - <% _.each(workflow.get("tools"), function(tool) { %> -
    • <%= tool %>
    • - <% }); %> -
    -
    <%= workflow.get("shed") %><%= workflow.get("repository") %><%= workflow.get("owner") %> -
      -
    • - " data-owner="<%= workflow.get("owner") %>" data-repo="<%= workflow.get("repository") %>" data-toolids="<%= workflow.get("tools").join(",") %>" value="Show Repository" />
    • -
    -
    + value, name, url + +
    diff --git a/lib/galaxy/datatypes/sequence.py b/lib/galaxy/datatypes/sequence.py index ffa11e25a2f..28fbe4754be 100644 --- a/lib/galaxy/datatypes/sequence.py +++ b/lib/galaxy/datatypes/sequence.py @@ -694,13 +694,16 @@ class BaseFastq(Sequence): >>> fname = get_test_fname('1.fastqsanger') >>> FastqSanger().sniff(fname) True + >>> fname = get_test_fname('4.fastqsanger') + >>> FastqSanger().sniff(fname) + True >>> fname = get_test_fname('3.fastq') >>> FastqSanger().sniff(fname) False >>> Fastq().sniff(fname) True >>> fname = get_test_fname('2.fastq') - >>> Fastq().sniff( fname ) + >>> Fastq().sniff(fname) True >>> FastqSanger().sniff(fname) False @@ -819,7 +822,7 @@ class FastqSanger(Fastq): def quality_check(lines): """Presuming lines are lines from a fastq file, return True if the qualities are compatible with sanger encoding""" for line in islice(lines, 3, None, 4): - if not all(_ >= '!' and _ <= 'M' for _ in line[0]) or ' ' in line: + if not all(_ >= '!' and _ <= 'S' for _ in line[0]): return False return True diff --git a/lib/galaxy/datatypes/test/1.excel.xlsx b/lib/galaxy/datatypes/test/1.excel.xlsx new file mode 100644 index 00000000000..f7c85d3305d Binary files /dev/null and b/lib/galaxy/datatypes/test/1.excel.xlsx differ diff --git a/lib/galaxy/datatypes/test/4.fastqsanger b/lib/galaxy/datatypes/test/4.fastqsanger new file mode 100644 index 00000000000..ff60d92d068 --- /dev/null +++ b/lib/galaxy/datatypes/test/4.fastqsanger @@ -0,0 +1,8 @@ +@DCW97JN1:309:C0C42ACXX:4:2206:12976:57510/1 +AAATGGGCATAATATAGATGTAGAGATGTGTTGAATTTATGACTCATTT ++ +ADECJJJJDCCECCCCMCCNCCMCNBCLBJBCLADCDC=CNDJILEDDD +@DCW97JN1:309:C0C42ACXX:4:2211:6915:3569/1 +AAAGAAATTAAATGGGCATAATATAGATGTAGAGATGTGTTGAATTTAT ++ +@DEJAAA?B@ECCEFFGDBBFC8ABGCBK=BI=66@HE@@JACCCDCCI diff --git a/lib/galaxy/dependencies/pipfiles/default/Pipfile b/lib/galaxy/dependencies/pipfiles/default/Pipfile index 8980b46000a..6a802601d07 100644 --- a/lib/galaxy/dependencies/pipfiles/default/Pipfile +++ b/lib/galaxy/dependencies/pipfiles/default/Pipfile @@ -68,7 +68,7 @@ bioblend = "*" boto = "*" kombu = "*" psutil = "*" -pulsar-galaxy-lib = "*" +pulsar-galaxy-lib = "==0.12.1" sqlalchemy-migrate = "*" sqlparse = "*" svgwrite = "*" @@ -77,7 +77,7 @@ pyparsing = "*" paramiko = "*" python-genomespaceclient = "<2.0" social_auth_core = {version = "==3.1.0+gx0", extras = ['openidconnect']} -cloudauthz = "<=0.4.0" +cloudauthz = "==0.6.0" gxformat2 = "*" [requires] diff --git a/lib/galaxy/dependencies/pipfiles/default/pinned-dev-requirements.txt b/lib/galaxy/dependencies/pipfiles/default/pinned-dev-requirements.txt index bb14cf2fbde..79986eca757 100644 --- a/lib/galaxy/dependencies/pipfiles/default/pinned-dev-requirements.txt +++ b/lib/galaxy/dependencies/pipfiles/default/pinned-dev-requirements.txt @@ -38,11 +38,11 @@ pygithub3==0.5.1 ; python_version < '3' pygments==2.4.2 pyparsing==2.4.0 pytest-cov==2.7.1 -pytest-html==1.20.0 +pytest-html==1.21.1 pytest-metadata==1.8.0 pytest-postgresql==1.4.1 pytest-pythonpath==0.7.3 -pytest==4.6.3 +pytest==4.6.4 pytz==2019.1 pyyaml==5.1.1 recommonmark==0.5.0 @@ -50,14 +50,14 @@ requests==2.22.0 scandir==1.10.0 ; python_version < '3.5' selenium==3.141.0 six==1.11.0 -snowballstemmer==1.2.1 +snowballstemmer==1.9.0 sphinx-markdown-tables==0.0.9 sphinx-rtd-theme==0.4.3 sphinx==1.8.5 sphinxcontrib-websupport==1.1.2 -testfixtures==6.9.0 +testfixtures==6.10.0 twill==0.9.1 ; python_version < '3' -typing==3.6.6 ; python_version < '3.5' +typing==3.7.4 ; python_version < '3.5' urllib3==1.25.3 ; python_version == '2.7' watchdog==0.9.0 wcwidth==0.1.7 ; sys_platform != 'win32' diff --git a/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt b/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt index 8a4e6c136ad..8acabe3110f 100644 --- a/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt +++ b/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt @@ -21,7 +21,7 @@ azure-storage-common==1.4.2 azure-storage-nspkg==3.1.0 babel==2.7.0 bagit==1.6.4 -bcrypt==3.1.6 +bcrypt==3.1.7 bdbag==1.4.1 beaker==1.10.1 bioblend==0.12.0 @@ -29,8 +29,8 @@ bleach==3.1.0 boltons==19.1.0 boto3==1.9.114 boto==2.49.0 -botocore==1.12.169 -bx-python==0.8.2 +botocore==1.12.180 +bx-python==0.8.4 bz2file==0.98 ; python_version < '3.3' cachecontrol==0.11.7 cachetools==3.1.1 @@ -39,7 +39,7 @@ cffi==1.12.3 chardet==3.0.4 cheetah3==3.2.3 cliff==2.15.0 -cloudauthz==0.4.0 +cloudauthz==0.6.0 cloudbridge==2.0.0 cmd2==0.8.9 contextlib2==0.5.5 ; python_version < '3.5' @@ -64,7 +64,7 @@ galaxy-sequence-utils==1.1.3 google-api-python-client==1.7.8 google-auth-httplib2==0.0.3 google-auth==1.6.3 -gxformat2==0.8.3 +gxformat2==0.8.4 h5py==2.9.0 httplib2==0.13.0 idna==2.8 @@ -101,7 +101,7 @@ oauthlib==3.0.1 openstacksdk==0.17.0 os-client-config==1.32.0 os-service-types==1.7.0 -osc-lib==1.12.1 +osc-lib==1.13.0 oslo.config==6.10.0 oslo.context==2.22.1 oslo.i18n==3.23.1 @@ -109,13 +109,13 @@ oslo.log==3.44.0 oslo.serialization==2.29.1 oslo.utils==3.41.0 packaging==19.0 -paramiko==2.5.0 +paramiko==2.6.0 parsley==1.3 paste==3.0.8 pastedeploy==2.0.1 pastescript==3.1.0 pathlib2==2.3.2 ; python_version < '3' -pbr==5.3.0 +pbr==5.3.1 prettytable==0.7.2 prov==1.5.1 psutil==5.6.3 @@ -168,15 +168,15 @@ six==1.11.0 social-auth-core[openidconnect]==3.1.0+gx0 sqlalchemy-migrate==0.12.0 sqlalchemy-utils==0.34.0 -sqlalchemy==1.3.4 +sqlalchemy==1.3.5 sqlparse==0.3.0 stevedore==1.30.1 subprocess32==3.5.4 ; python_version < '3.0' -svgwrite==1.2.1 +svgwrite==1.3.1 tempita==0.5.2 tenacity==4.12.0 -typing-extensions==3.7.2 -typing==3.6.6 ; python_version < '3.5' +typing-extensions==3.7.4 +typing==3.7.4 ; python_version < '3.5' tzlocal==1.5.1 unicodecsv==0.14.1 ; python_version < '3.0' uritemplate==3.0.0 @@ -188,4 +188,4 @@ wcwidth==0.1.7 ; sys_platform != 'win32' webencodings==0.5.1 webob==1.8.5 whoosh==2.7.4 -wrapt==1.11.1 +wrapt==1.11.2 diff --git a/lib/galaxy/dependencies/pipfiles/flake8/pinned-requirements.txt b/lib/galaxy/dependencies/pipfiles/flake8/pinned-requirements.txt index b2aeef4d492..d3da4aaf062 100644 --- a/lib/galaxy/dependencies/pipfiles/flake8/pinned-requirements.txt +++ b/lib/galaxy/dependencies/pipfiles/flake8/pinned-requirements.txt @@ -8,4 +8,4 @@ functools32==3.2.3.post2 ; python_version < '3.2' mccabe==0.6.1 pycodestyle==2.5.0 pyflakes==2.1.1 -typing==3.6.6 ; python_version < '3.5' +typing==3.7.4 ; python_version < '3.5' diff --git a/lib/galaxy/jobs/runners/kubernetes.py b/lib/galaxy/jobs/runners/kubernetes.py index 1dba8c47281..b64113e4a14 100644 --- a/lib/galaxy/jobs/runners/kubernetes.py +++ b/lib/galaxy/jobs/runners/kubernetes.py @@ -58,7 +58,8 @@ class KubernetesJobRunner(AsynchronousJobRunner): k8s_default_limits_cpu=dict(map=str, default=None), k8s_default_limits_memory=dict(map=str, default=None), k8s_pod_retries=dict(map=int, valid=lambda x: int >= 0, default=3), - k8s_pod_retrials=dict(map=int, valid=lambda x: int >= 0, default=3)) + k8s_pod_retrials=dict(map=int, valid=lambda x: int >= 0, default=3), + k8s_walltime_limit=dict(map=int, valid=lambda x: int(x) >= 0, default=172800)) if 'runner_param_specs' not in kwargs: kwargs['runner_param_specs'] = dict() @@ -220,8 +221,10 @@ class KubernetesJobRunner(AsynchronousJobRunner): return produce_unique_k8s_job_name(app_prefix='galaxy', instance_id=instance_id, job_id=galaxy_internal_job_id) def __get_k8s_job_spec(self, ajs): - """Creates the k8s Job spec. For a Job spec, the only requirement is to have a .spec.template.""" - k8s_job_spec = {"template": self.__get_k8s_job_spec_template(ajs)} + """Creates the k8s Job spec. For a Job spec, the only requirement is to have a .spec.template. + If the job hangs around unlimited it will be ended after k8s wall time limit, which sets activeDeadlineSeconds""" + k8s_job_spec = {"template": self.__get_k8s_job_spec_template(ajs), + "activeDeadlineSeconds": int(self.runner_params['k8s_walltime_limit'])} return k8s_job_spec def __get_k8s_job_spec_template(self, ajs): @@ -427,23 +430,18 @@ class KubernetesJobRunner(AsynchronousJobRunner): job_state.running = False self.mark_as_finished(job_state) return None - elif failed > 0 and self.__job_failed_due_to_low_memory(job_state): - return self._handle_job_failure(job, job_state, reason="OOM") elif active > 0 and failed <= max_pod_retries: if not job_state.running: job_state.running = True job_state.job_wrapper.change_state(model.Job.states.RUNNING) return job_state - elif failed > max_pod_retries: - return self._handle_job_failure(job, job_state) elif job_state.job_wrapper.get_job().state == model.Job.states.DELETED: # Job has been deleted via stop_job, cleanup and remove from watched_jobs by returning `None` if job_state.job_wrapper.cleanup_job in ("always", "onsuccess"): job_state.job_wrapper.cleanup() return None else: - # We really shouldn't reach this point, but we might if the job has been killed by the kubernetes admin - log.info("Kubernetes job '%s' not classified as succ., active or failed. Full Job object: \n%s", job.name, job.obj) + return self._handle_job_failure(job, job_state) elif len(jobs.response['items']) == 0: # there is no job responding to this job_id, it is either lost or something happened. @@ -460,12 +458,17 @@ class KubernetesJobRunner(AsynchronousJobRunner): self.mark_as_failed(job_state) return job_state - def _handle_job_failure(self, job, job_state, reason=None): + def _handle_job_failure(self, job, job_state): + # Figure out why job has failed with open(job_state.error_file, 'a') as error_file: - if reason == "OOM": + if self.__job_failed_due_to_low_memory(job_state): error_file.write("Job killed after running out of memory. Try with more memory.\n") job_state.fail_message = "Tool failed due to insufficient memory. Try with more memory." job_state.runner_state = JobState.runner_states.MEMORY_LIMIT_REACHED + elif self.__job_failed_due_to_walltime_limit(job): + error_file.write("DeadlineExceeded") + job_state.fail_message = "Job was active longer than specified deadline" + job_state.runner_state = JobState.runner_states.WALLTIME_REACHED else: error_file.write("Exceeded max number of Kubernetes pod retrials allowed for job\n") job_state.fail_message = "More pods failed than allowed. See stdout for pods details." @@ -474,6 +477,10 @@ class KubernetesJobRunner(AsynchronousJobRunner): job.scale(replicas=0) return None + def __job_failed_due_to_walltime_limit(self, job): + conditions = job.obj['status']['conditions'] + return any(True for c in conditions if c['type'] == 'Failed' and c['reason'] == 'DeadlineExceeded') + def __job_failed_due_to_low_memory(self, job_state): """ checks the state of the pod to see if it was killed @@ -483,8 +490,10 @@ class KubernetesJobRunner(AsynchronousJobRunner): pods = Pod.objects(self._pykube_api).filter(selector="app=%s" % job_state.job_id, namespace=self.runner_params['k8s_namespace']) - pod = Pod(self._pykube_api, pods.response['items'][0]) + if not pods.response['items']: + return False + pod = Pod(self._pykube_api, pods.response['items'][0]) if pod.obj['status']['phase'] == "Failed" and \ pod.obj['status']['containerStatuses'][0]['state']['terminated']['reason'] == "OOMKilled": return True diff --git a/lib/galaxy/managers/cloud.py b/lib/galaxy/managers/cloud.py index f88eef13827..9d3281fb9d2 100644 --- a/lib/galaxy/managers/cloud.py +++ b/lib/galaxy/managers/cloud.py @@ -147,6 +147,9 @@ class CloudManager(sharable.SharableModelManager): 'os_project_domain_name': prj_domain_name, 'os_user_domain_name': user_domain_name} connection = CloudProviderFactory().create_provider(ProviderList.OPENSTACK, config) + elif provider == "gcp": + config = {"gcp_service_creds_dict": credentials} + connection = CloudProviderFactory().create_provider(ProviderList.GCP, config) else: raise RequestParameterInvalidException("Unrecognized provider '{}'; the following are the supported " "providers: {}.".format(provider, SUPPORTED_PROVIDERS.keys())) @@ -340,8 +343,8 @@ class CloudManager(sharable.SharableModelManager): try: object_label = hda.name.replace(" ", "_") args = { - # We encode ID here because it the tool wrapper assumes - # it receives an encoded ID and attempts decoding it. + # We encode ID here because the tool wrapper expects + # an encoded ID and attempts decoding it. "authz_id": trans.security.encode_id(cloudauthz.id), "bucket": bucket_name, "object_label": object_label, diff --git a/lib/galaxy/managers/folders.py b/lib/galaxy/managers/folders.py index af697af7d2a..2cce3f0f783 100644 --- a/lib/galaxy/managers/folders.py +++ b/lib/galaxy/managers/folders.py @@ -78,6 +78,23 @@ class FolderManager(object): folder = self.check_accessible(trans, folder) return folder + def check_modifyable(self, trans, folder): + """ + Check whether the user can modify the folder (name and description). + + :returns: the original folder + :rtype: LibraryFolder + + :raises: AuthenticationRequired, InsufficientPermissionsException + """ + if not trans.user: + raise AuthenticationRequired("Must be logged in to manage Galaxy items.", type='error') + current_user_roles = trans.get_current_user_roles() + if not trans.app.security_agent.can_modify_library_item(current_user_roles, folder): + raise InsufficientPermissionsException("You don't have permissions to modify this folder.", type='error') + else: + return folder + def check_manageable(self, trans, folder): """ Check whether the user can manage the folder. @@ -171,8 +188,7 @@ class FolderManager(object): """ changed = False if not trans.user_is_admin: - if not self.check_manageable(trans, folder): - raise InsufficientPermissionsException("You do not have proper permission to update the library folder.") + folder = self.check_modifyable(trans, folder) if folder.deleted is True: raise ItemAccessibilityException("You cannot update a deleted library folder. Undelete it first.") if name is not None and name != folder.name: diff --git a/test/galaxy_selenium/__init__.py b/lib/galaxy/selenium/__init__.py similarity index 100% rename from test/galaxy_selenium/__init__.py rename to lib/galaxy/selenium/__init__.py diff --git a/test/galaxy_selenium/cli.py b/lib/galaxy/selenium/cli.py similarity index 100% rename from test/galaxy_selenium/cli.py rename to lib/galaxy/selenium/cli.py diff --git a/test/galaxy_selenium/components.py b/lib/galaxy/selenium/components.py similarity index 96% rename from test/galaxy_selenium/components.py rename to lib/galaxy/selenium/components.py index 10760bb90ab..2eac23ad8ae 100644 --- a/test/galaxy_selenium/components.py +++ b/lib/galaxy/selenium/components.py @@ -98,7 +98,7 @@ class SelectorTemplate(Target): if name in self._children: return self._children[name](**{"_": self.selector}) else: - raise KeyError("Could not find child [%s] in %s" % (name, self._children)) + raise AttributeError("Could not find child [%s] in %s" % (name, self._children)) __getitem__ = __getattr__ @@ -193,7 +193,7 @@ class Component(object): elif attr in self._text: return self._text[attr] else: - raise Exception("Failed to find referenced sub-component/selector/label/text [%s]" % attr) + raise AttributeError("Failed to find referenced sub-component/selector/label/text [%s]" % attr) __getitem__ = __getattr__ diff --git a/test/galaxy_selenium/data.py b/lib/galaxy/selenium/data.py similarity index 100% rename from test/galaxy_selenium/data.py rename to lib/galaxy/selenium/data.py diff --git a/test/galaxy_selenium/driver_factory.py b/lib/galaxy/selenium/driver_factory.py similarity index 100% rename from test/galaxy_selenium/driver_factory.py rename to lib/galaxy/selenium/driver_factory.py diff --git a/test/galaxy_selenium/has_driver.py b/lib/galaxy/selenium/has_driver.py similarity index 100% rename from test/galaxy_selenium/has_driver.py rename to lib/galaxy/selenium/has_driver.py diff --git a/test/galaxy_selenium/navigates_galaxy.py b/lib/galaxy/selenium/navigates_galaxy.py similarity index 100% rename from test/galaxy_selenium/navigates_galaxy.py rename to lib/galaxy/selenium/navigates_galaxy.py diff --git a/test/galaxy_selenium/navigation-data.yml b/lib/galaxy/selenium/navigation-data.yml similarity index 100% rename from test/galaxy_selenium/navigation-data.yml rename to lib/galaxy/selenium/navigation-data.yml diff --git a/test/galaxy_selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml similarity index 100% rename from test/galaxy_selenium/navigation.yml rename to lib/galaxy/selenium/navigation.yml diff --git a/lib/galaxy/selenium/scripts/__init__.py b/lib/galaxy/selenium/scripts/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/scripts/dump_tour.py b/lib/galaxy/selenium/scripts/dump_tour.py similarity index 91% rename from scripts/dump_tour.py rename to lib/galaxy/selenium/scripts/dump_tour.py index b13020581cb..5ce5f6c2a31 100755 --- a/scripts/dump_tour.py +++ b/lib/galaxy/selenium/scripts/dump_tour.py @@ -5,9 +5,7 @@ import os import sys import time -sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'test'))) - -from galaxy_selenium import cli +from galaxy.selenium import cli DESCRIPTION = "Walk a Galaxy tour and dump screenshots." diff --git a/test/galaxy_selenium/sizzle.py b/lib/galaxy/selenium/sizzle.py similarity index 100% rename from test/galaxy_selenium/sizzle.py rename to lib/galaxy/selenium/sizzle.py diff --git a/test/galaxy_selenium/smart_components.py b/lib/galaxy/selenium/smart_components.py similarity index 97% rename from test/galaxy_selenium/smart_components.py rename to lib/galaxy/selenium/smart_components.py index 9f4304f0f74..8c085ebfc12 100644 --- a/test/galaxy_selenium/smart_components.py +++ b/lib/galaxy/selenium/smart_components.py @@ -8,7 +8,7 @@ class SmartComponent(object): """Wrap a Component with driver aware methods. Allows smarter selectors that know how to wait for themselves, test themselves, - click themselvers, etc.... More "magic", but much cleaner usage. + click themselves, etc.... More "magic", but much cleaner usage. """ def __init__(self, component, has_driver): diff --git a/lib/galaxy/tools/verify/__init__.py b/lib/galaxy/tool_util/verify/__init__.py similarity index 100% rename from lib/galaxy/tools/verify/__init__.py rename to lib/galaxy/tool_util/verify/__init__.py diff --git a/lib/galaxy/tools/verify/asserts/__init__.py b/lib/galaxy/tool_util/verify/asserts/__init__.py similarity index 97% rename from lib/galaxy/tools/verify/asserts/__init__.py rename to lib/galaxy/tool_util/verify/asserts/__init__.py index ccdadb057e1..ebd2ea52b8f 100644 --- a/lib/galaxy/tools/verify/asserts/__init__.py +++ b/lib/galaxy/tool_util/verify/asserts/__init__.py @@ -14,7 +14,7 @@ assertion_module_names = ['text', 'tabular', 'xml', 'hdf5', 'archive'] # to the list of assertion module names defined above. assertion_modules = [] for assertion_module_name in assertion_module_names: - full_assertion_module_name = 'galaxy.tools.verify.asserts.' + assertion_module_name + full_assertion_module_name = 'galaxy.tool_util.verify.asserts.' + assertion_module_name try: # Dynamically import module __import__(full_assertion_module_name) diff --git a/lib/galaxy/tools/verify/asserts/archive.py b/lib/galaxy/tool_util/verify/asserts/archive.py similarity index 100% rename from lib/galaxy/tools/verify/asserts/archive.py rename to lib/galaxy/tool_util/verify/asserts/archive.py diff --git a/lib/galaxy/tools/verify/asserts/hdf5.py b/lib/galaxy/tool_util/verify/asserts/hdf5.py similarity index 100% rename from lib/galaxy/tools/verify/asserts/hdf5.py rename to lib/galaxy/tool_util/verify/asserts/hdf5.py diff --git a/lib/galaxy/tools/verify/asserts/tabular.py b/lib/galaxy/tool_util/verify/asserts/tabular.py similarity index 100% rename from lib/galaxy/tools/verify/asserts/tabular.py rename to lib/galaxy/tool_util/verify/asserts/tabular.py diff --git a/lib/galaxy/tools/verify/asserts/text.py b/lib/galaxy/tool_util/verify/asserts/text.py similarity index 100% rename from lib/galaxy/tools/verify/asserts/text.py rename to lib/galaxy/tool_util/verify/asserts/text.py diff --git a/lib/galaxy/tools/verify/asserts/xml.py b/lib/galaxy/tool_util/verify/asserts/xml.py similarity index 100% rename from lib/galaxy/tools/verify/asserts/xml.py rename to lib/galaxy/tool_util/verify/asserts/xml.py diff --git a/lib/galaxy/tools/verify/interactor.py b/lib/galaxy/tool_util/verify/interactor.py similarity index 100% rename from lib/galaxy/tools/verify/interactor.py rename to lib/galaxy/tool_util/verify/interactor.py diff --git a/lib/galaxy/tools/verify/script.py b/lib/galaxy/tool_util/verify/script.py similarity index 98% rename from lib/galaxy/tools/verify/script.py rename to lib/galaxy/tool_util/verify/script.py index d4d36ad15e1..cf6121395f1 100644 --- a/lib/galaxy/tools/verify/script.py +++ b/lib/galaxy/tool_util/verify/script.py @@ -5,7 +5,10 @@ import argparse import json import sys -from galaxy.tools.verify.interactor import GalaxyInteractorApi, verify_tool +from .interactor import ( + GalaxyInteractorApi, + verify_tool, +) DESCRIPTION = """Script to quickly run a tool test against a running Galaxy instance.""" ALL_TESTS = "*all_tests*" diff --git a/lib/galaxy/tools/verify/test_data.py b/lib/galaxy/tool_util/verify/test_data.py similarity index 100% rename from lib/galaxy/tools/verify/test_data.py rename to lib/galaxy/tool_util/verify/test_data.py diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index c46b524bdec..69040ef61ed 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -1631,7 +1631,7 @@ many of the default assertion tags that come with Galaxy and examples of each can be found below. The implementation of these tags are simply Python functions defined in the -[/lib/galaxy/tools/verify/asserts](https://github.com/galaxyproject/galaxy/tree/dev/lib/galaxy/tools/verify/asserts) +[/lib/galaxy/tool_util/verify/asserts](https://github.com/galaxyproject/galaxy/tree/dev/lib/galaxy/tool_util/verify/asserts) module. ]]> diff --git a/lib/galaxy/tools/sort_collection_list.xml b/lib/galaxy/tools/sort_collection_list.xml index 1d7207e22dd..7c8d3467a52 100644 --- a/lib/galaxy/tools/sort_collection_list.xml +++ b/lib/galaxy/tools/sort_collection_list.xml @@ -14,6 +14,8 @@ + + diff --git a/lib/galaxy/tools/test.py b/lib/galaxy/tools/test.py index 03ddd53df46..8dc6e5d41fc 100644 --- a/lib/galaxy/tools/test.py +++ b/lib/galaxy/tools/test.py @@ -6,7 +6,7 @@ from six import string_types import galaxy.tools.parameters.basic import galaxy.tools.parameters.grouping -from galaxy.tools.verify.interactor import ToolTestDescription +from galaxy.tool_util.verify.interactor import ToolTestDescription from galaxy.util import ( string_as_bool, unicodify, diff --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index 39362985dd1..4eacd58d501 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -1685,14 +1685,14 @@ def download_to_file(url, dest_file_path, timeout=30, chunk_size=2 ** 20): f.write(chunk) -def _executable(): +def get_executable(): exe = sys.executable if exe.endswith('uwsgi'): virtualenv = None if uwsgi is not None: for name in ('home', 'virtualenv', 'venv', 'pyhome'): if name in uwsgi.opt: - virtualenv = uwsgi.opt[name] + virtualenv = unicodify(uwsgi.opt[name]) break if virtualenv is None and 'VIRTUAL_ENV' in os.environ: virtualenv = os.environ['VIRTUAL_ENV'] @@ -1705,9 +1705,6 @@ def _executable(): return exe -executable = _executable() - - class ExecutionTimer(object): def __init__(self): diff --git a/lib/galaxy/util/compression_utils.py b/lib/galaxy/util/compression_utils.py index aa6f658b67d..1102b437f4a 100644 --- a/lib/galaxy/util/compression_utils.py +++ b/lib/galaxy/util/compression_utils.py @@ -47,8 +47,13 @@ def get_fileobj_raw(filename, mode="r", compressed_formats=None): compressed_format = 'bz2' elif 'zip' in compressed_formats and zipfile.is_zipfile(filename): # Return fileobj for the first file in a zip file. - with zipfile.ZipFile(filename, mode) as zh: - fh = zh.open(zh.namelist()[0], mode) + # 'b' is not allowed in the ZipFile mode argument + # since it always opens files in binary mode. + # For emulating text mode, we will be returning the binary fh in a + # TextIOWrapper. + zf_mode = mode.replace('b', '') + with zipfile.ZipFile(filename, zf_mode) as zh: + fh = zh.open(zh.namelist()[0], zf_mode) compressed_format = 'zip' elif 'b' in mode: return compressed_format, open(filename, mode) diff --git a/lib/galaxy/web/framework/helpers/grids.py b/lib/galaxy/web/framework/helpers/grids.py index 08f7603b2c4..6031898535b 100644 --- a/lib/galaxy/web/framework/helpers/grids.py +++ b/lib/galaxy/web/framework/helpers/grids.py @@ -777,6 +777,27 @@ class DeletedColumn(GridColumn): return query +class PurgedColumn(GridColumn): + """ Column that tracks and filters for items with purged attribute. """ + + def get_accepted_filters(self): + """ Returns a list of accepted filters for this column. """ + accepted_filter_labels_and_vals = {"nonpurged" : "False", "purged" : "True", "all": "All"} + accepted_filters = [] + for label, val in accepted_filter_labels_and_vals.items(): + args = {self.key: val} + accepted_filters.append(GridColumnFilter(label, args)) + return accepted_filters + + def filter(self, trans, user, query, column_filter): + """Modify query to filter self.model_class by state.""" + if column_filter == "All": + pass + elif column_filter in ["True", "False"]: + query = query.filter(self.model_class.purged == (column_filter == "True")) + return query + + class StateColumn(GridColumn): """ Column that tracks and filters for items with state attribute. diff --git a/lib/galaxy/webapps/galaxy/controllers/admin.py b/lib/galaxy/webapps/galaxy/controllers/admin.py index 800f9f6d5b0..a2dee924595 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -130,7 +130,8 @@ class UserListGrid(grids.Grid): ActivatedColumn("Activated", attach_popup=False), APIKeyColumn("API Key", attach_popup=False), # Columns that are valid for filtering but are not visible. - grids.DeletedColumn("Deleted", key="deleted", visible=False, filterable="advanced") + grids.DeletedColumn("Deleted", key="deleted", visible=False, filterable="advanced"), + grids.PurgedColumn("Purged", key="purged", visible=False, filterable="advanced") ] columns.append(grids.MulticolFilterColumn("Search", cols_to_filter=[columns[0], columns[1]], @@ -170,6 +171,8 @@ class UserListGrid(grids.Grid): ] num_rows_per_page = 50 use_paging = True + default_filter = dict(purged="False") + use_default_filter = True def get_current_item(self, trans, **kwargs): return trans.user diff --git a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py index 00653846147..f457788bdd5 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -159,18 +159,6 @@ class AdminToolshed(AdminGalaxy): message=message, status=status) - @web.expose - @web.require_admin - def browse_toolsheds(self, trans, **kwd): - app = { - 'jscript': "adminToolshed" - } - return trans.fill_template('galaxy.panels.mako', - config={ - 'title': 'Galaxy Tool Sheds', - 'app': app, - 'bundle': 'extended'}) - @web.expose @web.require_admin def check_for_updates(self, trans, **kwd): diff --git a/lib/tool_shed/galaxy_install/migrate/check.py b/lib/tool_shed/galaxy_install/migrate/check.py index b7b8582e18f..be4ee9c4620 100644 --- a/lib/tool_shed/galaxy_install/migrate/check.py +++ b/lib/tool_shed/galaxy_install/migrate/check.py @@ -6,7 +6,7 @@ import sys from migrate.versioning import repository, schema from sqlalchemy import create_engine, MetaData, Table -from galaxy.util import executable +from galaxy.util import get_executable from galaxy.util.odict import odict from tool_shed.util import common_util @@ -57,7 +57,7 @@ def verify_tools(app, url, galaxy_config_file=None, engine_options={}): if tool_shed_accessible: # Automatically update the value of the migrate_tools.version database table column. manage_tools = os.path.abspath(os.path.join(os.path.dirname(__file__), 'scripts', 'manage_tools.py')) - cmd = [executable, manage_tools, 'upgrade', 'tools'] + cmd = [get_executable(), manage_tools, 'upgrade', 'tools'] if galaxy_config_file: cmd[2:2] = ['-c', galaxy_config_file] proc = subprocess.Popen(args=cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) diff --git a/packages/app/galaxy/config b/packages/app/galaxy/config new file mode 120000 index 00000000000..ce9417b1a26 --- /dev/null +++ b/packages/app/galaxy/config @@ -0,0 +1 @@ +../../../lib/galaxy/config \ No newline at end of file diff --git a/packages/app/galaxy/config.py b/packages/app/galaxy/config.py deleted file mode 120000 index 7e61acb3d31..00000000000 --- a/packages/app/galaxy/config.py +++ /dev/null @@ -1 +0,0 @@ -../../../lib/galaxy/config.py \ No newline at end of file diff --git a/packages/app/setup.py b/packages/app/setup.py index 1f1b2fa3b07..08bd1df2521 100644 --- a/packages/app/setup.py +++ b/packages/app/setup.py @@ -63,8 +63,6 @@ PACKAGES = [ 'galaxy.tools.toolbox.lineages', 'galaxy.tools.util', 'galaxy.tools.util.galaxyops', - 'galaxy.tools.verify', - 'galaxy.tools.verify.asserts', 'galaxy.tours', 'galaxy.visualization', 'galaxy.visualization.data_providers', @@ -102,6 +100,8 @@ PACKAGES = [ ] ENTRY_POINTS = ''' [console_scripts] + galaxy-main=galaxy.main:main + galaxy-config=galaxy.config.script:main ''' PACKAGE_DATA = { # Be sure to update MANIFEST.in for source dist. diff --git a/packages/data/setup.py b/packages/data/setup.py index 12556d60ed4..28faa87c3d9 100644 --- a/packages/data/setup.py +++ b/packages/data/setup.py @@ -47,7 +47,8 @@ PACKAGES = [ ] ENTRY_POINTS = ''' [console_scripts] - gx-build-objects=galaxy.model.store.build_objects:main + galaxy-build-objects=galaxy.model.store.build_objects:main + galaxy-manage-db=galaxy.model.orm.scripts:manage_db ''' PACKAGE_DATA = { # Be sure to update MANIFEST.in for source dist. diff --git a/packages/meta/setup.py b/packages/meta/setup.py index ba0cd02ba7b..07e0d7a2d4f 100644 --- a/packages/meta/setup.py +++ b/packages/meta/setup.py @@ -32,10 +32,6 @@ TEST_DIR = 'tests' PACKAGES = [] ENTRY_POINTS = ''' [console_scripts] - galaxy-paster=galaxy.util.pastescript.serve:run - galaxy-main=galaxy.main:main - galaxy-config=galaxy.config.script:main - galaxy-manage-db=galaxy.model.orm.scripts:manage_db ''' PACKAGE_DATA = { # Be sure to update MANIFEST.in for source dist. diff --git a/packages/selenium/HISTORY.rst b/packages/selenium/HISTORY.rst new file mode 100644 index 00000000000..ec2f0e746e9 --- /dev/null +++ b/packages/selenium/HISTORY.rst @@ -0,0 +1,12 @@ +.. :changelog: + +History +------- + +.. to_doc + +--------------------- +19.9.0.dev0 +--------------------- + +* Initial import from dev branch of Galaxy during 19.09 development cycle. diff --git a/packages/selenium/LICENSE b/packages/selenium/LICENSE new file mode 120000 index 00000000000..1ef648f64b3 --- /dev/null +++ b/packages/selenium/LICENSE @@ -0,0 +1 @@ +../../LICENSE.txt \ No newline at end of file diff --git a/packages/selenium/MANIFEST.in b/packages/selenium/MANIFEST.in new file mode 100644 index 00000000000..99afa949c6c --- /dev/null +++ b/packages/selenium/MANIFEST.in @@ -0,0 +1,2 @@ +include *.rst LICENSE +include galaxy/selenium/*yml diff --git a/packages/selenium/Makefile b/packages/selenium/Makefile new file mode 120000 index 00000000000..37af8bae5ba --- /dev/null +++ b/packages/selenium/Makefile @@ -0,0 +1 @@ +../package.Makefile \ No newline at end of file diff --git a/packages/selenium/README.rst b/packages/selenium/README.rst new file mode 100644 index 00000000000..b66238cd3b1 --- /dev/null +++ b/packages/selenium/README.rst @@ -0,0 +1,15 @@ + +.. image:: https://badge.fury.io/py/galaxy-selenium.svg + :target: https://pypi.org/project/galaxy-selenium/ + + + +Overview +-------- + +The Galaxy_ selenium framework. + +* Free software: Academic Free License version 3.0 +* Code: https://github.com/galaxyproject/galaxy + +.. _Galaxy: http://galaxyproject.org/ diff --git a/packages/selenium/dev-requirements.txt b/packages/selenium/dev-requirements.txt new file mode 120000 index 00000000000..467b90d7a23 --- /dev/null +++ b/packages/selenium/dev-requirements.txt @@ -0,0 +1 @@ +../package-dev-requirements.txt \ No newline at end of file diff --git a/packages/selenium/galaxy/__init__.py b/packages/selenium/galaxy/__init__.py new file mode 100644 index 00000000000..69e3be50dac --- /dev/null +++ b/packages/selenium/galaxy/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/packages/selenium/galaxy/project_galaxy_selenium.py b/packages/selenium/galaxy/project_galaxy_selenium.py new file mode 100644 index 00000000000..73ec5c1cf31 --- /dev/null +++ b/packages/selenium/galaxy/project_galaxy_selenium.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +__version__ = '19.9.0.dev0' + +PROJECT_NAME = "galaxy-selenium" +PROJECT_OWNER = PROJECT_USERAME = "galaxyproject" +PROJECT_URL = "https://github.com/galaxyproject/galaxy" +PROJECT_AUTHOR = 'Galaxy Project and Community' +PROJECT_DESCRIPTION = 'Galaxy Selenium Interaction Framework' +PROJECT_EMAIL = 'galaxy-committers@lists.galaxyproject.org' +RAW_CONTENT_URL = "https://raw.github.com/%s/%s/master/" % ( + PROJECT_USERAME, PROJECT_NAME +) diff --git a/packages/selenium/galaxy/selenium b/packages/selenium/galaxy/selenium new file mode 120000 index 00000000000..60a2948815b --- /dev/null +++ b/packages/selenium/galaxy/selenium @@ -0,0 +1 @@ +../../../lib/galaxy/selenium/ \ No newline at end of file diff --git a/packages/selenium/requirements.txt b/packages/selenium/requirements.txt new file mode 100644 index 00000000000..ea07fcb13dc --- /dev/null +++ b/packages/selenium/requirements.txt @@ -0,0 +1,2 @@ +galaxy-util +selenium diff --git a/packages/selenium/scripts b/packages/selenium/scripts new file mode 120000 index 00000000000..9aec9dc5a06 --- /dev/null +++ b/packages/selenium/scripts @@ -0,0 +1 @@ +../build_scripts \ No newline at end of file diff --git a/packages/selenium/setup.cfg b/packages/selenium/setup.cfg new file mode 120000 index 00000000000..eb7cf09393f --- /dev/null +++ b/packages/selenium/setup.cfg @@ -0,0 +1 @@ +../../setup.cfg \ No newline at end of file diff --git a/packages/selenium/setup.py b/packages/selenium/setup.py new file mode 100644 index 00000000000..a53fe8e6602 --- /dev/null +++ b/packages/selenium/setup.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import ast +import os +import re +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + +SOURCE_DIR = "galaxy" + +_version_re = re.compile(r'__version__\s+=\s+(.*)') + +project_short_name = os.path.basename(os.path.dirname(os.path.realpath(__file__))) +with open('%s/project_galaxy_%s.py' % (SOURCE_DIR, project_short_name), 'rb') as f: + init_contents = f.read().decode('utf-8') + + def get_var(var_name): + pattern = re.compile(r'%s\s+=\s+(.*)' % var_name) + match = pattern.search(init_contents).group(1) + return str(ast.literal_eval(match)) + + version = get_var("__version__") + PROJECT_NAME = get_var("PROJECT_NAME") + PROJECT_URL = get_var("PROJECT_URL") + PROJECT_AUTHOR = get_var("PROJECT_AUTHOR") + PROJECT_EMAIL = get_var("PROJECT_EMAIL") + PROJECT_DESCRIPTION = get_var("PROJECT_DESCRIPTION") + +TEST_DIR = 'tests' +PACKAGES = [ + 'galaxy', + 'galaxy.selenium', + 'galaxy.selenium.scripts', +] +ENTRY_POINTS = ''' + [console_scripts] + gx-dump-tour=galaxy.selenium.scripts.dump_tour:main +''' +PACKAGE_DATA = { + # Be sure to update MANIFEST.in for source dist. + 'galaxy': [ + 'selenium/*yml', + ], +} +PACKAGE_DIR = { + SOURCE_DIR: SOURCE_DIR, +} + +readme = open('README.rst').read() +history = open('HISTORY.rst').read().replace('.. :changelog:', '') + +if os.path.exists("requirements.txt"): + requirements = open("requirements.txt").read().split("\n") +else: + # In tox, it will cover them anyway. + requirements = [] + + +test_requirements = [ + # TODO: put package test requirements here +] + + +setup( + name=PROJECT_NAME, + version=version, + description=PROJECT_DESCRIPTION, + long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', + author=PROJECT_AUTHOR, + author_email=PROJECT_EMAIL, + url=PROJECT_URL, + packages=PACKAGES, + entry_points=ENTRY_POINTS, + package_data=PACKAGE_DATA, + package_dir=PACKAGE_DIR, + include_package_data=True, + install_requires=requirements, + license="AFL", + zip_safe=False, + keywords='galaxy', + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Environment :: Console', + 'License :: OSI Approved :: Academic Free License (AFL)', + 'Operating System :: POSIX', + 'Topic :: Software Development', + 'Topic :: Software Development :: Code Generators', + 'Topic :: Software Development :: Testing', + 'Natural Language :: English', + "Programming Language :: Python :: 2", + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + ], + test_suite=TEST_DIR, + tests_require=test_requirements +) diff --git a/packages/test.sh b/packages/test.sh index fda2337bf50..a98025731ae 100755 --- a/packages/test.sh +++ b/packages/test.sh @@ -3,8 +3,7 @@ set -e # Don't display the pip progress bar when running under CI -PIP_PROGRESS_BAR= -[ "$CI" = "true" ] && PIP_PROGRESS_BAR='--progress-bar off' +[ "$CI" = 'true' ] && export PIP_PROGRESS_BAR=off # Change to packages directory. cd "$(dirname "$0")" @@ -15,7 +14,7 @@ TEST_ENV_DIR=${TEST_ENV_DIR:-$(mktemp -d -t gxpkgtestenvXXXXXX)} virtualenv -p "$TEST_PYTHON" "$TEST_ENV_DIR" . "${TEST_ENV_DIR}/bin/activate" -pip install ${PIP_PROGRESS_BAR} pytest +pip install pytest # ensure ordered by dependency dag PACKAGE_DIRS=( @@ -41,9 +40,9 @@ for ((i=0; i<${#PACKAGE_DIRS[@]}; i++)); do run_tests=${RUN_TESTS[$i]} cd "$package_dir" - pip install ${PIP_PROGRESS_BAR} -e . + pip install -e . if [ "$package_dir" = "util" ]; then - pip install ${PIP_PROGRESS_BAR} -e '.[template,jstree]' + pip install -e '.[template,jstree]' fi if [[ "$run_tests" == "1" ]]; then diff --git a/packages/tool_util/setup.py b/packages/tool_util/setup.py index 3a07bdc2b5c..1e85d8fdce2 100644 --- a/packages/tool_util/setup.py +++ b/packages/tool_util/setup.py @@ -40,9 +40,12 @@ PACKAGES = [ 'galaxy.tool_util.linters', 'galaxy.tool_util.locations', 'galaxy.tool_util.parser', + 'galaxy.tool_util.verify', + 'galaxy.tool_util.verify.asserts', ] ENTRY_POINTS = ''' [console_scripts] + galaxy-tool-test=galaxy.tool_util.verify.script:main mulled-build=galaxy.tool_util.deps.mulled.mulled_build:main mulled-build-channel=galaxy.tool_util.deps.mulled.mulled_build_channel:main mulled-search=galaxy.tool_util.deps.mulled.mulled_search:main diff --git a/packages/tool_util/tests/__init__.py b/packages/tool_util/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/tool_util/tests/sample_data.py b/packages/tool_util/tests/sample_data.py new file mode 120000 index 00000000000..dc903e91c44 --- /dev/null +++ b/packages/tool_util/tests/sample_data.py @@ -0,0 +1 @@ +../../../test/unit/unittest_utils/sample_data.py \ No newline at end of file diff --git a/packages/tool_util/tests/test_conda_resolution.py b/packages/tool_util/tests/test_conda_resolution.py index 645faad4496..ad0efe1c3b9 120000 --- a/packages/tool_util/tests/test_conda_resolution.py +++ b/packages/tool_util/tests/test_conda_resolution.py @@ -1 +1 @@ -../../../test/unit/tools/test_conda_resolution.py \ No newline at end of file +../../../test/unit/tool_util/test_conda_resolution.py \ No newline at end of file diff --git a/packages/tool_util/tests/test_output_checker.py b/packages/tool_util/tests/test_output_checker.py index 2a54b77ca94..9d5d6522f67 120000 --- a/packages/tool_util/tests/test_output_checker.py +++ b/packages/tool_util/tests/test_output_checker.py @@ -1 +1 @@ -../../../test/unit/tools/test_output_checker.py \ No newline at end of file +../../../test/unit/tool_util/test_output_checker.py \ No newline at end of file diff --git a/packages/tool_util/tests/test_parsing.py b/packages/tool_util/tests/test_parsing.py index b21638588e4..c2ed25042dd 120000 --- a/packages/tool_util/tests/test_parsing.py +++ b/packages/tool_util/tests/test_parsing.py @@ -1 +1 @@ -../../../test/unit/tools/test_parsing.py \ No newline at end of file +../../../test/unit/tool_util/test_parsing.py \ No newline at end of file diff --git a/packages/tool_util/tests/test_tool_deps.py b/packages/tool_util/tests/test_tool_deps.py index 34701999330..0c3f256d878 120000 --- a/packages/tool_util/tests/test_tool_deps.py +++ b/packages/tool_util/tests/test_tool_deps.py @@ -1 +1 @@ -../../../test/unit/tools/test_tool_deps.py \ No newline at end of file +../../../test/unit/tool_util/test_tool_deps.py \ No newline at end of file diff --git a/packages/tool_util/tests/test_tool_loader.py b/packages/tool_util/tests/test_tool_loader.py index 572b75ae0a5..fb88b8ae6c5 120000 --- a/packages/tool_util/tests/test_tool_loader.py +++ b/packages/tool_util/tests/test_tool_loader.py @@ -1 +1 @@ -../../../test/unit/tools/test_tool_loader.py \ No newline at end of file +../../../test/unit/tool_util/test_tool_loader.py \ No newline at end of file diff --git a/packages/tool_util/tests/test_util.py b/packages/tool_util/tests/test_util.py new file mode 120000 index 00000000000..e6343216e6f --- /dev/null +++ b/packages/tool_util/tests/test_util.py @@ -0,0 +1 @@ +../../../test/unit/tool_util/test_util.py \ No newline at end of file diff --git a/packages/tool_util/tests/util.py b/packages/tool_util/tests/util.py new file mode 120000 index 00000000000..f757327f2d9 --- /dev/null +++ b/packages/tool_util/tests/util.py @@ -0,0 +1 @@ +../../../test/unit/tool_util/util.py \ No newline at end of file diff --git a/scripts/build_universe_config.py b/scripts/build_universe_config.py deleted file mode 100644 index 44c15be7c29..00000000000 --- a/scripts/build_universe_config.py +++ /dev/null @@ -1,35 +0,0 @@ -from os import listdir -from os.path import join -from re import match -from sys import argv - -from six.moves.configparser import ConfigParser - - -def merge(): - """ - Merges all .ini files in a specified directory into a file (defaults to - ./config/galaxy.ini ). - """ - if len(argv) < 2: - message = "%s: Must specify directory to merge configuration files from." % argv[0] - raise Exception(message) - conf_directory = argv[1] - conf_files = [f for f in listdir(conf_directory) if match(r'.*\.ini', f)] - conf_files.sort() - - parser = ConfigParser() - for conf_file in conf_files: - parser.read([join(conf_directory, conf_file)]) - # TODO: Expand enviroment variables here, that would - # also make Galaxy much easier to configure. - - destination = "config/galaxy.ini" - if len(argv) > 2: - destination = argv[2] - - parser.write(open(destination, 'w')) - - -if __name__ == '__main__': - merge() diff --git a/scripts/check_galaxy.py b/scripts/check_galaxy.py deleted file mode 100755 index 22f96a6bf0c..00000000000 --- a/scripts/check_galaxy.py +++ /dev/null @@ -1,416 +0,0 @@ -#!/usr/bin/env python -""" -check_galaxy can be run by hand, although it is meant to run from cron -via the check_galaxy.sh script in Galaxy's cron/ directory. -""" -from __future__ import print_function - -import filecmp -import formatter -import getopt -import htmllib -import os -import socket -import sys -import tempfile -import time - -import twill -import twill.commands as tc - -# options -if "DEBUG" in os.environ: - debug = os.environ["DEBUG"] -else: - debug = False -scripts_dir = os.path.abspath(os.path.dirname(sys.argv[0])) -test_data_dir = os.path.join(scripts_dir, os.pardir, "test-data") -# what tools to run - not so pretty -tools = { - "gops_intersect_1": - [ - { - "inputs": - ( - os.path.join(test_data_dir, "1.bed"), - os.path.join(test_data_dir, "2.bed") - ) - }, - {"check_file": os.path.join(test_data_dir, "gops_intersect_out.bed")}, - { - "tool_run_options": - { - "input1": "1.bed", - "input2": "2.bed", - "min": "1", - "returntype": "" - } - } - ] -} - - -# handle arg(s) -def usage(): - sys.exit("usage: check_galaxy.py ") - - -try: - opts, args = getopt.getopt(sys.argv[1:], 'n') -except getopt.GetoptError as e: - print(str(e)) - usage() -if len(args) < 1: - usage() -server = args[0] -if server.endswith(".g2.bx.psu.edu"): - if debug: - print("Checking a PSU Galaxy server, using maint file") - maint = "/errordocument/502/%s/maint" % args[0].split('.', 1)[0] -else: - maint = None -new_history = False -for o, a in opts: - if o == "-n": - if debug: - print("Specified -n, will create a new history") - new_history = True - else: - usage() - -# state information -var_dir = os.path.join(os.path.expanduser('~'), ".check_galaxy", server) -if not os.access(var_dir, os.F_OK): - os.makedirs(var_dir, 0o700) - -# get user/pass -login_file = os.path.join(var_dir, "login") -try: - f = open(login_file, 'r') -except Exception: - message = """Please create the file: -%s -This should contain a username and password to log in to Galaxy with, -on one line, separated by whitespace, e.g.: - -check_galaxy@example.com password - -If the user does not exist, check_galaxy will create it for you.""" % login_file - sys.exit(message) -(username, password) = f.readline().split() - -# default timeout for twill browser is never -socket.setdefaulttimeout(300) - -# user-agent -tc.agent("Mozilla/5.0 (compatible; check_galaxy/0.1)") -tc.config('use_tidy', 0) - - -class Browser(object): - - def __init__(self): - self.server = server - self.maint = maint - self.tool = None - self.tool_opts = None - self.id = None - self.status = None - self.check_file = None - self.hid = None - self.cookie_jar = os.path.join(var_dir, "cookie_jar") - dprint("cookie jar path: %s" % self.cookie_jar) - if not os.access(self.cookie_jar, os.R_OK): - dprint("no cookie jar at above path, creating") - tc.save_cookies(self.cookie_jar) - tc.load_cookies(self.cookie_jar) - - def get(self, path): - tc.go("http://%s%s" % (self.server, path)) - tc.code(200) - - def reset(self): - self.tool = None - self.tool_opts = None - self.id = None - self.status = None - self.check_file = None - self.delete_datasets() - self.get("/root/history") - p = didParser() - p.feed(tc.browser.get_html()) - if len(p.dids) > 0: - print("Remaining datasets ids:", " ".join(p.dids)) - raise Exception("History still contains datasets after attempting to delete them") - if new_history: - self.get("/history/delete_current") - tc.save_cookies(self.cookie_jar) - - def check_redir(self, url): - try: - tc.get_browser()._browser.set_handle_redirect(False) - tc.go(url) - tc.code(302) - tc.get_browser()._browser.set_handle_redirect(True) - dprint("%s is returning redirect (302)" % url) - return(True) - except twill.errors.TwillAssertionError as e: - tc.get_browser()._browser.set_handle_redirect(True) - dprint("%s is not returning redirect (302): %s" % (url, e)) - code = tc.browser.get_code() - if code == 502: - is_maint = self.check_maint() - if is_maint: - dprint("Galaxy is down, but a maint file was found, so not sending alert") - sys.exit(0) - else: - sys.exit("Galaxy is down (code 502)") - return(False) - - # checks for a maint file - def check_maint(self): - if self.maint is None: - # dprint( "Warning: unable to check maint file for %s" % self.server ) - return(False) - try: - self.get(self.maint) - return(True) - except twill.errors.TwillAssertionError: - return(False) - - def login(self, user, pw): - self.get("/user/login") - tc.fv("1", "email", user) - tc.fv("1", "password", pw) - tc.submit("Login") - tc.code(200) - if len(tc.get_browser().get_all_forms()) > 0: - # uh ohs, fail - p = userParser() - p.feed(tc.browser.get_html()) - if p.no_user: - dprint("user does not exist, will try creating") - self.create_user(user, pw) - elif p.bad_pw: - raise Exception("Password is incorrect") - else: - raise Exception("Unknown error logging in") - tc.save_cookies(self.cookie_jar) - - def create_user(self, user, pw): - self.get("/user/create") - tc.fv("1", "email", user) - tc.fv("1", "password", pw) - tc.fv("1", "confirm", pw) - tc.submit("Submit") - tc.code(200) - if len(tc.get_browser().get_all_forms()) > 0: - p = userParser() - p.feed(tc.browser.get_html()) - if p.already_exists: - raise Exception('The user you were trying to create already exists') - - def upload(self, file): - self.get("/tool_runner/index?tool_id=upload1") - tc.fv("1", "file_type", "bed") - tc.formfile("1", "file_data", file) - tc.submit("runtool_btn") - tc.code(200) - - def runtool(self): - self.get("/tool_runner/index?tool_id=%s" % self.tool) - for k, v in self.tool_opts.items(): - tc.fv("1", k, v) - tc.submit("runtool_btn") - tc.code(200) - - def wait(self): - sleep_amount = 1 - count = 0 - maxiter = 16 - while count < maxiter: - count += 1 - self.get("/root/history") - page = tc.browser.get_html() - if page.find('') > -1: - time.sleep(sleep_amount) - sleep_amount += 1 - else: - break - if count == maxiter: - raise Exception("Tool never finished") - - def check_status(self): - self.get("/root/history") - p = historyParser() - p.feed(tc.browser.get_html()) - if p.status != "ok": - raise Exception("JOB %s NOT OK: %s" % (p.id, p.status)) - self.id = p.id - self.status = p.status - # return((p.id, p.status)) - - def diff(self): - self.get("/datasets/%s/display/display?to_ext=bed" % self.id) - data = tc.browser.get_html() - tmp = tempfile.mkstemp() - dprint("tmp file: %s" % tmp[1]) - tmpfh = os.fdopen(tmp[0], 'w') - tmpfh.write(data) - tmpfh.close() - if filecmp.cmp(tmp[1], self.check_file): - dprint("Tool output is as expected") - else: - if not debug: - os.remove(tmp[1]) - raise Exception("Tool output differs from expected") - if not debug: - os.remove(tmp[1]) - - def delete_datasets(self): - self.get("/root/history") - p = didParser() - p.feed(tc.browser.get_html()) - dids = p.dids - for did in dids: - self.get("/datasets/%s/delete" % did) - - def check_if_logged_in(self): - self.get("/user?cntrller=user") - p = loggedinParser() - p.feed(tc.browser.get_html()) - return p.logged_in - - -class userParser(htmllib.HTMLParser): - def __init__(self): - htmllib.HTMLParser.__init__(self, formatter.NullFormatter()) - self.in_span = False - self.in_div = False - self.no_user = False - self.bad_pw = False - self.already_exists = False - - def start_span(self, attrs): - self.in_span = True - - def start_div(self, attrs): - self.in_div = True - - def end_span(self): - self.in_span = False - - def end_div(self): - self.in_div = False - - def handle_data(self, data): - if self.in_span or self.in_div: - if data == "No such user (please note that login is case sensitive)": - self.no_user = True - elif data == "Invalid password": - self.bad_pw = True - elif data == "User with that email already exists": - self.already_exists = True - - -class historyParser(htmllib.HTMLParser): - def __init__(self): - htmllib.HTMLParser.__init__(self, formatter.NullFormatter()) - self.status = None - self.id = None - - def start_div(self, attrs): - # find the top history item - for i in attrs: - if i[0] == "class" and i[1].startswith("historyItemWrapper historyItem historyItem-"): - self.status = i[1].rsplit("historyItemWrapper historyItem historyItem-", 1)[1] - dprint("status: %s" % self.status) - if i[0] == "id" and i[1].startswith("historyItem-"): - self.id = i[1].rsplit("historyItem-", 1)[1] - dprint("id: %s" % self.id) - if self.status is not None: - self.reset() - - -class didParser(htmllib.HTMLParser): - def __init__(self): - htmllib.HTMLParser.__init__(self, formatter.NullFormatter()) - self.dids = [] - - def start_div(self, attrs): - for i in attrs: - if i[0] == "id" and i[1].startswith("historyItemContainer-"): - self.dids.append(i[1].rsplit("historyItemContainer-", 1)[1]) - dprint("got a dataset id: %s" % self.dids[-1]) - - -class loggedinParser(htmllib.HTMLParser): - def __init__(self): - htmllib.HTMLParser.__init__(self, formatter.NullFormatter()) - self.in_p = False - self.logged_in = False - - def start_p(self, attrs): - self.in_p = True - - def end_p(self): - self.in_p = False - - def handle_data(self, data): - if self.in_p: - if data == "You are currently not logged in.": - self.logged_in = False - elif data.startswith("You are currently logged in as "): - self.logged_in = True - - -def dprint(str): - if debug: - print(str) - - -if __name__ == "__main__": - dprint("checking %s" % server) - - b = Browser() - - # login (or not) - if b.check_if_logged_in(): - dprint("we are already logged in (via cookies), hooray!") - else: - dprint("not logged in... logging in") - b.login(username, password) - - for tool, params in tools.items(): - - check_file = "" - - # make sure history and state is clean - b.reset() - b.tool = tool - - # get all the tool run conditions - for dict in params: - for k, v in dict.items(): - if k == 'inputs': - for file in v: - b.upload(file) - elif k == 'check_file': - b.check_file = v - elif k == 'tool_run_options': - b.tool_opts = v - else: - raise Exception("Unknown key in tools dict: %s" % k) - - b.runtool() - b.wait() - b.check_status() - b.diff() - b.delete_datasets() - - # by this point, everything else has succeeded. there should be no maint. - is_maint = b.check_maint() - if is_maint: - sys.exit("Galaxy is up and fully functional, but a maint file is in place.") - - sys.exit(0) diff --git a/scripts/common_startup.sh b/scripts/common_startup.sh index 1c85bb8cb3a..909dd28d664 100755 --- a/scripts/common_startup.sh +++ b/scripts/common_startup.sh @@ -69,7 +69,7 @@ if [ $COPY_SAMPLE_FILES -eq 1 ]; then # Create any missing config/location files for sample in $SAMPLES; do file=${sample%.sample} - if [ ! -f "$file" -a -f "$sample" ]; then + if [ ! -f "$file" ] && [ -f "$sample" ]; then echo "Initializing $file from $(basename "$sample")" cp "$sample" "$file" fi @@ -101,7 +101,7 @@ fi : ${GALAXY_VIRTUAL_ENV:=.venv} # GALAXY_CONDA_ENV is not set here because we don't want to execute the Galaxy version check if we don't need to -if [ $SET_VENV -eq 1 -a $CREATE_VENV -eq 1 ]; then +if [ $SET_VENV -eq 1 ] && [ $CREATE_VENV -eq 1 ]; then if [ ! -d "$GALAXY_VIRTUAL_ENV" ]; then # Locate `conda` and set $CONDA_EXE (if needed). setup_python calls this # as well, but in this case we need it done beforehand. @@ -164,13 +164,13 @@ fi # activate virtualenv or conda env, sets $GALAXY_VIRTUAL_ENV and $GALAXY_CONDA_ENV setup_python -if [ $SET_VENV -eq 1 -a -z "$VIRTUAL_ENV" -a -z "$CONDA_DEFAULT_ENV" ]; then +if [ $SET_VENV -eq 1 ] && [ -z "$VIRTUAL_ENV" ] && [ -z "$CONDA_DEFAULT_ENV" ]; then echo "ERROR: A virtualenv cannot be found. Please create a virtualenv in $GALAXY_VIRTUAL_ENV, or activate one." exit 1 fi # this shouldn't happen, but check just in case -if [ -z "$VIRTUAL_ENV" ] && [ "$CONDA_DEFAULT_ENV" = "base" -o "$CONDA_DEFAULT_ENV" = "root" ]; then +if [ -z "$VIRTUAL_ENV" ] && [ "$CONDA_DEFAULT_ENV" = "base" ] || [ "$CONDA_DEFAULT_ENV" = "root" ]; then echo "ERROR: Conda is in 'base' environment, refusing to continue" exit 1 fi @@ -187,18 +187,17 @@ if [ $DEV_WHEELS -eq 1 ]; then requirement_args="$requirement_args -r ${GALAXY_DEV_REQUIREMENTS}" fi -PIP_PROGRESS_BAR= -[ "$CI" = "true" ] && PIP_PROGRESS_BAR='--progress-bar off' +[ "$CI" = 'true' ] && export PIP_PROGRESS_BAR=off if [ $FETCH_WHEELS -eq 1 ]; then - pip install $requirement_args --index-url "${GALAXY_WHEELS_INDEX_URL}" --extra-index-url "${PYPI_INDEX_URL}" ${PIP_PROGRESS_BAR} + pip install $requirement_args --index-url "${GALAXY_WHEELS_INDEX_URL}" --extra-index-url "${PYPI_INDEX_URL}" GALAXY_CONDITIONAL_DEPENDENCIES=$(PYTHONPATH=lib python -c "from __future__ import print_function; import galaxy.dependencies; print('\n'.join(galaxy.dependencies.optional('$GALAXY_CONFIG_FILE')))") if [ -n "$GALAXY_CONDITIONAL_DEPENDENCIES" ]; then if pip list --format=columns | grep "psycopg2[\(\ ]*2.7.3" > /dev/null; then echo "An older version of psycopg2 (non-binary, version 2.7.3) has been detected. Galaxy now uses psycopg2-binary, which will be installed after removing psycopg2." pip uninstall -y psycopg2 psycopg2-binary fi - echo "$GALAXY_CONDITIONAL_DEPENDENCIES" | pip install -r /dev/stdin --index-url "${GALAXY_WHEELS_INDEX_URL}" --extra-index-url "${PYPI_INDEX_URL}" ${PIP_PROGRESS_BAR} + echo "$GALAXY_CONDITIONAL_DEPENDENCIES" | pip install -r /dev/stdin --index-url "${GALAXY_WHEELS_INDEX_URL}" --extra-index-url "${PYPI_INDEX_URL}" fi fi @@ -212,7 +211,7 @@ if [ $SKIP_CLIENT_BUILD -eq 0 ]; then SKIP_CLIENT_BUILD=1 else # Check if anything has changed in client/ since the last build - if git diff --quiet $(cat static/client_build_hash.txt) -- client/; then + if git diff --quiet "$(cat static/client_build_hash.txt)" -- client/; then echo "The Galaxy client build is up to date and will not be rebuilt at this time." SKIP_CLIENT_BUILD=1 else @@ -228,14 +227,14 @@ fi # Install node if not installed if [ -n "$VIRTUAL_ENV" ]; then - if ! in_venv "$(command -v node)" || [ "$(node --version)" != "v$NODE_VERSION" ]; then + if ! in_venv "$(command -v node)" || [ "$(node --version)" != "v${NODE_VERSION}" ]; then echo "Installing node into $VIRTUAL_ENV with nodeenv." - nodeenv -n $NODE_VERSION -p + nodeenv -n "$NODE_VERSION" -p fi -elif [ -n "$CONDA_DEFAULT_ENV" -a -n "$CONDA_EXE" ]; then +elif [ -n "$CONDA_DEFAULT_ENV" ] && [ -n "$CONDA_EXE" ]; then if ! in_conda_env "$(command -v node)"; then echo "Installing node into '$CONDA_DEFAULT_ENV' Conda environment with conda." - $CONDA_EXE install --yes --override-channels --channel conda-forge --channel defaults --name $CONDA_DEFAULT_ENV node=$NODE_VERSION + $CONDA_EXE install --yes --override-channels --channel conda-forge --channel defaults --name "$CONDA_DEFAULT_ENV" node="$NODE_VERSION" fi fi @@ -247,10 +246,10 @@ if [ $SKIP_CLIENT_BUILD -eq 0 ]; then echo "Installing yarn into $VIRTUAL_ENV with npm." npm install --global yarn fi - elif [ -n "$CONDA_DEFAULT_ENV" -a -n "$CONDA_EXE" ]; then + elif [ -n "$CONDA_DEFAULT_ENV" ] && [ -n "$CONDA_EXE" ]; then if ! in_conda_env "$(command -v yarn)"; then echo "Installing yarn into '$CONDA_DEFAULT_ENV' Conda environment with conda." - $CONDA_EXE install --yes --override-channels --channel conda-forge --channel defaults --name $CONDA_DEFAULT_ENV yarn + $CONDA_EXE install --yes --override-channels --channel conda-forge --channel defaults --name "$CONDA_DEFAULT_ENV" yarn fi else echo "WARNING: Galaxy client build needed but there is no virtualenv enabled. Build may fail." diff --git a/templates/webapps/galaxy/admin/center.mako b/templates/webapps/galaxy/admin/center.mako index 5a8bd5df23e..9ca501692e0 100644 --- a/templates/webapps/galaxy/admin/center.mako +++ b/templates/webapps/galaxy/admin/center.mako @@ -11,41 +11,41 @@ Please visit the Galax

    Server

    User Management

    @@ -53,7 +53,7 @@ Please visit the Galax %endif diff --git a/test/api/test_pages.py b/test/api/test_pages.py index 4126fa0a46e..8b4a19adc0f 100644 --- a/test/api/test_pages.py +++ b/test/api/test_pages.py @@ -97,7 +97,7 @@ class PageApiTestCase(BasePageApiTestCase): page_response = self._post("pages", page_request) self._assert_status_code_is(page_response, 400) self._assert_error_code_is(page_response, error_codes.USER_REQUEST_INVALID_PARAMETER) - assert "embedded HTML content" in page_response.content + assert "embedded HTML content" in page_response.text def test_show(self): response_json = self._create_valid_page_with_slug("pagetoshow") diff --git a/test/api/test_tools_upload.py b/test/api/test_tools_upload.py index b1ffc6f307a..cd6415c497a 100644 --- a/test/api/test_tools_upload.py +++ b/test/api/test_tools_upload.py @@ -12,7 +12,7 @@ from base.populators import ( uses_test_history, ) -from galaxy.tools.verify.test_data import TestDataResolver +from galaxy.tool_util.verify.test_data import TestDataResolver class ToolsUploadTestCase(api.ApiTestCase): diff --git a/test/base/driver_util.py b/test/base/driver_util.py index 92587939904..38a9745a50d 100644 --- a/test/base/driver_util.py +++ b/test/base/driver_util.py @@ -35,7 +35,7 @@ from galaxy.app import UniverseApplication as GalaxyUniverseApplication from galaxy.config import LOGGING_CONFIG_DEFAULT from galaxy.model import mapping from galaxy.model.tool_shed_install import mapping as toolshed_mapping -from galaxy.tools.verify.interactor import GalaxyInteractorApi, verify_tool +from galaxy.tool_util.verify.interactor import GalaxyInteractorApi, verify_tool from galaxy.util import asbool, download_to_file from galaxy.util.properties import load_app_properties from galaxy.web import buildapp @@ -961,6 +961,11 @@ class GalaxyTestDriver(TestDriver): galaxy_db_path, **setup_galaxy_config_kwds ) + + isolate_galaxy_config = getattr(config_object, "isolate_galaxy_config", False) + if isolate_galaxy_config: + galaxy_config["config_dir"] = tempdir + self._saved_galaxy_config = galaxy_config if galaxy_config is not None: diff --git a/test/base/integration_util.py b/test/base/integration_util.py index 24724825829..37a16a33383 100644 --- a/test/base/integration_util.py +++ b/test/base/integration_util.py @@ -10,7 +10,7 @@ from unittest import skip, SkipTest, TestCase import pytest from galaxy.tool_util.deps.commands import which -from galaxy.tools.verify.test_data import TestDataResolver +from galaxy.tool_util.verify.test_data import TestDataResolver from .api import UsesApiTestCaseMixin from .driver_util import GalaxyTestDriver @@ -60,6 +60,10 @@ class IntegrationInstance(UsesApiTestCaseMixin): # Subclasses can override this to force uwsgi for tests. require_uwsgi = False + # Don't pull in default configs for un-configured things from Galaxy's + # config directory and such. + isolate_galaxy_config = True + @classmethod def setUpClass(cls): """Configure and start Galaxy for a test.""" diff --git a/test/base/interactor.py b/test/base/interactor.py index 7ccb068cad9..b8166375302 100644 --- a/test/base/interactor.py +++ b/test/base/interactor.py @@ -1,4 +1,4 @@ -from galaxy.tools.verify.interactor import GalaxyInteractorApi +from galaxy.tool_util.verify.interactor import GalaxyInteractorApi class TestCaseGalaxyInteractor(GalaxyInteractorApi): diff --git a/test/base/populators.py b/test/base/populators.py index 0ee8b19d416..46169a4d715 100644 --- a/test/base/populators.py +++ b/test/base/populators.py @@ -23,7 +23,7 @@ from gxformat2 import ( from pkg_resources import resource_string from six import StringIO -from galaxy.tools.verify.test_data import TestDataResolver +from galaxy.tool_util.verify.test_data import TestDataResolver from galaxy.util import unicodify from . import api_asserts diff --git a/test/base/testcase.py b/test/base/testcase.py index c73824250f6..3e063148fc0 100644 --- a/test/base/testcase.py +++ b/test/base/testcase.py @@ -5,7 +5,7 @@ import os import unittest from galaxy.security import idencoding -from galaxy.tools.verify.test_data import TestDataResolver +from galaxy.tool_util.verify.test_data import TestDataResolver from .driver_util import GalaxyTestDriver, setup_keep_outdir, target_url_parts log = logging.getLogger(__name__) diff --git a/test/functional/test_toolbox.py b/test/functional/test_toolbox.py index 7531e68b4a4..6dd7a3cda58 100644 --- a/test/functional/test_toolbox.py +++ b/test/functional/test_toolbox.py @@ -11,8 +11,8 @@ except ImportError: from base.driver_util import setup_keep_outdir, target_url_parts from base.instrument import register_job_data from base.testcase import FunctionalTestCase # noqa: I100,I201,I202 +from galaxy.tool_util.verify.interactor import GalaxyInteractorApi, verify_tool # noqa: I201 from galaxy.tools import DataManagerTool # noqa: I201 -from galaxy.tools.verify.interactor import GalaxyInteractorApi, verify_tool # noqa: I201 log = logging.getLogger(__name__) diff --git a/test/integration/test_kubernetes_runner.py b/test/integration/test_kubernetes_runner.py index 6546ac3a20a..2880f8e0e46 100644 --- a/test/integration/test_kubernetes_runner.py +++ b/test/integration/test_kubernetes_runner.py @@ -90,6 +90,12 @@ def job_config(jobs_directory): $k8s_config_path gx-short-id + + jobs-directory-claim:$jobs_directory,tool-directory-claim:$tool_directory + $k8s_config_path + gx-short-id + 10 + @@ -99,11 +105,19 @@ def job_config(jobs_directory): busybox:ubuntu-14.04 42 + + 1.9 + 10M + true + busybox:ubuntu-14.04 + 42 + + """) @@ -255,3 +269,19 @@ class BaseKubernetesIntegrationTestCase(BaseJobEnvironmentIntegrationTestCase, M MEM = '10' MEM_PER_SLOT = '5' assert [CPU, MEM, MEM_PER_SLOT] == dataset_content.split('\n'), dataset_content + + @skip_without_tool('create_2') + def test_walltime_limit(self): + running_response = self.dataset_populator.run_tool( + 'create_2', + {'sleep_time': 60}, + self.history_id, + assert_ok=False + ) + result = self.dataset_populator.wait_for_tool_run(run_response=running_response, + history_id=self.history_id, + assert_ok=False).json() + details = self.dataset_populator.get_job_details(result['jobs'][0]['id'], full=True).json() + assert details['state'] == 'error' + hda_details = self.dataset_populator.get_history_dataset_details(self.history_id, assert_ok=False) + assert hda_details['misc_info'] == 'Job was active longer than specified deadline' diff --git a/test/integration/test_pulsar_embedded_copy_working.py b/test/integration/test_pulsar_embedded_copy_working.py new file mode 100644 index 00000000000..814d0086aa5 --- /dev/null +++ b/test/integration/test_pulsar_embedded_copy_working.py @@ -0,0 +1,24 @@ +"""Integration tests for the Pulsar embedded runner with outputs to working directory.""" + +import os + +from base import integration_util + +SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__)) +EMBEDDED_PULSAR_JOB_CONFIG_FILE = os.path.join(SCRIPT_DIRECTORY, "embedded_pulsar_job_conf.yml") + + +class EmbeddedCopyWorkingPulsarIntegrationInstance(integration_util.IntegrationInstance): + """Describe a Galaxy test instance with embedded pulsar configured.""" + + framework_tool_and_types = True + + @classmethod + def handle_galaxy_config_kwds(cls, config): + config["job_config_file"] = EMBEDDED_PULSAR_JOB_CONFIG_FILE + config["outputs_to_working_directory"] = True + + +instance = integration_util.integration_module_instance(EmbeddedCopyWorkingPulsarIntegrationInstance) + +test_tools = integration_util.integration_tool_runner(["output_format"]) diff --git a/test/integration/test_pulsar_embedded_metadata.py b/test/integration/test_pulsar_embedded_metadata.py index 5fcafe73dd9..66412144021 100644 --- a/test/integration/test_pulsar_embedded_metadata.py +++ b/test/integration/test_pulsar_embedded_metadata.py @@ -1,4 +1,4 @@ -"""Integration tests for the Pulsar embedded runner.""" +"""Integration tests for the Pulsar embedded runner with remote metadata.""" import os @@ -8,7 +8,7 @@ SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__)) EMBEDDED_PULSAR_JOB_CONFIG_FILE = os.path.join(SCRIPT_DIRECTORY, "embedded_pulsar_metadata_job_conf.yml") -class EmbeddedPulsarIntegrationInstance(integration_util.IntegrationInstance): +class EmbeddedMetadataPulsarIntegrationInstance(integration_util.IntegrationInstance): """Describe a Galaxy test instance with embedded pulsar configured.""" framework_tool_and_types = True @@ -18,6 +18,6 @@ class EmbeddedPulsarIntegrationInstance(integration_util.IntegrationInstance): config["job_config_file"] = EMBEDDED_PULSAR_JOB_CONFIG_FILE -instance = integration_util.integration_module_instance(EmbeddedPulsarIntegrationInstance) +instance = integration_util.integration_module_instance(EmbeddedMetadataPulsarIntegrationInstance) test_tools = integration_util.integration_tool_runner(["simple_constructs"]) diff --git a/test/selenium_tests/framework.py b/test/selenium_tests/framework.py index 853c2a04ad1..3ad89b820c5 100644 --- a/test/selenium_tests/framework.py +++ b/test/selenium_tests/framework.py @@ -24,10 +24,10 @@ from base import populators # noqa: I100,I202 from base.api import UsesApiTestCaseMixin # noqa: I100 from base.driver_util import classproperty, DEFAULT_WEB_HOST, get_ip_address # noqa: I100 from base.testcase import FunctionalTestCase # noqa: I100 -from galaxy_selenium import ( # noqa: I100,I201 +from galaxy.selenium import ( # noqa: I100,I201 driver_factory, ) -from galaxy_selenium.navigates_galaxy import ( # noqa: I100 +from galaxy.selenium.navigates_galaxy import ( # noqa: I100 NavigatesGalaxy, retry_during_transitions ) diff --git a/test/selenium_tests/test_navigates_galaxy.py b/test/selenium_tests/test_navigates_galaxy.py index 5fa9c3355ff..c7906791ac2 100644 --- a/test/selenium_tests/test_navigates_galaxy.py +++ b/test/selenium_tests/test_navigates_galaxy.py @@ -1,8 +1,7 @@ -from galaxy_selenium.navigates_galaxy import ( +from galaxy.selenium.navigates_galaxy import ( exception_indicates_not_clickable, exception_seems_to_indicate_transition, ) - from .framework import ( selenium_test, SeleniumTestCase, diff --git a/test/selenium_tests/test_tool_form.py b/test/selenium_tests/test_tool_form.py index cf2c909a3da..f8aef81abf2 100644 --- a/test/selenium_tests/test_tool_form.py +++ b/test/selenium_tests/test_tool_form.py @@ -2,8 +2,8 @@ import json from base import rules_test_data from base.populators import flakey, load_data_dict -from galaxy_selenium.navigates_galaxy import retry_call_during_transitions +from galaxy.selenium.navigates_galaxy import retry_call_during_transitions from .framework import ( managed_history, retry_assertion_during_transitions, diff --git a/test/unit/test_compression_util.py b/test/unit/test_compression_util.py index 582190d5def..c35c8f5ce95 100644 --- a/test/unit/test_compression_util.py +++ b/test/unit/test_compression_util.py @@ -2,7 +2,12 @@ import shutil import tempfile import unittest -from galaxy.util.compression_utils import CompressedFile +import six + +from galaxy.util.compression_utils import ( + CompressedFile, + get_fileobj_raw +) class CompressionUtilTestCase(unittest.TestCase): @@ -16,6 +21,20 @@ class CompressionUtilTestCase(unittest.TestCase): self.assert_safety("test-data/safetar_with_symlink.tar", True) self.assert_safety("test-data/safe_relative_symlink.tar", True) + def test_get_fileobj_raw(self): + self.assert_format_detected("test-data/4.bed.zip", "zip") + self.assert_format_detected( + "test-data/4.bed.zip", None, ["bz2", "gzip"] + ) + self.assert_format_detected("test-data/4.bed.gz", "gzip") + self.assert_format_detected( + "test-data/4.bed.gz", None, ["bz2", "zip"] + ) + self.assert_format_detected("test-data/4.bed.bz2", "bz2") + self.assert_format_detected( + "test-data/4.bed.bz2", None, ["gzip", "zip"] + ) + def assert_safety(self, path, expected_to_be_safe): temp_dir = tempfile.mkdtemp() try: @@ -26,3 +45,13 @@ class CompressionUtilTestCase(unittest.TestCase): CompressedFile(path).extract(temp_dir) finally: shutil.rmtree(temp_dir, ignore_errors=True) + + def assert_format_detected(self, path, expected_fmt, allowed_fmts=None): + for mode in ['r', 'rb', 'rt', 'U']: + if 'b' in mode: + expected_type = six.binary_type + else: + expected_type = six.text_type + fmt, fh = get_fileobj_raw(path, mode, allowed_fmts) + assert fmt == expected_fmt + assert isinstance(fh.read(0), expected_type) diff --git a/test/unit/test_verify.py b/test/unit/test_verify.py index 8de580cec5b..54a234590ee 100644 --- a/test/unit/test_verify.py +++ b/test/unit/test_verify.py @@ -4,7 +4,7 @@ import tempfile import pytest -from galaxy.tools.verify import ( +from galaxy.tool_util.verify import ( files_contains, files_diff, files_re_match, diff --git a/test/unit/tool_util/__init__.py b/test/unit/tool_util/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/unit/tool_util/sample_data.py b/test/unit/tool_util/sample_data.py new file mode 120000 index 00000000000..3b4ed484f80 --- /dev/null +++ b/test/unit/tool_util/sample_data.py @@ -0,0 +1 @@ +../unittest_utils/sample_data.py \ No newline at end of file diff --git a/test/unit/tools/test_conda_resolution.py b/test/unit/tool_util/test_conda_resolution.py similarity index 100% rename from test/unit/tools/test_conda_resolution.py rename to test/unit/tool_util/test_conda_resolution.py diff --git a/test/unit/tools/test_output_checker.py b/test/unit/tool_util/test_output_checker.py similarity index 100% rename from test/unit/tools/test_output_checker.py rename to test/unit/tool_util/test_output_checker.py diff --git a/test/unit/tools/test_parsing.py b/test/unit/tool_util/test_parsing.py similarity index 100% rename from test/unit/tools/test_parsing.py rename to test/unit/tool_util/test_parsing.py diff --git a/test/unit/tools/test_tool_deps.py b/test/unit/tool_util/test_tool_deps.py similarity index 97% rename from test/unit/tools/test_tool_deps.py rename to test/unit/tool_util/test_tool_deps.py index c28818bd526..1f15d880a0c 100644 --- a/test/unit/tools/test_tool_deps.py +++ b/test/unit/tool_util/test_tool_deps.py @@ -3,7 +3,6 @@ import tempfile from contextlib import contextmanager from os import ( chmod, - environ, makedirs, stat, symlink, @@ -22,6 +21,7 @@ from galaxy.tool_util.deps.resolvers.galaxy_packages import GalaxyPackageDepende from galaxy.tool_util.deps.resolvers.lmod import LmodDependency, LmodDependencyResolver from galaxy.tool_util.deps.resolvers.modules import ModuleDependency, ModuleDependencyResolver from galaxy.util.bunch import Bunch +from .util import modify_environ # If true, test created DependencyManager objects by serializing out to json and re-constituting. ROUND_TRIP_TEST_DEPENDENCY_MANAGER_SERIALIZATION = True @@ -582,7 +582,7 @@ def test_config_modulepath(): def test_config_MODULEPATH(): # Test reads and splits MODULEPATH if modulepath is not specified. - with __environ({"MODULEPATH": "/opt/modules/modulefiles:/usr/local/modules/modulefiles"}): + with modify_environ({"MODULEPATH": "/opt/modules/modulefiles:/usr/local/modules/modulefiles"}): with __parse_resolvers(''' @@ -593,7 +593,7 @@ def test_config_MODULEPATH(): def test_config_MODULESHOME(): # Test fallbacks to read MODULESHOME if modulepath is not specified and # neither is MODULEPATH. - with __environ({"MODULESHOME": "/opt/modules"}, remove="MODULEPATH"): + with modify_environ({"MODULESHOME": "/opt/modules"}, keys_to_remove=["MODULEPATH"]): with __parse_resolvers(''' @@ -718,28 +718,6 @@ def _first_conda_resolver_options(dm): return [r for r in dm.to_dict()["resolvers"] if r["resolver_type"] == "conda"][0] -@contextmanager -def __environ(values, remove=[]): - """ - Modify the environment for a test, adding/updating values in dict `values` and - removing any environment variables mentioned in list `remove`. - """ - new_keys = set(environ.keys()) - set(values.keys()) - old_environ = environ.copy() - try: - environ.update(values) - for to_remove in remove: - try: - del environ[remove] - except KeyError: - pass - yield - finally: - environ.update(old_environ) - for key in new_keys: - del environ[key] - - @contextmanager def __parse_resolvers(file_content, extension=".xml"): with __dependency_manager(file_content, extension=extension) as dm: diff --git a/test/unit/tools/test_tool_loader.py b/test/unit/tool_util/test_tool_loader.py similarity index 94% rename from test/unit/tools/test_tool_loader.py rename to test/unit/tool_util/test_tool_loader.py index f07c1e8c2b5..ce644a510ef 100644 --- a/test/unit/tools/test_tool_loader.py +++ b/test/unit/tool_util/test_tool_loader.py @@ -1,27 +1,10 @@ import os from shutil import rmtree -from string import Template from tempfile import mkdtemp from galaxy.tool_util.loader import load_tool, template_macro_params from galaxy.util import parse_xml - - -SIMPLE_TOOL_WITH_MACRO = """ - - - external.xml - -""" - -SIMPLE_MACRO = Template(""" - - $tool_version - - - - -""") +from .sample_data import SIMPLE_MACRO, SIMPLE_TOOL_WITH_MACRO def test_loader(): diff --git a/test/unit/tool_util/test_util.py b/test/unit/tool_util/test_util.py new file mode 100644 index 00000000000..e2778fbf74e --- /dev/null +++ b/test/unit/tool_util/test_util.py @@ -0,0 +1,86 @@ +from os import environ + +import pytest + +from .util import modify_environ + + +@pytest.fixture +def load_keyval(request): + """ + Create key/value pair and load it into os.environ. Delete on teardown. + """ + keys = [] # preserve keys for teardown + + def _load_keyval(key='a unique key', val='a value'): + # If this is called twice with default values within the same test function, + # it will raise a KeyError. This is intentional: os.environ cannot have duplicate keys. + keys.append(key) + environ[key] = val + return key, val + + def _teardown(): + for k in keys: + del environ[k] + + request.addfinalizer(_teardown) + return _load_keyval + + +def test_modify_environ__restore(load_keyval): + key, val = load_keyval() + with modify_environ({}): + assert environ[key] == val # key/val unchanged + assert environ[key] == val # key/val unchanged + + +def test_modify_environ__add_and_restore(load_keyval): + key1, val1 = load_keyval() + key2, val2 = 'key to add', 'value to add' + to_update = {key2: val2} + + assert key2 not in environ # ensure key to add does not exist + with modify_environ(to_update): + assert environ[key1] == val1 # key/val unchanged + assert environ[key2] == val2 # new key/val added + assert environ[key1] == val1 # key/val unchanged + assert key2 not in environ # new key removed + + +def test_modify_environ__update_and_restore(load_keyval): + key1, val1 = load_keyval() + key2, val2 = load_keyval('key to update', 'value to update') + val2_updated = 'updated' + to_update = {key2: val2_updated} + + with modify_environ(to_update): + assert environ[key1] == val1 # key/val unchanged + assert environ[key2] == val2_updated # value updated + assert environ[key1] == val1 # key/val unchanged + assert environ[key2] == val2 # value restored + + +def test_modify_environ__remove_and_restore(load_keyval): + key1, val1 = load_keyval() + key2, val2 = load_keyval('key to remove', 'value to remove') + to_update = {} + to_remove = [key2] + + with modify_environ(to_update, to_remove): + assert environ[key1] == val1 # key/val unchanged + assert key2 not in environ # key removed + assert environ[key1] == val1 # key/val unchanged + assert environ[key2] == val2 # key/value restored + + +def test_modify_environ__remove_nonexistant_key(load_keyval): + # Test that removing wrong key does not raise an error + key1, val1 = load_keyval() + key_nonexistant = 'no such key' + to_update = {} + to_remove = [key_nonexistant] + + assert key_nonexistant not in environ # ensure key to remove does not exist + with modify_environ(to_update, to_remove): + assert environ[key1] == val1 # key/val unchanged + assert environ[key1] == val1 # key/val unchanged diff --git a/test/unit/tool_util/util.py b/test/unit/tool_util/util.py new file mode 100644 index 00000000000..2bc0340711c --- /dev/null +++ b/test/unit/tool_util/util.py @@ -0,0 +1,22 @@ +from contextlib import contextmanager +from os import environ + + +@contextmanager +def modify_environ(values, keys_to_remove=None): + """ + Modify the environment for a test, adding/updating values in dict `values` and + removing any environment variables mentioned in list `keys_to_remove`. + """ + old_environ = environ.copy() + try: + if values: + environ.update(values) + if keys_to_remove: + for key in keys_to_remove: + if key in environ: + del environ[key] + yield + finally: + environ.clear() + environ.update(old_environ) diff --git a/test/unit/tools/test_column_parameters.py b/test/unit/tools/test_column_parameters.py index 19fc9ea4029..4cbb39d131f 100644 --- a/test/unit/tools/test_column_parameters.py +++ b/test/unit/tools/test_column_parameters.py @@ -3,7 +3,7 @@ test_select_parameters.py. """ from galaxy import model from galaxy.util import bunch -from .test_parameter_parsing import BaseParameterTestCase +from .util import BaseParameterTestCase from ..tools_support import datatypes_registry diff --git a/test/unit/tools/test_data_parameters.py b/test/unit/tools/test_data_parameters.py index 6d18fe3458a..a89425c03b6 100644 --- a/test/unit/tools/test_data_parameters.py +++ b/test/unit/tools/test_data_parameters.py @@ -1,5 +1,5 @@ from galaxy import model -from .test_parameter_parsing import BaseParameterTestCase +from .util import BaseParameterTestCase from ..unittest_utils import galaxy_mock diff --git a/test/unit/tools/test_parameter_parsing.py b/test/unit/tools/test_parameter_parsing.py index f858ca00e40..bdf9c9de65d 100644 --- a/test/unit/tools/test_parameter_parsing.py +++ b/test/unit/tools/test_parameter_parsing.py @@ -1,11 +1,7 @@ from unittest import TestCase -from xml.etree.ElementTree import XML -from galaxy import model -from galaxy.tools.parameters import basic from galaxy.tools.parameters.meta import process_key -from galaxy.util import bunch -from ..tools_support import UsesApp +from .util import BaseParameterTestCase class ProcessKeyTestCase(TestCase): @@ -46,22 +42,6 @@ class ProcessKeyTestCase(TestCase): self.assertEqual(nested_dict, expected_dict) -class BaseParameterTestCase(TestCase, UsesApp): - - def setUp(self): - self.setup_app() - self.mock_tool = bunch.Bunch( - app=self.app, - tool_type="default", - valid_input_states=model.Dataset.valid_input_states, - ) - - def _parameter_for(self, **kwds): - content = kwds["xml"] - param_xml = XML(content) - return basic.ToolParameter.build(self.mock_tool, param_xml) - - class ParameterParsingTestCase(BaseParameterTestCase): """ Test the parsing of XML for most parameter types - in many ways these are not very good tests since they break the abstraction diff --git a/test/unit/tools/test_select_parameters.py b/test/unit/tools/test_select_parameters.py index 28cfe50e33d..f00e64d6f40 100644 --- a/test/unit/tools/test_select_parameters.py +++ b/test/unit/tools/test_select_parameters.py @@ -1,7 +1,7 @@ from galaxy import model from galaxy.tools.parameters import basic from galaxy.util import bunch -from .test_parameter_parsing import BaseParameterTestCase +from .util import BaseParameterTestCase class SelectToolParameterTestCase(BaseParameterTestCase): diff --git a/test/unit/tools/test_toolbox.py b/test/unit/tools/test_toolbox.py index e592f8e43d2..1073b5145cb 100644 --- a/test/unit/tools/test_toolbox.py +++ b/test/unit/tools/test_toolbox.py @@ -14,12 +14,9 @@ from galaxy.model import tool_shed_install from galaxy.model.tool_shed_install import mapping from galaxy.tools import ToolBox from galaxy.tools.cache import ToolCache -from .test_tool_loader import ( - SIMPLE_MACRO, - SIMPLE_TOOL_WITH_MACRO -) from .test_toolbox_filters import mock_trans from ..tools_support import UsesApp, UsesTools +from ..unittest_utils.sample_data import SIMPLE_MACRO, SIMPLE_TOOL_WITH_MACRO log = logging.getLogger(__name__) diff --git a/test/unit/tools/util.py b/test/unit/tools/util.py new file mode 100644 index 00000000000..384de1052de --- /dev/null +++ b/test/unit/tools/util.py @@ -0,0 +1,23 @@ +from unittest import TestCase +from xml.etree.ElementTree import XML + +from galaxy import model +from galaxy.tools.parameters import basic +from galaxy.util import bunch +from ..tools_support import UsesApp + + +class BaseParameterTestCase(TestCase, UsesApp): + + def setUp(self): + self.setup_app() + self.mock_tool = bunch.Bunch( + app=self.app, + tool_type="default", + valid_input_states=model.Dataset.valid_input_states, + ) + + def _parameter_for(self, **kwds): + content = kwds["xml"] + param_xml = XML(content) + return basic.ToolParameter.build(self.mock_tool, param_xml) diff --git a/test/unit/unittest_utils/sample_data.py b/test/unit/unittest_utils/sample_data.py new file mode 100644 index 00000000000..dc0bcb02093 --- /dev/null +++ b/test/unit/unittest_utils/sample_data.py @@ -0,0 +1,17 @@ +from string import Template + +SIMPLE_TOOL_WITH_MACRO = """ + + + external.xml + +""" + +SIMPLE_MACRO = Template(""" + + $tool_version + + + + +""") diff --git a/tool-data/icn3d_simple_display.loc.sample b/tool-data/icn3d_simple_display.loc.sample new file mode 100644 index 00000000000..a0d3d91277b --- /dev/null +++ b/tool-data/icn3d_simple_display.loc.sample @@ -0,0 +1,3 @@ +# Table used for listing simple iCn3D Structure Viewer servers +# +ncbi_icn3d NCBI https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?type=%(icn3d_file_type)s&url=%(icn3d_file_url_qp)s