Merge branch 'dev' of https://github.com/galaxyproject/galaxy into realtimetools

This commit is contained in:
Daniel Blankenberg
2019-08-20 13:44:44 -04:00
250 changed files with 2876 additions and 3641 deletions
+1 -1
View File
@@ -1 +1 @@
10.13.0
10.15.3
+19 -19
View File
@@ -45,8 +45,8 @@ Disabled
<div class="btn-group" role="group">
<button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="javascript:void(0)">Dropdown link</a>
<a class="dropdown-item" href="javascript:void(0)">Dropdown link</a>
</div>
</div>
</div>
@@ -58,8 +58,8 @@ Disabled
<div class="btn-group" role="group">
<button id="btnGroupDrop2" type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop2">
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="javascript:void(0)">Dropdown link</a>
<a class="dropdown-item" href="javascript:void(0)">Dropdown link</a>
</div>
</div>
</div>
@@ -71,8 +71,8 @@ Disabled
<div class="btn-group" role="group">
<button id="btnGroupDrop3" type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop3">
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="javascript:void(0)">Dropdown link</a>
<a class="dropdown-item" href="javascript:void(0)">Dropdown link</a>
</div>
</div>
</div>
@@ -84,8 +84,8 @@ Disabled
<div class="btn-group" role="group">
<button id="btnGroupDrop4" type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop4">
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="javascript:void(0)">Dropdown link</a>
<a class="dropdown-item" href="javascript:void(0)">Dropdown link</a>
</div>
</div>
</div>
@@ -105,28 +105,28 @@ Disabled
<div class="alert alert-dismissable alert-warning">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4>Warning!</h4>
<p>Best check yo self, you're not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, <a href="#" class="alert-link">vel scelerisque nisl consectetur et</a>.</p>
<p>Best check yo self, you're not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, <a href="javascript:void(0)" class="alert-link">vel scelerisque nisl consectetur et</a>.</p>
</div>
```
```vue
<div class="alert alert-dismissable alert-danger">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>Oh snap!</strong> <a href="#" class="alert-link">Change a few things up</a> and try submitting again.
<strong>Oh snap!</strong> <a href="javascript:void(0)" class="alert-link">Change a few things up</a> and try submitting again.
</div>
```
```vue
<div class="alert alert-dismissable alert-success">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>Well done!</strong> You successfully read <a href="#" class="alert-link">this important alert message</a>.
<strong>Well done!</strong> You successfully read <a href="javascript:void(0)" class="alert-link">this important alert message</a>.
</div>
```
```vue
<div class="alert alert-dismissable alert-info">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>Heads up!</strong> This <a href="#" class="alert-link">alert needs your attention</a>, but it's not super important.
<strong>Heads up!</strong> This <a href="javascript:void(0)" class="alert-link">alert needs your attention</a>, but it's not super important.
</div>
```
@@ -146,9 +146,9 @@ Disabled
```vue
<div class="">
<ul class="nav nav-pills">
<li class="active"><a href="#">Home <span class="badge">42</span></a></li>
<li><a href="#">Profile <span class="badge-pill"></span></a></li>
<li><a href="#">Messages <span class="badge-pill">3</span></a></li>
<li class="active"><a href="javascript:void(0)">Home <span class="badge">42</span></a></li>
<li><a href="javascript:void(0)">Profile <span class="badge-pill"></span></a></li>
<li><a href="javascript:void(0)">Messages <span class="badge-pill">3</span></a></li>
</ul>
</div>
```
@@ -357,8 +357,8 @@ Disabled
<li class="list-group-item">Vestibulum at eros</li>
</ul>
<div class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
<a href="javascript:void(0)" class="card-link">Card link</a>
<a href="javascript:void(0)" class="card-link">Another link</a>
</div>
<div class="card-footer text-muted">
2 days ago
@@ -369,8 +369,8 @@ Disabled
<h4 class="card-title">Card title</h4>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
<a href="javascript:void(0)" class="card-link">Card link</a>
<a href="javascript:void(0)" class="card-link">Another link</a>
</div>
</div>
</div>
+4 -4
View File
@@ -5,21 +5,21 @@
```
```vue
<a href="#" class="action-button">An anchor with .action-button</a>
<a href="javascript:void(0)" class="action-button">An anchor with .action-button</a>
```
All the crazy permutations of menu button...
```vue
<a href="#" class="menubutton">An anchor with .menu-button</a>
<a href="javascript:void(0)" class="menubutton">An anchor with .menu-button</a>
```
```vue
<a href="#" class="menubutton popup">An anchor with .menu-button.popup</a>
<a href="javascript:void(0)" class="menubutton popup">An anchor with .menu-button.popup</a>
```
```vue
<a href="#" class="menubutton popup split">
<a href="javascript:void(0)" class="menubutton popup split">
<a class="menubutton-label">An anchor with .menu-button.popup.split</a>
</a>
```
@@ -164,7 +164,7 @@ WYMeditor.editor.prototype.dialog = function(dialogType, dialogFeatures, bodyHtm
}
show_modal(
"Create Link",
`<div><div><label id='link_attribute_label'>URL <span style='float: right; font-size: 90%'><a href='#' id='set_link_id'>Create in-page anchor</a></span></label><br><input type='text' class='wym_href' value='${curURL}' size='40' /></div><div><label>Title</label><br><input type='text' class='wym_title' value='${curTitle}' size='40' /></div><div>`,
`<div><div><label id='link_attribute_label'>URL <span style='float: right; font-size: 90%'><a href='javascript:void(0)' role="button" id='set_link_id'>Create in-page anchor</a></span></label><br><input type='text' class='wym_href' value='${curURL}' size='40' /></div><div><label>Title</label><br><input type='text' class='wym_title' value='${curTitle}' size='40' /></div><div>`,
{
"Make link": function() {
// Get URL, name/title.
@@ -576,7 +576,7 @@ function renderEditorWithContent(pageId, content) {
// Containers, Galaxy style
//
var containers_menu = $(
"<div class='galaxy-page-editor-button'><a id='insert-galaxy-link' class='action-button popup' href='#'>Paragraph type</a></div>"
"<div class='galaxy-page-editor-button'><a id='insert-galaxy-link' class='action-button popup' href='javascript:void(0)' role='button'>Paragraph type</a></div>"
);
$(".wym_area_top").append(containers_menu);
@@ -596,7 +596,7 @@ function renderEditorWithContent(pageId, content) {
// Add menu button.
var insert_link_menu_button = $(
"<div><a id='insert-galaxy-link' class='action-button popup' href='#'>Insert Link to Galaxy Object</a></div>"
"<div><a id='insert-galaxy-link' class='action-button popup' href='javascript:void(0)' role='button'>Insert Link to Galaxy Object</a></div>"
).addClass("galaxy-page-editor-button");
$(".wym_area_top").append(insert_link_menu_button);
@@ -625,7 +625,7 @@ function renderEditorWithContent(pageId, content) {
// Add menu button.
var embed_object_button = $(
"<div><a id='embed-galaxy-object' class='action-button popup' href='#'>Embed Galaxy Object</a></div>"
"<div><a id='embed-galaxy-object' class='action-button popup' href='javascript:void(0)' role=''button'>Embed Galaxy Object</a></div>"
).addClass("galaxy-page-editor-button");
$(".wym_area_top").append(embed_object_button);
@@ -4,7 +4,7 @@ upstream component or environment that is accessed through props and events -->
<template>
<div class="tags-display" :class="tagContainerClasses">
<a v-if="linkVisible" href="#" class="toggle-link" @click.prevent="toggleTagDisplay">
<a v-if="linkVisible" href="javascript:void(0)" role="button" class="toggle-link" @click.prevent="toggleTagDisplay">
{{ linkText | localize }}
</a>
<vue-tags-input
@@ -6,7 +6,7 @@
</div>
<b-table v-else striped :items="categories" :fields="fields">
<template slot="name" slot-scope="data">
<b-link href="#" class="font-weight-bold" @click="onCategory(data.value)">
<b-link href="javascript:void(0)" role="button" class="font-weight-bold" @click="onCategory(data.value)">
{{ data.value }}
</b-link>
</template>
@@ -2,7 +2,7 @@
<div>
<b-table striped :items="repositories" :fields="fields">
<template slot="name" slot-scope="row">
<b-link href="#" class="font-weight-bold" @click="row.toggleDetails">
<b-link href="javascript:void(0)" role="button" class="font-weight-bold" @click="row.toggleDetails">
{{ row.item.name }}
</b-link>
</template>
@@ -3,7 +3,7 @@
<tbody>
<tr v-if="canExpand && expanded" class="bg-transparent">
<td :class="clsFirstColumn">
<a href="#" @click.stop.prevent="onExpand">
<a href="javascript:void(0)" role="button" @click.stop.prevent="onExpand">
<span class="fa fa-angle-double-up" />
<span>Show less</span>
</a>
@@ -20,7 +20,7 @@
</tr>
<tr v-if="canExpand && !expanded" class="bg-transparent">
<td :class="clsFirstColumn">
<a href="#" @click.stop.prevent="onExpand">
<a href="javascript:void(0)" role="button" @click.stop.prevent="onExpand">
<span class="fa fa-angle-double-down" />
<span>Show more</span>
</a>
@@ -10,7 +10,8 @@
v-for="url in toolshedUrls"
:key="url"
class="dropdown-item"
href="#"
href="javascript:void(0)"
role="button"
@click.prevent="onToolshed(url)"
>{{ url }}</a
>
@@ -12,8 +12,8 @@
<b-form-group label="Password">
<b-form-input name="password" type="password" v-model="password" />
<b-form-text
>Forgot password? Click here to <a @click="reset" href="#">reset</a> your
password.</b-form-text
>Forgot password? <a @click="reset" href="javascript:void(0)" role="button">Click here to reset your
password.</a> </b-form-text
>
</b-form-group>
<b-button name="login" type="submit">Login</b-button>
@@ -21,7 +21,7 @@
<b-card-footer>
Don't have an account?
<span v-if="allowUserCreation">
<a id="register-toggle" href="#" @click.prevent="toggleLogin">Register here.</a>
<a id="register-toggle" href="javascript:void(0)" role="button" @click.prevent="toggleLogin">Register here.</a>
</span>
<span v-else>
Registration for this Galaxy instance is disabled. Please contact an administrator for
@@ -37,7 +37,7 @@
</b-card-body>
<b-card-footer v-if="!isAdmin">
Already have an account?
<a id="login-toggle" href="#" @click.prevent="toggleLogin">Log in here.</a>
<a id="login-toggle" href="javascript:void(0)" role="button" @click.prevent="toggleLogin">Log in here.</a>
</b-card-footer>
</b-card>
</b-form>
+2 -2
View File
@@ -98,8 +98,8 @@ const View = Backbone.View.extend({
_template: function() {
return `
<nav id="masthead" class="navbar navbar-expand justify-content-center navbar-dark">
<a class="navbar-brand">
<img alt="navigation brand image" class="navbar-brand-image"/>
<a class="navbar-brand" aria-label="homepage">
<img alt="logo" class="navbar-brand-image"/>
<span class="navbar-brand-title"/>
</a>
<ul class="navbar-nav"/>
+27 -24
View File
@@ -66,24 +66,26 @@ const Collection = Backbone.Collection.extend({
//
// Visualization tab.
//
this.add({
id: "visualization",
title: _l("Visualize"),
tooltip: _l("Visualize datasets"),
disabled: !Galaxy.user.id,
menu: [
{
title: _l("Create Visualization"),
url: "visualizations",
target: "__use_router__"
},
{
title: _l("Interactive Environments"),
url: "visualization/gie_list",
target: "galaxy_main"
}
]
});
if (Galaxy.config.visualizations_visible) {
this.add({
id: "visualization",
title: _l("Visualize"),
tooltip: _l("Visualize datasets"),
disabled: !Galaxy.user.id,
menu: [
{
title: _l("Create Visualization"),
url: "visualizations",
target: "__use_router__"
},
{
title: _l("Interactive Environments"),
url: "visualization/gie_list",
target: "galaxy_main"
}
]
});
}
//
// 'Shared Items' or Libraries tab.
@@ -298,12 +300,6 @@ const Collection = Backbone.Collection.extend({
url: "pages/list",
target: "__use_router__"
},
{
title: _l("Visualizations"),
url: "visualizations/list",
target: "__use_router__",
divider: true,
},
{
title: _l("Active InteractiveTools"),
url: "realtime_entry_points/list",
@@ -311,6 +307,13 @@ const Collection = Backbone.Collection.extend({
}
]
};
if (Galaxy.config.visualizations_visible) {
userTab.menu.push({
title: _l("Visualizations"),
url: "visualizations/list",
target: "__use_router__"
});
}
}
this.add(userTab);
return new $.Deferred().resolve().promise();
@@ -387,7 +387,7 @@ export default {
// show advanced search link in standard display
if (show_advanced_search_link) {
tmpl += '<a href="" class="advanced-search-toggle">Advanced Search</a>';
tmpl += '<a href="javascript:void(0)" class="advanced-search-toggle">Advanced Search</a>';
}
// finalize standard search display
@@ -396,7 +396,7 @@ export default {
//
// advanced search
//
tmpl += `<div id="advanced-search" style="display: ${advanced_search_display}; margin-top: 5px; border: 1px solid #ccc;"><table><tr><td style="text-align: left" colspan="100"><a href="" class="advanced-search-toggle">Close Advanced Search</a></td></tr>`;
tmpl += `<div id="advanced-search" style="display: ${advanced_search_display}; margin-top: 5px; border: 1px solid #ccc;"><table><tr><td style="text-align: left" colspan="100"><a href="javascript:void(0)" class="advanced-search-toggle">Close Advanced Search</a></td></tr>`;
// add advanced filters
for (let column of options.columns) {
@@ -399,7 +399,7 @@ export default Backbone.View.extend({
// Add hyperlink for this filter since grid will no longer be using this filter. It is assumed that
// this element has a single child, a hyperlink/anchor.
$(this).empty();
var t = $(`<a href="#">${text}</a>`);
var t = $(`<a href="javascript:void(0)" role="button">${text}</a>`);
t.click(() => {
self.set_categorical_filter(name, filter_value);
});
@@ -441,7 +441,7 @@ export default Backbone.View.extend({
text = $(this).text();
$(this).empty();
$(this).removeClass("inactive-link");
var t = $(`<a href="#">${text}</a>`);
var t = $(`<a href="javascript:void(0)" role="button">${text}</a>`);
t.click(() => {
self.set_page(page_num);
});
@@ -59,7 +59,7 @@ var DatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).
[
'<a class="name" title="',
_l("Click to rename"),
'" href="javascript:void(0)">',
'" href="javascript:void(0)" role="button">',
"<%- element.name %>",
"</a>",
'<button class="discard btn btn-sm" title="',
@@ -522,9 +522,9 @@ var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin)
createList: function(name) {
if (!this.workingElements.length) {
var message = `${_l("No valid elements for final list")}. `;
message += `<a class="cancel-create" href="javascript:void(0);">${_l("Cancel")}</a> `;
message += `<a class="cancel-create" href="javascript:void(0);" role="button">${_l("Cancel")}</a> `;
message += _l("or");
message += ` <a class="reset" href="javascript:void(0);">${_l("start over")}</a>.`;
message += ` <a class="reset" href="javascript:void(0);" role="button">${_l("start over")}</a>.`;
this._showAlert(message);
return;
}
@@ -778,11 +778,11 @@ var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin)
header: _.template(
[
'<div class="main-help well clear">',
'<a class="more-help" href="javascript:void(0);">',
'<a class="more-help" href="javascript:void(0);" role="button">',
_l("More help"),
"</a>",
'<div class="help-content">',
'<a class="less-help" href="javascript:void(0);">',
'<a class="less-help" href="javascript:void(0);" role="button">',
_l("Less"),
"</a>",
"</div>",
@@ -801,13 +801,13 @@ var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin)
middle: _.template(
[
'<div class="collection-elements-controls">',
'<a class="reset" href="javascript:void(0);" ',
'<a class="reset" href="javascript:void(0);" role="button" ',
'title="',
_l("Undo all reordering and discards"),
'">',
_l("Start over"),
"</a>",
'<a class="clear-selected" href="javascript:void(0);" ',
'<a class="clear-selected" href="javascript:void(0);" role="button" ',
'title="',
_l("De-select all selected datasets"),
'">',
@@ -852,10 +852,10 @@ var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin)
' <span class="caret"></span>',
"</button>",
'<div class="dropdown-menu" role="menu">',
'<a class="dropdown-item" href="#">',
'<a class="dropdown-item" href="javascript:void(0)" role="button">',
_l("Create a <i>single</i> pair"),
"</a>",
'<a class="dropdown-item" href="#">',
'<a class="dropdown-item" href="javascript:void(0)" role="button">',
_l("Create a list of <i>unpaired</i> datasets"),
"</a>",
"</div>",
@@ -953,7 +953,7 @@ var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin)
'<li class="no-elements-left-message">',
_l("No elements left! "),
_l("Would you like to "),
'<a class="reset" href="javascript:void(0)">',
'<a class="reset" href="javascript:void(0)" role="button">',
_l("start over"),
"</a>?",
"</li>"
@@ -980,7 +980,7 @@ var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin)
_l("At least one element is needed for the collection"),
". ",
_l("You may need to "),
'<a class="cancel-create" href="javascript:void(0)">',
'<a class="cancel-create" href="javascript:void(0)" role="button">',
_l("cancel"),
"</a> ",
_l("and reselect new elements"),
@@ -1545,11 +1545,11 @@ var PairedCollectionCreator = Backbone.View.extend(baseMVC.LoggableMixin)
header: _.template(
[
'<div class="main-help well clear">',
'<a class="more-help" href="javascript:void(0);">',
'<a class="more-help" href="javascript:void(0);" role="button">',
_l("More help"),
"</a>",
'<div class="help-content">',
'<a class="less-help" href="javascript:void(0);">',
'<a class="less-help" href="javascript:void(0);" role="button">',
_l("Less"),
"</a>",
"</div>",
@@ -1577,13 +1577,13 @@ var PairedCollectionCreator = Backbone.View.extend(baseMVC.LoggableMixin)
"</div>",
'<div class="paired-column flex-column no-flex column">',
'<div class="column-header">',
'<a class="choose-filters-link" href="javascript:void(0)">',
'<a class="choose-filters-link" href="javascript:void(0)" role="button">',
_l("Choose filters"),
"</a>",
'<a class="clear-filters-link" href="javascript:void(0);">',
'<a class="clear-filters-link" href="javascript:void(0);" role="button">',
_l("Clear filters"),
"</a><br />",
'<a class="autopair-link" href="javascript:void(0);">',
'<a class="autopair-link" href="javascript:void(0);" role="button">',
_l("Auto-pair"),
"</a>",
"</div>",
@@ -1630,7 +1630,7 @@ var PairedCollectionCreator = Backbone.View.extend(baseMVC.LoggableMixin)
'<div class="column-title paired-column-title">',
'<span class="title"></span>',
"</div>",
'<a class="unpair-all-link" href="javascript:void(0);">',
'<a class="unpair-all-link" href="javascript:void(0);" role="button">',
_l("Unpair all"),
"</a>",
"</div>",
@@ -1679,10 +1679,10 @@ var PairedCollectionCreator = Backbone.View.extend(baseMVC.LoggableMixin)
' <span class="caret"></span>',
"</button>",
'<div class="dropdown-menu" role="menu">',
'<a class="dropdown-item" href="#">',
'<a class="dropdown-item" href="javascript:void(0)" role="button">',
_l("Create a <i>single</i> pair"),
"</a>",
'<a class="dropdown-item" href="#">',
'<a class="dropdown-item" href="javascript:void(0)" role="button">',
_l("Create a list of <i>unpaired</i> datasets"),
"</a>",
"</div>",
@@ -263,15 +263,21 @@ var DatasetListItemEdit = _super.extend(
/** Render an icon-button or popupmenu of links based on the applicable visualizations */
_renderVisualizationsButton: function() {
//TODO: someday - lazyload visualizations
var visualizations = this.model.get("visualizations");
if (this.model.isDeletedOrPurged() || !this.hasUser || !this.model.hasData() || _.isEmpty(visualizations)) {
const Galaxy = getGalaxyInstance();
const visualizations = this.model.get("visualizations");
if (
!Galaxy.config.visualizations_visible ||
this.model.isDeletedOrPurged() ||
!this.hasUser ||
!this.model.hasData() ||
_.isEmpty(visualizations)
) {
return null;
}
if (!_.isObject(visualizations[0])) {
this.warn("Visualizations have been switched off");
return null;
}
if (visualizations.length >= 1) {
const dsid = this.model.get("id");
const url = getAppRoot() + "visualizations?dataset_id=" + dsid;
@@ -281,7 +287,6 @@ var DatasetListItemEdit = _super.extend(
classes: "visualization-link",
faIcon: "fa-bar-chart-o",
onclick: ev => {
const Galaxy = getGalaxyInstance();
if (Galaxy.frame && Galaxy.frame.active) {
ev.preventDefault();
Galaxy.frame.add({ url: url, title: "Visualization" });
@@ -403,7 +403,7 @@ export default {
// show advanced search link in standard display
if (show_advanced_search_link) {
tmpl += '<a href="" class="advanced-search-toggle">Advanced Search</a>';
tmpl += '<a href="javascript:void(0)" class="advanced-search-toggle">Advanced Search</a>';
}
// finalize standard search display
@@ -412,7 +412,7 @@ export default {
//
// advanced search
//
tmpl += `<div id="advanced-search" style="display: ${advanced_search_display}; margin-top: 5px;"><table><tr><td style="text-align: left" colspan="100"><a href="" class="advanced-search-toggle">Close Advanced Search</a></td></tr>`;
tmpl += `<div id="advanced-search" style="display: ${advanced_search_display}; margin-top: 5px;"><table><tr><td style="text-align: left" colspan="100"><a href="javascript:void(0)" class="advanced-search-toggle">Close Advanced Search</a></td></tr>`;
// add advanced filters
for (const column of options.columns) {
+2 -2
View File
@@ -416,7 +416,7 @@ export default Backbone.View.extend({
// Add hyperlink for this filter since grid will no longer be using this filter. It is assumed that
// this element has a single child, a hyperlink/anchor.
$(this).empty();
var t = $(`<a href="#">${text}</a>`);
var t = $(`<a href="javascript:void(0)" role="button">${text}</a>`);
t.click(() => {
self.set_categorical_filter(name, filter_value);
});
@@ -458,7 +458,7 @@ export default Backbone.View.extend({
text = $(this).text();
$(this).empty();
$(this).removeClass("inactive-link");
var t = $(`<a href="#">${text}</a>`);
var t = $(`<a href="javascript:void(0)" role="button">${text}</a>`);
t.click(() => {
self.set_page(page_num);
});
@@ -40,13 +40,13 @@ var HDCAListItemEdit = _super.extend(
<span class="fa fa-times"></span>
</a>
<div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item delete-collection">
<a href="javascript:void(0)" role="button" class="dropdown-item delete-collection">
${_l("Collection Only")}
</a>
<a href="#" class="dropdown-item delete-collection-and-datasets">
<a href="javascript:void(0)" role="button" class="dropdown-item delete-collection-and-datasets">
${_l("Delete Datasets")}
</a>
<a href="#" style="display: ${
<a href="javascript:void(0)" role="button" style="display: ${
this.purgeAllowed ? "inherit" : "none"
}" class="dropdown-item delete-collection-and-purge-datasets">
${_l("Permanently Delete Datasets")}
@@ -671,7 +671,7 @@ var LibraryDatasetView = Backbone.View.extend({
<% if (item.get("is_unrestricted")) { %>
<div>
This dataset is unrestricted so everybody with the link can access it.
Just share <span class="copy-link-to-clipboard"><a href=""a>this page</a></span>.
Just share <span class="copy-link-to-clipboard"><a href="javascript:void(0)">this page</a></span>.
</div>
<% } %>
@@ -1159,12 +1159,12 @@ var LibraryDatasetView = Backbone.View.extend({
<% if (!item.get("is_unrestricted")) { %>
<p>
You can <span class="remove-restrictions">
<a href="">remove all access restrictions</a></span> on this dataset.
<a href="javascript:void(0)">remove all access restrictions</a></span> on this dataset.
</p>
<% } else { %>
<p>
You can <span class="make-private">
<a href="">make this dataset private</a></span> to you.</p>
<a href="javascript:void(0)">make this dataset private</a></span> to you.</p>
<% } %>
<h4>Roles that can access the dataset</h4>
<div id="access_perm" class="access_perm roles-selection"></div>
@@ -501,27 +501,27 @@ var FolderListView = Backbone.View.extend({
<input id="select-all-checkboxes" style="margin: 0;" type="checkbox">
</th>
<th>
<a class="sort-folder-name" title="Click to reverse order" href="#">Name</a>
<a class="sort-folder-name" title="Click to reverse order" href="javascript:void(0)" role="button">Name</a>
<span title="Sorted by Name" class="sort-icon-name fa fa-sort-alpha-<%- order %>"></span>
</th>
<th style="width:20%;">
<a class="sort-folder-message" title="Click to reverse order" href="#">Description</a>
<a class="sort-folder-message" title="Click to reverse order" href="javascript:void(0)" role="button">Description</a>
<span title="Sorted by Desc." class="sort-icon-message fa"></span>
</th>
<th style="width:5%;">
<a class="sort-folder-file_ext" title="Click to reverse order" href="#">Data Type</a>
<a class="sort-folder-file_ext" title="Click to reverse order" href="javascript:void(0)" role="button">Data Type</a>
<span title="Sorted by Type" class="sort-icon-file_ext fa"></span>
</th>
<th style="width:10%;">
<a class="sort-folder-raw_size" title="Click to reverse order" href='#'>Size</a>
<a class="sort-folder-raw_size" title="Click to reverse order" href="javascript:void(0)" role="button">Size</a>
<span title="Sorted by Size" class="sort-icon-raw_size fa"></span>
</th>
<th style="width:160px;">
<a class="sort-folder-update_time" title="Click to reverse order" href='#'>Date Updated (UTC)</a>
<a class="sort-folder-update_time" title="Click to reverse order" href=href="javascript:void(0)" role="button">Date Updated (UTC)</a>
<span title="Sorted by Date" class="sort-icon-update_time fa"></span>
</th>
<th style="width:5%;">
<a class="sort-folder-state" title="Click to reverse order" href="#">State</a>
<a class="sort-folder-state" title="Click to reverse order" href="javascript:void(0)">State</a>
<span title="Sorted by State" class="sort-icon-state fa"></span>
</th>
<th style="width:160px;"></th>
@@ -1488,10 +1488,10 @@ var FolderToolbarView = Backbone.View.extend({
<span class="fa fa-book"></span> Export to History <span class="caret"></span>
</button>
<div class="dropdown-menu" role="menu">
<a href="#" class="toolbtn-bulk-import add-to-history-datasets dropdown-item">
<a href="javascript:void(0)" role="button" class="toolbtn-bulk-import add-to-history-datasets dropdown-item">
as Datasets
</a>
<a href="#" class="toolbtn-collection-import add-to-history-collection dropdown-item">
<a href="javascript:void(0)" role="button" class="toolbtn-collection-import add-to-history-collection dropdown-item">
as a Collection
</a>
</div>
@@ -331,7 +331,7 @@ var LibraryListView = Backbone.View.extend({
<% if(length === 0) { %> style="display:none;" <% }%> >
<thead>
<th style="width:30%;">
<a class="sort-libraries-link" title="Click to reverse order" href="#">
<a class="sort-libraries-link" title="Click to reverse order" href="javascript:void(0)" role="button">
Name
</a>
<span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span>
+1 -1
View File
@@ -772,7 +772,7 @@ var templates = {
tool_search: _.template(
`<input id="tool-search-query" class="search-query parent-width" name="query"
placeholder="search tools" autocomplete="off" type="text" />
<span id="search-clear-btn" class="search-clear fa fa-times-circle" title="clear search (esc)"/>
<span id="search-clear-btn" class="search-clear fa fa-times-circle" title="clear search (esc)" aria-label="clear search" role="button"/>
<span id="search-spinner" class="search-loading fa fa-spinner fa-spin"/>`
),
@@ -453,7 +453,7 @@ export default Backbone.View.extend({
// Tool menu
$("div.toolSectionBody").hide();
$("div.toolSectionTitle > span").wrap("<a href='#'></a>");
$("div.toolSectionTitle > span").wrap("<a href='javascript:void(0)' role='button'></a>");
var last_expanded = null;
$("div.toolSectionTitle").each(function() {
var body = $(this).next("div.toolSectionBody");
@@ -494,7 +494,7 @@ export default Backbone.View.extend({
var $section = $(
'<div class="toolSectionWrapper">' +
'<div class="toolSectionTitle">' +
'<a href="#"><span>Workflows</span></a>' +
'<a href="javascript:void(0)" role="button"><span>Workflows</span></a>' +
"</div>" +
'<div class="toolSectionBody">' +
'<div class="toolSectionBg"/>' +
@@ -530,7 +530,8 @@ export default Backbone.View.extend({
}
});
var $add = $("<a/>")
.attr("href", "#")
.attr("href", "javascript:void(0)")
.attr("role", "button")
.html(workflow.name)
.on("click", () => {
self.add_node_for_subworkflow(workflow.latest_id, workflow.name);
@@ -764,7 +765,7 @@ export default Backbone.View.extend({
prebuildNode: function(type, title_text, content_id) {
var self = this;
var $f = $("<div class='toolForm toolFormInCanvas'/>");
var $f = $(`<div class='toolForm toolFormInCanvas' tabindex = '0' aria-label='Node ${title_text}'/>`);
var $title = $(`<div class='toolFormTitle unselectable'><span class='nodeTitle'>${title_text}</div></div>`);
add_node_icon($title.find(".nodeTitle"), type);
$f.append($title);
@@ -779,10 +780,14 @@ export default Backbone.View.extend({
// Fix width to computed width
// Now add floats
var buttons = $("<div class='buttons' style='float: right;'></div>");
buttons.append($(`<div class="sr-only"><a href="#right">Node Details</a></div>`));
if (type !== "subworkflow") {
buttons.append(
$("<div/>")
$("<a/>")
.attr({
"aria-label": "clone node",
"role": "button",
"href": "javascript:void(0)"
})
.addClass("fa-icon-button fa fa-files-o node-clone")
.click(e => {
node.clone();
@@ -790,7 +795,12 @@ export default Backbone.View.extend({
);
}
buttons.append(
$("<div/>")
$("<a/>")
.attr({
"aria-label": "destroy node",
"role": "button",
"href": "javascript:void(0)"
})
.addClass("fa-icon-button fa fa-times node-destroy")
.click(e => {
node.destroy();
+1 -1
View File
@@ -50,7 +50,7 @@ export function make_popupmenu(button_element, initial_options) {
menu_element.append(
$("<div/>")
.addClass("dropdown-item head")
.append($("<a href='#'></a>").html(k))
.append($("<a href='javascript:void(0)' role='button'></a>").html(k))
);
}
});
+2 -2
View File
@@ -197,7 +197,7 @@ export class TracksterUI extends Backbone.Model {
.appendTo(new_bookmark);
//position_link
$("<a href=''/>")
$("<a href='javascript:void(0)'/>")
.text(position)
.appendTo(position_div)
.click(() => {
@@ -223,7 +223,7 @@ export class TracksterUI extends Backbone.Model {
});
// delete_icon
$("<a href=''/>")
$("<a href='javascript:void(0)'/>")
.addClass("icon-button delete")
.appendTo(delete_icon_container);
+2
View File
@@ -105,6 +105,8 @@ body {
@extend .d-flex;
@extend .flex-column;
@extend .full-content;
top: 0px;
left: 0px;
}
#columns {
-1
View File
@@ -19,7 +19,6 @@ $frame-default-border: $border-color;
height: 100%;
width: 100%;
opacity: 0.5;
background: $brand-light;
overflow: auto;
}
-1
View File
@@ -46,7 +46,6 @@ $ui-margin-horizontal-large: $margin-v * 2;
.modal-backdrop {
z-index: -1;
opacity: 0.5;
background: $brand-light;
}
.modal-body {
position: static;
@@ -45,7 +45,7 @@
<ul class="nav navbar-nav">
<li class="dropdown hidden">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Load file<b class="caret"></b></a>
<a href="javascript:void(0)" role="button" class="dropdown-toggle" data-toggle="dropdown">Load file<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><input type="file" id="json_file"></li>
</ul>
@@ -106,9 +106,9 @@
<div class="outer-frame">
<div class="tab">
<a class="button" href="#" data-rel="treeview-wrapper">Treeview</a>
<a class="button" href="#" data-rel="sunburst-wrapper">Sunburst</a>
<a class="button" href="#" data-rel="treemap-wrapper">Treemap</a>
<a class="button" href="javascript:void(0)" data-rel="treeview-wrapper">Treeview</a>
<a class="button" href="javascript:void(0)" data-rel="sunburst-wrapper">Sunburst</a>
<a class="button" href="javascript:void(0)" data-rel="treemap-wrapper">Treemap</a>
</div>
<div class="inner-frame">
+35
View File
@@ -1,3 +1,28 @@
~~~~~~~~~~~~~~
``config_dir``
~~~~~~~~~~~~~~
:Description:
The directory that will be prepended to relative paths in options
specifying other Galaxy config files (e.g. datatypes_config_file).
Defaults to the directory in which galaxy.yml is located.
:Default: ``false``
:Type: str
~~~~~~~~~~~~
``data_dir``
~~~~~~~~~~~~
:Description:
The directory that will be prepended to relative paths in options
specifying Galaxy data/cache directories and files (such as the
default SQLite database, file_path, etc.). Defaults to `database/`
if running Galaxy from source or `<config_dir>/data` otherwise.
:Default: ``false``
:Type: str
~~~~~~~~~~~~~~~~~~~~~~~
``database_connection``
~~~~~~~~~~~~~~~~~~~~~~~
@@ -1211,6 +1236,16 @@
:Type: bool
~~~~~~~~~~~~~~~~~~~~~~~~~~
``visualizations_visible``
~~~~~~~~~~~~~~~~~~~~~~~~~~
:Description:
Show visualization tab and list in masthead.
:Default: ``true``
:Type: bool
~~~~~~~~~~~~~~~~~~~~~~~
``message_box_visible``
~~~~~~~~~~~~~~~~~~~~~~~
+1
View File
@@ -43,6 +43,7 @@ Members
- Enis Afgan (@afgane)
- Dannon Baker (@dannon)
- Matthias Bernt (@bernt-matthias)
- Daniel Blankenberg (@blankenberg)
- Dave Bouvier (@davebx)
- Martin Čech (@martenson)
+8 -8
View File
@@ -75,9 +75,9 @@ class UniverseApplication(config.ConfiguresGalaxyMixin):
self.application_stack.register_postfork_function(self.application_stack.set_postfork_server_name, self)
self.config.reload_sanitize_whitelist(explicit='sanitize_whitelist_file' in kwargs)
self.amqp_internal_connection_obj = galaxy.queues.connection_from_config(self.config)
# control_worker *can* be initialized with a queue, but here we don't
# queue_worker *can* be initialized with a queue, but here we don't
# want to and we'll allow postfork to bind and start it.
self.control_worker = GalaxyQueueWorker(self)
self.queue_worker = GalaxyQueueWorker(self)
self._configure_tool_shed_registry()
self._configure_object_store(fsmon=True)
@@ -234,6 +234,7 @@ class UniverseApplication(config.ConfiguresGalaxyMixin):
self.database_heartbeat = DatabaseHeartbeat(
application_stack=self.application_stack
)
self.database_heartbeat.add_change_callback(self.watchers.change_state)
self.application_stack.register_postfork_function(self.database_heartbeat.start)
# Start web stack message handling
@@ -251,6 +252,11 @@ class UniverseApplication(config.ConfiguresGalaxyMixin):
def shutdown(self):
log.debug('Shutting down')
exception = None
try:
self.queue_worker.shutdown()
except Exception as e:
exception = exception or e
log.exception("Failed to shutdown control worker cleanly")
try:
self.watchers.shutdown()
except Exception as e:
@@ -288,12 +294,6 @@ class UniverseApplication(config.ConfiguresGalaxyMixin):
exception = exception or e
log.exception("Failed to shutdown update repository manager cleanly")
try:
self.control_worker.shutdown()
except Exception as e:
exception = exception or e
log.exception("Failed to shutdown control worker cleanly")
try:
self.model.engine.dispose()
except Exception as e:
+3 -2
View File
@@ -64,8 +64,9 @@ class AuthManager(object):
if auth_results[0] is True:
try:
auth_return = parse_auth_results(trans, auth_results, options)
except Conflict:
break
except Conflict as conflict:
log.exception(conflict)
raise
return auth_return
elif auth_results[0] is None:
auto_email = str(auth_results[1]).lower()
+1
View File
@@ -489,6 +489,7 @@ class GalaxyAppConfiguration(BaseAppConfiguration):
self.brand = kwargs.get('brand', None)
self.welcome_url = kwargs.get('welcome_url', '/static/welcome.html')
self.show_welcome_with_login = string_as_bool(kwargs.get("show_welcome_with_login", "False"))
self.visualizations_visible = string_as_bool(kwargs.get('visualizations_visible', True))
# Configuration for the message box directly below the masthead.
self.message_box_visible = string_as_bool(kwargs.get('message_box_visible', False))
self.message_box_content = kwargs.get('message_box_content', None)
@@ -339,6 +339,8 @@
</datatype>
<datatype extension="twobit" type="galaxy.datatypes.binary:TwoBit" mimetype="application/octet-stream" display_in_upload="true"/>
<datatype extension="sqlite" type="galaxy.datatypes.binary:SQlite" mimetype="application/octet-stream" display_in_upload="true"/>
<datatype extension="pqp" type="galaxy.datatypes.binary:SQlite" mimetype="application/octet-stream" display_in_upload="true" subclass="true"/>
<datatype extension="osw" type="galaxy.datatypes.binary:SQlite" mimetype="application/octet-stream" display_in_upload="true" subclass="true"/>
<datatype extension="gemini.sqlite" type="galaxy.datatypes.binary:GeminiSQLite" mimetype="application/octet-stream" display_in_upload="true"/>
<datatype extension="cuffdiff.sqlite" type="galaxy.datatypes.binary:CuffDiffSQlite" display_in_upload="true"/>
<datatype extension="gafa.sqlite" type="galaxy.datatypes.binary:GAFASQLite" mimetype="application/octet-stream" display_in_upload="true"/>
@@ -98,6 +98,17 @@ uwsgi:
galaxy:
# The directory that will be prepended to relative paths in options
# specifying other Galaxy config files (e.g. datatypes_config_file).
# Defaults to the directory in which galaxy.yml is located.
#config_dir: false
# The directory that will be prepended to relative paths in options
# specifying Galaxy data/cache directories and files (such as the
# default SQLite database, file_path, etc.). Defaults to `database/`
# if running Galaxy from source or `<config_dir>/data` otherwise.
#data_dir: false
# By default, Galaxy uses a SQLite database at
# 'database/universe.sqlite'. You may use a SQLAlchemy connection
# string to specify an external database instead. This string takes
@@ -657,6 +668,9 @@ galaxy:
# third-party server, tricking a Galaxy user to access said site.
#enable_old_display_applications: true
# Show visualization tab and list in masthead.
#visualizations_visible: true
# Show a message box under the masthead.
#message_box_visible: false
+62 -71
View File
@@ -12,76 +12,69 @@ except ImportError:
pip = None
CONFIGURE_URL = "https://wiki.galaxyproject.org/Admin/Config/Performance/ProductionServer"
CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/"
DESCRIPTION = "Initialize a directory with a minimal Galaxy config."
HELP_CONFIG_DIR = "Directory containing the configuration files for Galaxy."
HELP_DATA_DIR = "Directory containing Galaxy-created data."
HELP_FORCE = "Overwrite existing files if they already exist."
HELP_WSGI_SERVER = ("Web server stack used to host Galaxy web application, and "
"if uWSGI, which protocol to use.")
HELP_LIBDRMAA = ("Configure Galaxy to submit jobs to a cluster via DRMAA by "
"supplying the path to a libdrmaa.so file using this argument.")
HELP_INSTALL = ("Install optional dependencies required by specified configuration "
"(e.g. drmaa, uwsgi, etc...).")
HELP_HOST = ('Host to bind Galaxy to - defaults to localhost. Specify an IP '
'address or "all" to listen on all interfaces.')
HELP_WSGI_SERVER = ("Web server stack used to host Galaxy web application, and if uWSGI, which protocol to use.")
HELP_LIBDRMAA = (
"Configure Galaxy to submit jobs to a cluster via DRMAA by supplying the path to a libdrmaa.so file using this "
"argument."
)
HELP_INSTALL = ("Install optional dependencies required by specified configuration (e.g. drmaa, etc...).")
HELP_HOST = (
'Host to bind Galaxy to - defaults to localhost. Specify an IP address or "all" to listen on all interfaces.'
)
HELP_PORT = ("Port to bind Galaxy to.")
HELP_DB_CONN = ('Galaxy database connection URI.')
HELP_DB_CONN = ("Galaxy database connection URI.")
DEFAULT_HOST = "localhost"
DEFAULT_INI = "galaxy.ini"
DEFAULT_YML = "galaxy.yml"
DEFAULT_DB_CONN = 'sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE'
SAMPLES_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'sample'))
GALAXY_CONFIG_TEMPLATE_FILE = os.path.join(SAMPLES_PATH, 'galaxy.ini.sample')
GALAXY_CONFIG_TEMPLATE_FILE = os.path.join(SAMPLES_PATH, 'galaxy.yml.sample')
STATIC_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'web', 'framework', 'static'))
# The sample is used as the default config file for Galaxy started without a
# config, and we don't want to duplicate the whole thing into galaxy.config for
# templating, so for now just substitute some lines. In the future we will
# build configs differently.
MSG_CONFIG_SUMMARY = """
For help on configuring Galaxy, consult the documentation at: \n {}
Additional sample configuration files for various Galaxy components (jobs,
datatypes, etc.) can be found in:\n {}
Start Galaxy by running the command from directory [{}]:
"""
# The sample is used as the default config file for Galaxy started without a config, and we don't want to duplicate the
# whole thing into galaxy.config for templating, so for now just substitute some lines. In the future we will build
# configs differently.
GALAXY_CONFIG_SUBSTITUTIONS = {
'#port = 8080': 'port = ${port}',
'#host = 127.0.0.1': 'host = ${host}',
'http = 127.0.0.1:8080': '${uwsgi_transport} = ${host}:${port}',
'static-map = /static=/path/to/galaxy/web/framework/static': 'static-map = /static=${static_path}',
'static-map = /static/style=/path/to/galaxy/web/framework/static/style/blue': 'static-map = /static/style=${static_path}/style/blue',
'#config_dir = None': 'config_dir = ${config_dir}',
'#data_dir = None': 'data_dir = ${data_dir}',
'#database_connection = sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE': 'database_connection = ${database_connection}',
' http: 127.0.0.1:8080': ' ${uwsgi_transport}: ${host}:${port}',
' static-map: /static/style=static/style/blue': ' static-map: /static=${static_path}/style/blue',
' static-map: /static=static': ' static-map: /static=${static_path}',
' static-map: /favicon.ico=static/favicon.ico': ' static-map: /static=${static_path}/favicon.ico',
' virtualenv: .venv': ' #venv: .venv # not used when running installed',
' pythonpath: lib': ' #pythonpath: lib # not used when running installed',
' #config_dir: false': ' config_dir: ${config_dir}',
' #data_dir: false': ' data_dir: ${data_dir}',
' #database_connection: sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE': ' database_connection: ${database_connection}',
}
def main(argv=None):
dependencies = []
arg_parser = ArgumentParser(description=DESCRIPTION)
arg_parser.add_argument("--config-dir",
default=".",
help=HELP_CONFIG_DIR)
arg_parser.add_argument("--data-dir",
default="./data",
help=HELP_DATA_DIR)
arg_parser.add_argument("--wsgi-server",
choices=["paster", "uwsgi-http", "uwsgi-native"],
default="paster",
arg_parser.add_argument("--config-dir", default=".", help=HELP_CONFIG_DIR)
arg_parser.add_argument("--data-dir", default="./data", help=HELP_DATA_DIR)
arg_parser.add_argument("--wsgi-server", choices=["uwsgi-http", "uwsgi-native"], default="uwsgi-http",
help=HELP_WSGI_SERVER)
arg_parser.add_argument("--host",
default=DEFAULT_HOST,
help=HELP_HOST)
arg_parser.add_argument("--port",
default="8080",
help=HELP_PORT)
arg_parser.add_argument("--db-conn",
default=DEFAULT_DB_CONN,
help=HELP_DB_CONN)
arg_parser.add_argument("--install",
action="store_true",
help=HELP_INSTALL)
arg_parser.add_argument("--force",
action="store_true",
default=False,
help=HELP_FORCE)
arg_parser.add_argument("--host", default=DEFAULT_HOST, help=HELP_HOST)
arg_parser.add_argument("--port", default="8080", help=HELP_PORT)
arg_parser.add_argument("--db-conn", default=DEFAULT_DB_CONN, help=HELP_DB_CONN)
arg_parser.add_argument("--install", action="store_true", help=HELP_INSTALL)
arg_parser.add_argument("--force", action="store_true", default=False, help=HELP_FORCE)
args = arg_parser.parse_args(argv)
config_dir = args.config_dir
relative_config_dir = config_dir
@@ -90,33 +83,27 @@ def main(argv=None):
data_dir = os.path.abspath(data_dir)
mode = _determine_mode(args)
if mode.startswith("uwsgi-"):
dependencies.append("uwsgi")
if args.db_conn.startswith("postgresql://"):
dependencies.append("psycopg2-binary")
for directory in (config_dir, data_dir):
if not os.path.exists(directory):
os.makedirs(directory)
print("Bootstrapping Galaxy configuration into directory %s" % relative_config_dir)
_handle_galaxy_ini(args, config_dir, data_dir)
_handle_galaxy_yml(args, config_dir, data_dir)
_handle_install(args, dependencies)
_print_config_summary(args, mode, relative_config_dir)
def _print_config_summary(args, mode, relative_config_dir):
_print_galaxy_ini_info(args, mode)
print("")
print("For help on configuring Galaxy, consult the documentation at:\n ", CONFIGURE_URL)
print("")
print("Additional sample configuration files for various Galaxy components (jobs,")
print("datatypes, etc.) can be found in:\n ", SAMPLES_PATH)
print("")
print("Start Galaxy by running the command from directory [%s]:" % relative_config_dir)
_print_galaxy_yml_info(args, mode)
print(MSG_CONFIG_SUMMARY.format(CONFIGURE_URL, SAMPLES_PATH, relative_config_dir))
_print_galaxy_run(mode)
def _print_galaxy_ini_info(args, mode):
print(" - galaxy.ini created, update to configure Galaxy.")
def _print_galaxy_yml_info(args, mode):
print(" - galaxy.yml created, update to configure Galaxy.")
print(" * Target web server %s" % mode)
if args.host == DEFAULT_HOST:
print(" * Binding to host localhost, remote clients will not be able to connect.")
@@ -128,9 +115,9 @@ def _print_galaxy_ini_info(args, mode):
def _print_galaxy_run(mode):
if mode.startswith("uwsgi"):
print(" uwsgi --ini-paste galaxy.ini")
print(" uwsgi --yaml galaxy.yml")
else:
print(" galaxy-paster serve galaxy.ini")
raise Exception("Unknown mode: %s" % mode)
def _determine_mode(args):
@@ -145,14 +132,14 @@ def _determine_host(args):
return '0.0.0.0' if args.host == 'all' else args.host
def _determine_ini_file(config_dir):
return os.path.join(config_dir, DEFAULT_INI)
def _determine_yml_file(config_dir):
return os.path.join(config_dir, DEFAULT_YML)
def _handle_galaxy_ini(args, config_dir, data_dir):
def _handle_galaxy_yml(args, config_dir, data_dir):
force = args.force
ini_file = _determine_ini_file(config_dir)
_check_file(ini_file, force)
yml_file = _determine_yml_file(config_dir)
_check_file(yml_file, force)
uwsgi_transport = 'socket' if args.wsgi_server == 'uwsgi-native' else 'http'
config_dict = dict(
port=args.port,
@@ -176,13 +163,13 @@ def _handle_galaxy_ini(args, config_dir, data_dir):
galaxy_config = galaxy_config_template.safe_substitute(
**config_dict
)
open(ini_file, "w").write(galaxy_config)
open(yml_file, "w").write(galaxy_config)
def _handle_install(args, dependencies):
if args.install and dependencies:
if pip is None:
raise ImportError("Bootstrapping Pulsar dependencies requires pip library.")
raise ImportError("Bootstrapping Galaxy dependencies requires pip.")
pip.main(["install"] + dependencies)
@@ -191,3 +178,7 @@ def _check_file(path, force):
if os.path.exists(path) and not force:
print("File %s exists, exiting. Run with --force to replace configuration." % path, file=sys.stderr)
sys.exit(1)
if __name__ == '__main__':
main()
+39 -19
View File
@@ -1,15 +1,8 @@
from functools import partial
from os.path import dirname
from galaxy.queue_worker import (
job_rule_modules,
reload_data_managers,
reload_job_rules,
reload_toolbox
)
from galaxy.queue_worker import job_rule_modules
from galaxy.tools.toolbox.watcher import (
get_tool_conf_watcher,
get_tool_data_dir_watcher,
get_tool_watcher,
)
from galaxy.util.watcher import (
@@ -20,8 +13,9 @@ from galaxy.util.watcher import (
class ConfigWatchers(object):
"""Contains ToolConfWatcher, ToolWatcher and ToolDataWatcher objects."""
def __init__(self, app, start_thread=True):
def __init__(self, app):
self.app = app
self.active = False
# ToolConfWatcher objects will watch the tool_cache if the tool_cache is passed into get_tool_conf_watcher.
# Watching the tool_cache means removing outdated items from the tool_cache.
# Only the reload_toolbox callback will re-populate the cache, so we pass the tool_cache only to the ToolConfWatcher that
@@ -29,33 +23,59 @@ class ConfigWatchers(object):
# If there are multiple ToolConfWatcher objects for the same handler or web process a race condition occurs between the two cache_cleanup functions.
# If the reload_data_managers callback wins, the cache will miss the tools that had been removed from the cache
# and will be blind to further changes in these tools.
self.tool_config_watcher = get_tool_conf_watcher(reload_callback=lambda: reload_toolbox(self.app), tool_cache=self.app.tool_cache)
self.data_manager_config_watcher = get_tool_conf_watcher(reload_callback=lambda: reload_data_managers(self.app))
self.tool_data_watcher = get_tool_data_dir_watcher(self.app.tool_data_tables, config=self.app.config)
self.tool_config_watcher = get_tool_conf_watcher(
reload_callback=lambda: self.app.queue_worker.send_control_task('reload_toolbox'),
tool_cache=self.app.tool_cache,
)
self.data_manager_config_watcher = get_tool_conf_watcher(
reload_callback=lambda: self.app.queue_worker.send_control_task('reload_data_managers'),
)
self.tool_data_watcher = get_watcher(self.app.config, 'watch_tool_data_dir', monitor_what_str='data tables')
self.tool_watcher = get_tool_watcher(self, app.config)
if getattr(self.app, 'is_job_handler', False):
self.job_rule_watcher = get_watcher(app.config, 'watch_job_rules', monitor_what_str='job rules')
else:
self.job_rule_watcher = get_watcher(app.config, '__invalid__')
if start_thread:
@property
def watchers(self):
return (self.tool_watcher,
self.tool_config_watcher,
self.data_manager_config_watcher,
self.tool_data_watcher,
self.tool_watcher,
self.job_rule_watcher)
def change_state(self, active):
if active:
self.start()
elif self.active:
self.shutdown()
def start(self):
for watcher in self.watchers:
watcher.start()
[self.tool_config_watcher.watch_file(config) for config in self.tool_config_paths]
[self.data_manager_config_watcher.watch_file(config) for config in self.data_manager_configs]
[self.tool_data_watcher.watch_directory(tool_data_path) for tool_data_path in self.tool_data_paths]
for tool_data_path in self.tool_data_paths:
self.tool_data_watcher.watch_directory(
tool_data_path,
callback=lambda path: self.app.queue_worker.send_control_task('reload_tool_data_tables', kwargs={'path': path}),
require_extensions=('.loc',),
recursive=True,
)
for job_rules_directory in self.job_rules_paths:
self.job_rule_watcher.watch_directory(
job_rules_directory,
callback=partial(reload_job_rules, self.app),
callback=lambda: self.app.queue_worker.send_control_task('reload_job_rules'),
recursive=True,
ignore_extensions=('.pyc', '.pyo', '.pyd'))
self.active = True
def shutdown(self):
self.tool_config_watcher.shutdown()
self.data_manager_config_watcher.shutdown()
self.tool_data_watcher.shutdown()
self.tool_watcher.shutdown()
for watcher in self.watchers:
watcher.shutdown()
self.active = False
def update_watch_data_table_paths(self):
if hasattr(self.tool_data_watcher, 'monitored_dirs'):
+6 -6
View File
@@ -8,6 +8,7 @@ import shutil
import string
import tempfile
import zipfile
from collections import OrderedDict
from inspect import isclass
import six
@@ -25,7 +26,6 @@ from galaxy.util import (
unicodify
)
from galaxy.util.bunch import Bunch
from galaxy.util.odict import odict
from galaxy.util.sanitize_html import sanitize_html
from . import (
dataproviders,
@@ -100,7 +100,7 @@ class Data(object):
allow_datatype_change = True
# Composite datatypes
composite_type = None
composite_files = odict()
composite_files = OrderedDict()
primary_file_name = 'index'
# A per datatype setting (inherited): max file size (in bytes) for setting optional metadata
_max_optional_metadata_filesize = None
@@ -116,7 +116,7 @@ class Data(object):
object.__init__(self, **kwd)
self.supported_display_apps = self.supported_display_apps.copy()
self.composite_files = self.composite_files.copy()
self.display_applications = odict()
self.display_applications = OrderedDict()
def get_raw_data(self, dataset):
"""Returns the full data. To stream it open the file_name and read/write as needed"""
@@ -546,7 +546,7 @@ class Data(object):
return self.display_applications.get(key, default)
def get_display_applications_by_dataset(self, dataset, trans):
rval = odict()
rval = OrderedDict()
for key, value in self.display_applications.items():
value = value.filter_by_dataset(dataset, trans)
if value.links:
@@ -666,7 +666,7 @@ class Data(object):
@property
def writable_files(self, dataset=None):
files = odict()
files = OrderedDict()
if self.composite_type != 'auto_primary_file':
files[self.primary_file_name] = self.__new_composite_file(self.primary_file_name)
for key, value in self.get_composite_files(dataset=dataset).items():
@@ -682,7 +682,7 @@ class Data(object):
meta_value = self.metadata_spec[composite_file.substitute_name_with_metadata].default
return key % meta_value
return key
files = odict()
files = OrderedDict()
for key, value in self.composite_files.items():
files[substitute_composite_key(key, value)] = value
return files
@@ -1,5 +1,6 @@
# Contains objects for using external display applications
import logging
from collections import OrderedDict
from copy import deepcopy
from six import string_types
@@ -9,7 +10,6 @@ from galaxy.util import (
parse_xml,
string_as_bool
)
from galaxy.util.odict import odict
from galaxy.util.template import fill_template
from .parameters import (
DEFAULT_DATASET_NAME,
@@ -41,7 +41,7 @@ class DisplayApplicationLink(object):
def __init__(self, display_application):
self.display_application = display_application
self.parameters = odict() # parameters are populated in order, allowing lower listed ones to have values of higher listed ones
self.parameters = OrderedDict() # parameters are populated in order, allowing lower listed ones to have values of higher listed ones
self.url_param_name_map = {}
self.url = None
self.id = None
@@ -59,9 +59,9 @@ class DisplayApplicationLink(object):
def get_inital_values(self, data, trans):
if self.other_values:
rval = odict(self.other_values)
rval = OrderedDict(self.other_values)
else:
rval = odict()
rval = OrderedDict()
rval.update({'BASE_URL': trans.request.base, 'APP': trans.app}) # trans automatically appears as a response, need to add properties of trans that we want here
BASE_PARAMS = {'qp': quote_plus, 'url_for': trans.app.url_for}
for key, value in BASE_PARAMS.items(): # add helper functions/variables
@@ -280,7 +280,7 @@ class DisplayApplication(object):
if version is None:
version = "1.0.0"
self.version = version
self.links = odict()
self.links = OrderedDict()
self._filename = filename
self._elem = elem
self._data_table_versions = {}
+5 -5
View File
@@ -6,7 +6,7 @@ from __future__ import absolute_import
import imp
import logging
import os
from collections import OrderedDict as odict
from collections import OrderedDict
from string import Template
from xml.etree.ElementTree import Element
@@ -42,7 +42,7 @@ class Registry(object):
self.config = config
self.datatypes_by_extension = {}
self.mimetypes_by_extension = {}
self.datatype_converters = odict()
self.datatype_converters = OrderedDict()
# Converters defined in local datatypes_conf.xml
self.converters = []
# Converters defined in datatypes_conf.xml included in installed tool shed repositories.
@@ -58,7 +58,7 @@ class Registry(object):
# tool shed repositories that contain display applications.
self.proprietary_display_app_containers = []
# Map a display application id to a display application
self.display_applications = odict()
self.display_applications = OrderedDict()
# The following 2 attributes are used in the to_xml_file()
# method to persist the current state into an xml file.
self.display_path_attr = None
@@ -636,7 +636,7 @@ class Registry(object):
else:
toolbox.register_tool(converter)
if source_datatype not in self.datatype_converters:
self.datatype_converters[source_datatype] = odict()
self.datatype_converters[source_datatype] = OrderedDict()
self.datatype_converters[source_datatype][target_datatype] = converter
if not hasattr(toolbox.app, 'tool_cache') or converter.id in toolbox.app.tool_cache._new_tool_ids:
self.log.debug("Loaded converter: %s", converter.id)
@@ -874,7 +874,7 @@ class Registry(object):
def get_converters_by_datatype(self, ext):
"""Returns available converters by source type"""
if ext not in self._converters_by_datatype:
converters = odict()
converters = OrderedDict()
source_datatype = type(self.get_datatype_by_extension(ext))
for ext2, converters_dict in self.datatype_converters.items():
converter_datatype = type(self.get_datatype_by_extension(ext2))
+2 -2
View File
@@ -2,12 +2,12 @@
Provides utilities for working with GFF files.
"""
import copy
from collections import OrderedDict
from bx.intervals.io import GenomicInterval, GenomicIntervalReader, MissingFieldError, NiceReaderWrapper, ParseError
from bx.tabular.io import Comment, Header
from galaxy.util import unicodify
from galaxy.util.odict import odict
FASTA_DIRECTIVE = '##FASTA'
@@ -427,7 +427,7 @@ def read_unordered_gtf(iterator, strict=False):
return fields[0] + '_' + get_transcript_id(fields)
# Aggregate intervals by transcript_id and collect comments.
feature_intervals = odict()
feature_intervals = OrderedDict()
comments = []
for count, line in enumerate(iterator):
if line.startswith('#'):
+5 -1
View File
@@ -203,9 +203,13 @@ class NotImplemented(MessageException):
err_code = error_codes.NOT_IMPLEMENTED
# non-web exceptions
class InvalidFileFormatError(MessageException):
status_code = 500
err_code = error_codes.INVALID_FILE_FORMAT
# non-web exceptions
class ContainerCLIError(Exception):
def __init__(self, msg=None, stdout=None, stderr=None, returncode=None,
command=None, subprocess_command=None, **kwargs):
+5
View File
@@ -149,6 +149,11 @@
"code": 500004,
"message": "Tool execution failed due to an internal server error."
},
{
"name": "INVALID_FILE_FORMAT",
"code": 500005,
"message": "File format not supported for this operation."
},
{
"name": "NOT_IMPLEMENTED",
"code": 501001,
+4 -4
View File
@@ -4,6 +4,7 @@ import logging
import operator
import os
import re
from collections import OrderedDict
from tempfile import NamedTemporaryFile
import galaxy.model
@@ -27,7 +28,6 @@ from galaxy.tool_util.parser.output_collection_def import (
ToolProvidedMetadataDatasetCollection,
)
from galaxy.util import (
odict,
unicodify
)
@@ -194,7 +194,7 @@ class JobContext(ModelPersistenceContext):
return self.app.tag_handler
def find_files(self, output_name, collection, dataset_collectors):
filenames = odict.odict()
filenames = OrderedDict()
for discovered_file in discover_files(output_name, self.tool_provided_metadata, dataset_collectors, self.job_working_directory, collection):
filenames[discovered_file.path] = discovered_file
return filenames
@@ -267,7 +267,7 @@ def collect_primary_datasets(job_context, output, input_ext):
dataset_collectors = [DEFAULT_DATASET_COLLECTOR]
if name in tool.outputs:
dataset_collectors = [dataset_collector(description) for description in tool.outputs[name].dataset_collector_descriptions]
filenames = odict.odict()
filenames = OrderedDict()
for discovered_file in discover_files(name, job_context.tool_provided_metadata, dataset_collectors, job_working_directory, outdata):
filenames[discovered_file.path] = discovered_file
for filename_index, (filename, discovered_file) in enumerate(filenames.items()):
@@ -284,7 +284,7 @@ def collect_primary_datasets(job_context, output, input_ext):
primary_output_assigned = True
continue
if name not in primary_datasets:
primary_datasets[name] = odict.odict()
primary_datasets[name] = OrderedDict()
visible = fields_match.visible
ext = fields_match.ext
if ext == "input":
+8 -6
View File
@@ -1,4 +1,7 @@
from __future__ import absolute_import
import logging
from collections import OrderedDict
from galaxy import model
from galaxy.exceptions import (
@@ -18,7 +21,6 @@ from galaxy.model.dataset_collections.matching import MatchingCollections
from galaxy.model.dataset_collections.registry import DATASET_COLLECTION_TYPES_REGISTRY
from galaxy.model.dataset_collections.type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
from galaxy.util import (
odict,
validation
)
@@ -358,7 +360,7 @@ class DatasetCollectionManager(object):
if elements is self.ELEMENTS_UNINITIALIZED:
return
new_elements = odict.odict()
new_elements = OrderedDict()
for key, element in elements.items():
if isinstance(element, model.DatasetCollection):
continue
@@ -367,7 +369,7 @@ class DatasetCollectionManager(object):
continue
# element is a dict with src new_collection and
# and odict of named elements
# and OrderedDict of named elements
collection_type = element.get("collection_type", None)
sub_elements = element["elements"]
collection = self.create_dataset_collection(
@@ -381,7 +383,7 @@ class DatasetCollectionManager(object):
elements.update(new_elements)
def __load_elements(self, trans, element_identifiers, hide_source_items=False, copy_elements=False):
elements = odict.odict()
elements = OrderedDict()
for element_identifier in element_identifiers:
elements[element_identifier["name"]] = self.__load_element(trans,
element_identifier=element_identifier,
@@ -477,7 +479,7 @@ class DatasetCollectionManager(object):
def _build_elements_from_rule_data(self, collection_type_description, rule_set, data, sources, handle_dataset):
identifier_columns = rule_set.identifier_columns
elements = odict.odict()
elements = OrderedDict()
for data_index, row_data in enumerate(data):
# For each row, find place in depth for this element.
collection_type_at_depth = collection_type_description
@@ -508,7 +510,7 @@ class DatasetCollectionManager(object):
sub_collection = {}
sub_collection["src"] = "new_collection"
sub_collection["collection_type"] = collection_type_at_depth.collection_type
sub_collection["elements"] = odict.odict()
sub_collection["elements"] = OrderedDict()
elements_at_depth[identifier] = sub_collection
elements_at_depth = sub_collection["elements"]
+1
View File
@@ -78,6 +78,7 @@ class ConfigSerializer(base.ModelSerializer):
'version_major' : _defaults_to(None),
'require_login' : _defaults_to(None),
'inactivity_box_content' : _defaults_to(None),
'visualizations_visible' : _defaults_to(True),
'message_box_content' : _defaults_to(None),
'message_box_visible' : _defaults_to(False),
'message_box_class' : _defaults_to('info'),
+44 -30
View File
@@ -50,7 +50,6 @@ import galaxy.model.tags
import galaxy.security.passwords
import galaxy.util
from galaxy.model.item_attrs import get_item_annotation_str, UsesAnnotations
from galaxy.model.util import pgcalc
from galaxy.security import get_permitted_actions
from galaxy.util import (directory_hash_id, ready_name_for_url,
unicodify, unique_id)
@@ -509,43 +508,58 @@ class User(Dictifiable, RepresentById):
HDAs in non-purged histories.
"""
# maintain a list so that we don't double count
dataset_ids = []
total = 0
# this can be a huge number and can run out of memory, so we avoid the mappers
db_session = object_session(self)
for history in db_session.query(History).enable_eagerloads(False).filter_by(user_id=self.id, purged=False).yield_per(1000):
for hda in db_session.query(HistoryDatasetAssociation).enable_eagerloads(False).filter_by(history_id=history.id, purged=False).yield_per(1000):
# TODO: def hda.counts_toward_disk_usage():
# return ( not self.dataset.purged and not self.dataset.library_associations )
if hda.dataset.id not in dataset_ids and not hda.dataset.purged and not hda.dataset.library_associations:
dataset_ids.append(hda.dataset.id)
total += hda.dataset.get_total_size()
return total
return self._calculate_or_set_disk_usage(db_session, dryrun=True)
def calculate_and_set_disk_usage(self):
"""
Calculates and sets user disk usage.
"""
new = None
db_session = object_session(self)
current = self.get_disk_usage()
if db_session.get_bind().dialect.name not in ('postgres', 'postgresql'):
done = False
while not done:
new = self.calculate_disk_usage()
db_session.refresh(self)
# make sure usage didn't change while calculating
# set done if it has not, otherwise reset current and iterate again.
if self.get_disk_usage() == current:
done = True
else:
current = self.get_disk_usage()
self._calculate_or_set_disk_usage(db_session, dryrun=False)
def _calculate_or_set_disk_usage(self, sa_session, dryrun=True):
"""
Utility to calculate (returning a value) or just set the disk usage
(returning None / applying immediately)
"""
ctes = """
WITH per_user_histories AS
(
SELECT history.id as id
FROM history
WHERE history.user_id = :id
AND history.purged = false
),
per_hist_hdas AS (
SELECT DISTINCT history_dataset_association.dataset_id as id
FROM history_dataset_association
WHERE history_dataset_association.purged = false
AND history_dataset_association.history_id in (SELECT id from per_user_histories)
)
"""
sql_calc = """
SELECT sum(coalesce(dataset.total_size, coalesce(dataset.file_size, 0)))
FROM dataset
LEFT OUTER JOIN library_dataset_dataset_association ON dataset.id = library_dataset_dataset_association.dataset_id
WHERE dataset.id in (SELECT id from per_hist_hdas)
AND library_dataset_dataset_association.id IS NULL
"""
sql_update = """UPDATE galaxy_user
SET disk_usage = (%s)
WHERE id = :id""" % sql_calc
if dryrun:
r = sa_session.execute(ctes + sql_calc, {'id': self.id})
return r.fetchone()[0]
else:
new = pgcalc(db_session, self.id)
if new not in (current, None):
self.set_disk_usage(new)
db_session.add(self)
db_session.flush()
r = sa_session.execute(ctes + sql_update, {'id': self.id})
sa_session.refresh(self)
# There is no RETURNING clause because sqlite does not support it, so
# we return None
return None
@staticmethod
def user_template_environment(user):
+46 -9
View File
@@ -1,10 +1,13 @@
import datetime
import logging
import socket
import threading
from galaxy.model import WorkerProcess
from galaxy.model.orm.now import now
log = logging.getLogger(__name__)
class DatabaseHeartbeat(object):
@@ -12,6 +15,8 @@ class DatabaseHeartbeat(object):
self.application_stack = application_stack
self.heartbeat_interval = heartbeat_interval
self.hostname = socket.gethostname()
self._is_config_watcher = False
self._observers = []
self.exit = threading.Event()
self.thread = None
self.active = False
@@ -37,6 +42,11 @@ class DatabaseHeartbeat(object):
self.exit.set()
if self.thread:
self.thread.join()
worker_process = self.worker_process
if worker_process:
self.sa_session.delete(worker_process)
self.sa_session.flush()
self.application_stack.app.queue_worker.send_control_task('reconfigure_watcher', noop_self=True)
def get_active_processes(self, last_seen_seconds=None):
"""Return all processes seen in ``last_seen_seconds`` seconds."""
@@ -45,16 +55,43 @@ class DatabaseHeartbeat(object):
seconds_ago = now() - datetime.timedelta(seconds=last_seen_seconds)
return self.sa_session.query(WorkerProcess).filter(WorkerProcess.table.c.update_time > seconds_ago).all()
def add_change_callback(self, callback):
self._observers.append(callback)
@property
def is_config_watcher(self):
return self._is_config_watcher
@is_config_watcher.setter
def is_config_watcher(self, value):
self._is_config_watcher = value
log.debug('%s %s config watcher', self.server_name, 'is' if self.is_config_watcher else 'is not')
for callback in self._observers:
callback(self._is_config_watcher)
@property
def worker_process(self):
return self.sa_session.query(WorkerProcess).filter_by(
server_name=self.server_name,
hostname=self.hostname,
).first()
def update_watcher_designation(self):
worker_process = self.worker_process
if not worker_process:
worker_process = WorkerProcess(server_name=self.server_name, hostname=self.hostname)
worker_process.update_time = now()
self.sa_session.add(worker_process)
self.sa_session.flush()
# We only want a single process watching the various config files on the file system.
# We just pick the max server name for simplicity
is_config_watcher = self.server_name == max(
(p.server_name for p in self.get_active_processes(self.heartbeat_interval + 1)))
if is_config_watcher != self.is_config_watcher:
self.is_config_watcher = is_config_watcher
def send_database_heartbeat(self):
if self.active:
while not self.exit.isSet():
worker_process = self.sa_session.query(WorkerProcess).filter_by(
server_name=self.server_name,
hostname=self.hostname,
).first()
if not worker_process:
worker_process = WorkerProcess(server_name=self.server_name, hostname=self.hostname)
worker_process.update_time = now()
self.sa_session.add(worker_process)
self.sa_session.flush()
self.update_watcher_designation()
self.exit.wait(self.heartbeat_interval)
@@ -1,5 +1,6 @@
from collections import OrderedDict
from galaxy import model
from galaxy.util.odict import odict
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
@@ -34,7 +35,7 @@ class CollectionBuilder(object):
def __init__(self, collection_type_description):
self._collection_type_description = collection_type_description
self._current_elements = odict()
self._current_elements = OrderedDict()
def replace_elements_in_collection(self, template_collection, replacement_dict):
self._current_elements = self._replace_elements_in_collection(
@@ -43,7 +44,7 @@ class CollectionBuilder(object):
)
def _replace_elements_in_collection(self, template_collection, replacement_dict):
elements = odict()
elements = OrderedDict()
for element in template_collection.elements:
if element.is_collection:
collection_builder = CollectionBuilder(
@@ -77,7 +78,7 @@ class CollectionBuilder(object):
def build_elements(self):
elements = self._current_elements
if self._nested_collection:
new_elements = odict()
new_elements = OrderedDict()
for identifier, element in elements.items():
new_elements[identifier] = element.build()
elements = new_elements
+67 -38
View File
@@ -15,6 +15,7 @@ from sqlalchemy import (
false,
ForeignKey,
func,
Index,
Integer,
MetaData,
not_,
@@ -198,8 +199,10 @@ model.History.table = Table(
Column("importing", Boolean, index=True, default=False),
Column("genome_build", TrimmedString(40)),
Column("importable", Boolean, default=False),
Column("slug", TEXT, index=True),
Column("published", Boolean, index=True, default=False))
Column("slug", TEXT),
Column("published", Boolean, index=True, default=False),
Index('ix_history_slug', 'slug', mysql_length=200),
)
model.HistoryUserShareAssociation.table = Table(
"history_user_share_association", metadata,
@@ -549,13 +552,15 @@ model.LibraryFolder.table = Table(
Column("parent_id", Integer, ForeignKey("library_folder.id"), nullable=True, index=True),
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, default=now, onupdate=now),
Column("name", TEXT, index=True),
Column("name", TEXT),
Column("description", TEXT),
Column("order_id", Integer), # not currently being used, but for possible future use
Column("item_count", Integer),
Column("deleted", Boolean, index=True, default=False),
Column("purged", Boolean, index=True, default=False),
Column("genome_build", TrimmedString(40)))
Column("genome_build", TrimmedString(40)),
Index('ix_library_folder_name', 'name', mysql_length=200),
)
model.LibraryInfoAssociation.table = Table(
"library_info_association", metadata,
@@ -967,9 +972,11 @@ model.StoredWorkflow.table = Table(
Column("name", TEXT),
Column("deleted", Boolean, default=False),
Column("importable", Boolean, default=False),
Column("slug", TEXT, index=True),
Column("from_path", TEXT, index=True),
Column("published", Boolean, index=True, default=False))
Column("slug", TEXT),
Column("from_path", TEXT),
Column("published", Boolean, index=True, default=False),
Index('ix_stored_workflow_slug', 'slug', mysql_length=200),
)
model.Workflow.table = Table(
"workflow", metadata,
@@ -1017,7 +1024,7 @@ model.WorkflowStepInput.table = Table(
Column("default_value", JSONType),
Column("default_value_set", Boolean, default=False),
Column("runtime_value", Boolean, default=False),
UniqueConstraint("workflow_step_id", "name"),
Index('ix_workflow_step_input_workflow_step_id_name_unique', "workflow_step_id", "name", unique=True, mysql_length={'name': 200}),
)
@@ -1108,18 +1115,18 @@ model.WorkflowInvocationOutputDatasetAssociation.table = Table(
"workflow_invocation_output_dataset_association", metadata,
Column("id", Integer, primary_key=True),
Column("workflow_invocation_id", Integer, ForeignKey("workflow_invocation.id"), index=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id")),
Column("dataset_id", Integer, ForeignKey("history_dataset_association.id"), index=True),
Column("workflow_output_id", Integer, ForeignKey("workflow_output.id"), index=True),
Column("workflow_output_id", Integer, ForeignKey("workflow_output.id")),
)
model.WorkflowInvocationOutputDatasetCollectionAssociation.table = Table(
"workflow_invocation_output_dataset_collection_association", metadata,
Column("id", Integer, primary_key=True),
Column("workflow_invocation_id", Integer, ForeignKey("workflow_invocation.id"), index=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True),
Column("dataset_collection_id", Integer, ForeignKey("history_dataset_collection_association.id"), index=True),
Column("workflow_output_id", Integer, ForeignKey("workflow_output.id"), index=True),
Column("workflow_invocation_id", Integer, ForeignKey("workflow_invocation.id", name='fk_wiodca_wii'), index=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id", name='fk_wiodca_wsi')),
Column("dataset_collection_id", Integer, ForeignKey("history_dataset_collection_association.id", name='fk_wiodca_dci'), index=True),
Column("workflow_output_id", Integer, ForeignKey("workflow_output.id", name='fk_wiodca_woi')),
)
model.WorkflowInvocationStepOutputDatasetAssociation.table = Table(
@@ -1133,18 +1140,18 @@ model.WorkflowInvocationStepOutputDatasetAssociation.table = Table(
model.WorkflowInvocationStepOutputDatasetCollectionAssociation.table = Table(
"workflow_invocation_step_output_dataset_collection_association", metadata,
Column("id", Integer, primary_key=True),
Column("workflow_invocation_step_id", Integer, ForeignKey("workflow_invocation_step.id"), index=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True),
Column("dataset_collection_id", Integer, ForeignKey("history_dataset_collection_association.id"), index=True),
Column("workflow_invocation_step_id", Integer, ForeignKey("workflow_invocation_step.id", name='fk_wisodca_wisi'), index=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id", name='fk_wisodca_wsi')),
Column("dataset_collection_id", Integer, ForeignKey("history_dataset_collection_association.id", name='fk_wisodca_dci'), index=True),
Column("output_name", String(255), nullable=True),
)
model.WorkflowInvocationToSubworkflowInvocationAssociation.table = Table(
"workflow_invocation_to_subworkflow_invocation_association", metadata,
Column("id", Integer, primary_key=True),
Column("workflow_invocation_id", Integer, ForeignKey("workflow_invocation.id"), index=True),
Column("subworkflow_invocation_id", Integer, ForeignKey("workflow_invocation.id"), index=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id")),
Column("workflow_invocation_id", Integer, ForeignKey("workflow_invocation.id", name='fk_wfi_swi_wfi'), index=True),
Column("subworkflow_invocation_id", Integer, ForeignKey("workflow_invocation.id", name='fk_wfi_swi_swi'), index=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id", name='fk_wfi_swi_ws')),
)
model.StoredWorkflowUserShareAssociation.table = Table(
@@ -1188,8 +1195,7 @@ model.FormDefinition.table = Table(
Column("update_time", DateTime, default=now, onupdate=now),
Column("name", TrimmedString(255), nullable=False),
Column("desc", TEXT),
Column("form_definition_current_id", Integer,
ForeignKey("form_definition_current.id", name='for_def_form_def_current_id_fk', use_alter=True), index=True),
Column("form_definition_current_id", Integer, ForeignKey("form_definition_current.id", use_alter=True), index=True, nullable=False),
Column("fields", JSONType()),
Column("type", TrimmedString(255), index=True),
Column("layout", JSONType()))
@@ -1213,8 +1219,10 @@ model.Page.table = Table(
Column("title", TEXT),
Column("deleted", Boolean, index=True, default=False),
Column("importable", Boolean, index=True, default=False),
Column("slug", TEXT, unique=True, index=True),
Column("published", Boolean, index=True, default=False))
Column("slug", TEXT),
Column("published", Boolean, index=True, default=False),
Index('ix_page_slug', 'slug', mysql_length=200),
)
model.PageRevision.table = Table(
"page_revision", metadata,
@@ -1241,11 +1249,14 @@ model.Visualization.table = Table(
ForeignKey("visualization_revision.id", use_alter=True, name='visualization_latest_revision_id_fk'), index=True),
Column("title", TEXT),
Column("type", TEXT),
Column("dbkey", TEXT, index=True),
Column("dbkey", TEXT),
Column("deleted", Boolean, default=False, index=True),
Column("importable", Boolean, default=False, index=True),
Column("slug", TEXT, index=True),
Column("published", Boolean, default=False, index=True))
Column("slug", TEXT),
Column("published", Boolean, default=False, index=True),
Index('ix_visualization_dbkey', 'dbkey', mysql_length=200),
Index('ix_visualization_slug', 'slug', mysql_length=200),
)
model.VisualizationRevision.table = Table(
"visualization_revision", metadata,
@@ -1254,8 +1265,10 @@ model.VisualizationRevision.table = Table(
Column("update_time", DateTime, default=now, onupdate=now),
Column("visualization_id", Integer, ForeignKey("visualization.id"), index=True, nullable=False),
Column("title", TEXT),
Column("dbkey", TEXT, index=True),
Column("config", JSONType))
Column("dbkey", TEXT),
Column("config", JSONType),
Index('ix_visualization_revision_dbkey', 'dbkey', mysql_length=200),
)
model.VisualizationUserShareAssociation.table = Table(
"visualization_user_share_association", metadata,
@@ -1278,7 +1291,9 @@ model.DataManagerJobAssociation.table = Table(
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, index=True, default=now, onupdate=now),
Column("job_id", Integer, ForeignKey("job.id"), index=True),
Column("data_manager_id", TEXT, index=True))
Column("data_manager_id", TEXT),
Index('ix_data_manager_job_association_data_manager_id', 'data_manager_id', mysql_length=200),
)
# Tagging tables.
model.Tag.table = Table(
@@ -1408,7 +1423,9 @@ model.HistoryAnnotationAssociation.table = Table(
Column("id", Integer, primary_key=True),
Column("history_id", Integer, ForeignKey("history.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
Column("annotation", TEXT),
Index('ix_history_anno_assoc_annotation', 'annotation', mysql_length=200),
)
model.HistoryDatasetAssociationAnnotationAssociation.table = Table(
"history_dataset_association_annotation_association", metadata,
@@ -1416,35 +1433,45 @@ model.HistoryDatasetAssociationAnnotationAssociation.table = Table(
Column("history_dataset_association_id", Integer,
ForeignKey("history_dataset_association.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
Column("annotation", TEXT),
Index('ix_history_dataset_anno_assoc_annotation', 'annotation', mysql_length=200),
)
model.StoredWorkflowAnnotationAssociation.table = Table(
"stored_workflow_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("stored_workflow_id", Integer, ForeignKey("stored_workflow.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
Column("annotation", TEXT),
Index('ix_stored_workflow_ann_assoc_annotation', 'annotation', mysql_length=200),
)
model.WorkflowStepAnnotationAssociation.table = Table(
"workflow_step_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
Column("annotation", TEXT),
Index('ix_workflow_step_ann_assoc_annotation', 'annotation', mysql_length=200),
)
model.PageAnnotationAssociation.table = Table(
"page_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("page_id", Integer, ForeignKey("page.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
Column("annotation", TEXT),
Index('ix_page_annotation_association_annotation', 'annotation', mysql_length=200),
)
model.VisualizationAnnotationAssociation.table = Table(
"visualization_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("visualization_id", Integer, ForeignKey("visualization.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
Column("annotation", TEXT),
Index('ix_visualization_annotation_association_annotation', 'annotation', mysql_length=200),
)
model.HistoryDatasetCollectionAssociationAnnotationAssociation.table = Table(
"history_dataset_collection_annotation_association", metadata,
@@ -1452,7 +1479,8 @@ model.HistoryDatasetCollectionAssociationAnnotationAssociation.table = Table(
Column("history_dataset_collection_id", Integer,
ForeignKey("history_dataset_collection_association.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
Column("annotation", TEXT),
)
model.LibraryDatasetCollectionAnnotationAssociation.table = Table(
"library_dataset_collection_annotation_association", metadata,
@@ -1460,7 +1488,8 @@ model.LibraryDatasetCollectionAnnotationAssociation.table = Table(
Column("library_dataset_collection_id", Integer,
ForeignKey("library_dataset_collection_association.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
Column("annotation", TEXT),
)
# Ratings tables.
model.HistoryRatingAssociation.table = Table("history_rating_association", metadata,
+8 -10
View File
@@ -1,6 +1,5 @@
"""
Galaxy Metadata
"""
import copy
@@ -11,6 +10,7 @@ import shutil
import sys
import tempfile
import weakref
from collections import OrderedDict
from os.path import abspath
from six import string_types
@@ -26,7 +26,6 @@ from galaxy.util import (
)
from galaxy.util.json import safe_dumps
from galaxy.util.object_wrapper import sanitize_lists_to_string
from galaxy.util.odict import odict
log = logging.getLogger(__name__)
@@ -214,29 +213,28 @@ class MetadataCollection(object):
return None
class MetadataSpecCollection(odict):
class MetadataSpecCollection(OrderedDict):
"""
A simple extension of dict which allows cleaner access to items
A simple extension of OrderedDict which allows cleaner access to items
and allows the values to be iterated over directly as if it were a
list. append() is also implemented for simplicity and does not
"append".
"""
def __init__(self, dict=None):
odict.__init__(self, dict=None)
def __init__(self, *args, **kwds):
super(MetadataSpecCollection, self).__init__(*args, **kwds)
def append(self, item):
self[item.name] = item
def iter(self):
return iter(self.values())
def __getattr__(self, name):
if name not in self:
raise AttributeError
return self.get(name)
def __repr__(self):
# force elements to draw with __str__ for sphinx-apidoc
return ', '.join([item.__str__() for item in self.iter()])
return ', '.join(item.__str__() for item in self.values())
class MetadataParameter(object):
+3 -3
View File
@@ -62,16 +62,16 @@ def create_or_verify_database(url, galaxy_config_file, engine_options={}, app=No
migrate_to_current_version(engine, db_schema)
meta = MetaData(bind=engine)
if new_database and app:
if new_database:
log.info("Creating new database from scratch, skipping migrations")
current_version = migrate_repository.version().version
mapping.init(file_path=app.config.file_path, url=url, map_install_models=map_install_models, create_tables=True)
mapping.init(file_path='/tmp', url=url, map_install_models=map_install_models, create_tables=True)
schema.ControlledSchema.create(engine, migrate_repository, version=current_version)
db_schema = schema.ControlledSchema(engine, migrate_repository)
assert db_schema.version == current_version
migrate()
return
elif getattr(app.config, 'database_auto_migrate', False):
elif app and getattr(app.config, 'database_auto_migrate', False):
migrate()
return
@@ -1,13 +1,30 @@
from __future__ import print_function
import datetime
import logging
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Numeric, String, Table, TEXT
from sqlalchemy import (
Boolean,
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Numeric,
String,
Table,
TEXT
)
# Need our custom types, but don't import anything else from model
from galaxy.model.custom_types import JSONType, MetadataType, TrimmedString
from galaxy.model.custom_types import (
JSONType,
MetadataType,
TrimmedString
)
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
now = datetime.datetime.utcnow
metadata = MetaData()
# Tables as of changeset 1464:c7acaa1bb88f
@@ -197,5 +214,6 @@ StoredWorkflowMenuEntry_table = Table("stored_workflow_menu_entry", metadata,
def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
metadata.create_all()
@@ -1,14 +1,28 @@
"""
"""
from __future__ import print_function
import datetime
import logging
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, TEXT
from sqlalchemy import (
Boolean,
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table,
TEXT
)
from galaxy.model.migrate.versions.util import create_table, drop_table
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
now = datetime.datetime.utcnow
metadata = MetaData()
# New table in changeset 1568:0b022adfdc34
@@ -23,6 +37,7 @@ MetadataFile_table = Table("metadata_file", metadata,
def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
@@ -1,32 +1,42 @@
"""
"""
from __future__ import print_function
import datetime
import logging
import sys
from migrate import ForeignKeyConstraint
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Index, Integer, MetaData, String, Table, TEXT
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy import (
Boolean,
Column,
DateTime,
ForeignKey,
Index,
Integer,
MetaData,
String,
Table,
TEXT
)
from galaxy.model.custom_types import JSONType, MetadataType, TrimmedString
from galaxy.model.custom_types import (
JSONType,
MetadataType,
TrimmedString
)
from galaxy.model.migrate.versions.util import (
add_column,
add_index,
drop_column,
drop_index,
drop_table,
engine_false,
localtimestamp,
nextval
)
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
now = datetime.datetime.utcnow
metadata = MetaData()
# New tables as of changeset 2341:5498ac35eedd
@@ -314,108 +324,57 @@ Index("ix_jeom_library_dataset_dataset_association_id", JobExternalOutputMetadat
def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
# Add 2 new columns to the galaxy_user table
try:
User_table = Table("galaxy_user", metadata, autoload=True)
except NoSuchTableError:
User_table = None
log.debug("Failed loading table galaxy_user")
if User_table is not None:
col = Column('deleted', Boolean, index=True, default=False)
add_column(col, User_table, index_name='ix_galaxy_user_deleted')
col = Column('purged', Boolean, index=True, default=False)
add_column(col, User_table, index_name='ix_galaxy_user_purged')
User_table = Table("galaxy_user", metadata, autoload=True)
col = Column('deleted', Boolean, index=True, default=False)
add_column(col, User_table, metadata, index_name='ix_galaxy_user_deleted')
col = Column('purged', Boolean, index=True, default=False)
add_column(col, User_table, metadata, index_name='ix_galaxy_user_purged')
# Add 1 new column to the history_dataset_association table
try:
HistoryDatasetAssociation_table = Table("history_dataset_association", metadata, autoload=True)
except NoSuchTableError:
HistoryDatasetAssociation_table = None
log.debug("Failed loading table history_dataset_association")
if HistoryDatasetAssociation_table is not None:
try:
col = Column('copied_from_library_dataset_dataset_association_id', Integer, nullable=True)
col.create(HistoryDatasetAssociation_table)
assert col is HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id
except Exception:
log.exception("Adding column 'copied_from_library_dataset_dataset_association_id' to history_dataset_association table failed.")
HistoryDatasetAssociation_table = Table("history_dataset_association", metadata, autoload=True)
col = Column('copied_from_library_dataset_dataset_association_id', Integer, nullable=True)
add_column(col, HistoryDatasetAssociation_table, metadata)
# Add 1 new column to the metadata_file table
try:
MetadataFile_table = Table("metadata_file", metadata, autoload=True)
except NoSuchTableError:
MetadataFile_table = None
log.debug("Failed loading table metadata_file")
if MetadataFile_table is not None:
try:
col = Column('lda_id', Integer, index=True, nullable=True)
col.create(MetadataFile_table, index_name='ix_metadata_file_lda_id')
assert col is MetadataFile_table.c.lda_id
except Exception:
log.exception("Adding column 'lda_id' to metadata_file table failed.")
MetadataFile_table = Table("metadata_file", metadata, autoload=True)
col = Column('lda_id', Integer, index=True, nullable=True)
add_column(col, MetadataFile_table, metadata, index_name='ix_metadata_file_lda_id')
# Add 1 new column to the stored_workflow table - changeset 2328
try:
StoredWorkflow_table = Table("stored_workflow", metadata,
Column("latest_workflow_id", Integer,
ForeignKey("workflow.id", use_alter=True, name='stored_workflow_latest_workflow_id_fk'), index=True),
autoload=True, extend_existing=True)
except NoSuchTableError:
StoredWorkflow_table = None
log.debug("Failed loading table stored_workflow")
if StoredWorkflow_table is not None:
try:
col = Column('importable', Boolean, default=False)
col.create(StoredWorkflow_table)
assert col is StoredWorkflow_table.c.importable
except Exception:
log.exception("Adding column 'importable' to stored_workflow table failed.")
StoredWorkflow_table = Table("stored_workflow", metadata,
Column("latest_workflow_id", Integer,
ForeignKey("workflow.id", use_alter=True, name='stored_workflow_latest_workflow_id_fk'), index=True),
autoload=True, extend_existing=True)
col = Column('importable', Boolean, default=False)
add_column(col, StoredWorkflow_table, metadata)
# Create an index on the Job.state column - changeset 2192
add_index('ix_job_state', 'job', 'state', metadata)
# Add all of the new tables above
metadata.create_all()
# Add 1 foreign key constraint to the history_dataset_association table
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
try:
HistoryDatasetAssociation_table = Table("history_dataset_association", metadata, autoload=True)
except NoSuchTableError:
HistoryDatasetAssociation_table = None
log.debug("Failed loading table history_dataset_association")
try:
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
except NoSuchTableError:
LibraryDatasetDatasetAssociation_table = None
log.debug("Failed loading table library_dataset_dataset_association")
if HistoryDatasetAssociation_table is not None and LibraryDatasetDatasetAssociation_table is not None:
cons = ForeignKeyConstraint([HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id],
[LibraryDatasetDatasetAssociation_table.c.id],
name='history_dataset_association_copied_from_library_dataset_da_fkey')
# Create the constraint
cons.create()
except Exception:
log.exception("Adding foreign key constraint 'history_dataset_association_copied_from_library_dataset_da_fkey' to table 'history_dataset_association' failed.")
# Add 1 foreign key constraint to the metadata_file table
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
if migrate_engine.name != 'sqlite':
# Sqlite can't alter table add foreign key.
try:
cons = ForeignKeyConstraint([HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id],
cons = ForeignKeyConstraint([MetadataFile_table.c.lda_id],
[LibraryDatasetDatasetAssociation_table.c.id],
name='history_dataset_association_copied_from_library_dataset_da_fkey')
name='metadata_file_lda_id_fkey')
# Create the constraint
cons.create()
except Exception:
log.exception("Adding foreign key constraint 'history_dataset_association_copied_from_library_dataset_da_fkey' to table 'history_dataset_association' failed.")
# Add 1 foreign key constraint to the metadata_file table
try:
MetadataFile_table = Table("metadata_file", metadata, autoload=True)
except NoSuchTableError:
MetadataFile_table = None
log.debug("Failed loading table metadata_file")
try:
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
except NoSuchTableError:
LibraryDatasetDatasetAssociation_table = None
log.debug("Failed loading table library_dataset_dataset_association")
if migrate_engine.name != 'sqlite':
# Sqlite can't alter table add foreign key.
if MetadataFile_table is not None and LibraryDatasetDatasetAssociation_table is not None:
try:
cons = ForeignKeyConstraint([MetadataFile_table.c.lda_id],
[LibraryDatasetDatasetAssociation_table.c.id],
name='metadata_file_lda_id_fkey')
# Create the constraint
cons.create()
except Exception:
log.exception("Adding foreign key constraint 'metadata_file_lda_id_fkey' to table 'metadata_file' failed.")
log.exception("Adding foreign key constraint 'metadata_file_lda_id_fkey' to table 'metadata_file' failed.")
# Make sure we have at least 1 user
cmd = "SELECT * FROM galaxy_user;"
users = migrate_engine.execute(cmd).fetchall()
@@ -505,222 +464,72 @@ def downgrade(migrate_engine):
# NOTE: all new data added in the upgrade method is eliminated here via table drops
# Drop 1 foreign key constraint from the metadata_file table
MetadataFile_table = Table("metadata_file", metadata, autoload=True)
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
try:
MetadataFile_table = Table("metadata_file", metadata, autoload=True)
except NoSuchTableError:
MetadataFile_table = None
log.debug("Failed loading table metadata_file")
try:
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
except NoSuchTableError:
LibraryDatasetDatasetAssociation_table = None
log.debug("Failed loading table library_dataset_dataset_association")
if MetadataFile_table is not None and LibraryDatasetDatasetAssociation_table is not None:
try:
cons = ForeignKeyConstraint([MetadataFile_table.c.lda_id],
[LibraryDatasetDatasetAssociation_table.c.id],
name='metadata_file_lda_id_fkey')
# Drop the constraint
cons.drop()
except Exception:
log.exception("Dropping foreign key constraint 'metadata_file_lda_id_fkey' from table 'metadata_file' failed.")
cons = ForeignKeyConstraint([MetadataFile_table.c.lda_id],
[LibraryDatasetDatasetAssociation_table.c.id],
name='metadata_file_lda_id_fkey')
# Drop the constraint
cons.drop()
except Exception:
log.exception("Dropping foreign key constraint 'metadata_file_lda_id_fkey' from table 'metadata_file' failed.")
# Drop 1 foreign key constraint from the history_dataset_association table
HistoryDatasetAssociation_table = Table("history_dataset_association", metadata, autoload=True)
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
try:
HistoryDatasetAssociation_table = Table("history_dataset_association", metadata, autoload=True)
except NoSuchTableError:
HistoryDatasetAssociation_table = None
log.debug("Failed loading table history_dataset_association")
try:
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
except NoSuchTableError:
LibraryDatasetDatasetAssociation_table = None
log.debug("Failed loading table library_dataset_dataset_association")
if HistoryDatasetAssociation_table is not None and LibraryDatasetDatasetAssociation_table is not None:
try:
cons = ForeignKeyConstraint([HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id],
[LibraryDatasetDatasetAssociation_table.c.id],
name='history_dataset_association_copied_from_library_dataset_da_fkey')
# Drop the constraint
cons.drop()
except Exception:
log.exception("Dropping foreign key constraint 'history_dataset_association_copied_from_library_dataset_da_fkey' from table 'history_dataset_association' failed.")
cons = ForeignKeyConstraint([HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id],
[LibraryDatasetDatasetAssociation_table.c.id],
name='history_dataset_association_copied_from_library_dataset_da_fkey')
# Drop the constraint
cons.drop()
except Exception:
log.exception("Dropping foreign key constraint 'history_dataset_association_copied_from_library_dataset_da_fkey' from table 'history_dataset_association' failed.")
# Drop all of the new tables above
try:
UserGroupAssociation_table.drop()
except Exception:
log.exception("Dropping user_group_association table failed.")
try:
UserRoleAssociation_table.drop()
except Exception:
log.exception("Dropping user_role_association table failed.")
try:
GroupRoleAssociation_table.drop()
except Exception:
log.exception("Dropping group_role_association table failed.")
try:
Group_table.drop()
except Exception:
log.exception("Dropping galaxy_group table failed.")
try:
DatasetPermissions_table.drop()
except Exception:
log.exception("Dropping dataset_permissions table failed.")
try:
LibraryPermissions_table.drop()
except Exception:
log.exception("Dropping library_permissions table failed.")
try:
LibraryFolderPermissions_table.drop()
except Exception:
log.exception("Dropping library_folder_permissions table failed.")
try:
LibraryDatasetPermissions_table.drop()
except Exception:
log.exception("Dropping library_dataset_permissions table failed.")
try:
LibraryDatasetDatasetAssociationPermissions_table.drop()
except Exception:
log.exception("Dropping library_dataset_dataset_association_permissions table failed.")
try:
LibraryItemInfoPermissions_table.drop()
except Exception:
log.exception("Dropping library_item_info_permissions table failed.")
try:
LibraryItemInfoTemplatePermissions_table.drop()
except Exception:
log.exception("Dropping library_item_info_template_permissions table failed.")
try:
DefaultUserPermissions_table.drop()
except Exception:
log.exception("Dropping default_user_permissions table failed.")
try:
DefaultHistoryPermissions_table.drop()
except Exception:
log.exception("Dropping default_history_permissions table failed.")
try:
Role_table.drop()
except Exception:
log.exception("Dropping role table failed.")
try:
LibraryDatasetDatasetInfoAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_dataset_info_association table failed.")
try:
LibraryDataset_table.drop()
except Exception:
log.exception("Dropping library_dataset table failed.")
try:
LibraryDatasetDatasetAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_dataset_association table failed.")
try:
LibraryDatasetDatasetInfoTemplateAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_dataset_info_template_association table failed.")
try:
JobExternalOutputMetadata_table.drop()
except Exception:
log.exception("Dropping job_external_output_metadata table failed.")
try:
Library_table.drop()
except Exception:
log.exception("Dropping library table failed.")
try:
LibraryFolder_table.drop()
except Exception:
log.exception("Dropping library_folder table failed.")
try:
LibraryItemInfoTemplateElement_table.drop()
except Exception:
log.exception("Dropping library_item_info_template_element table failed.")
try:
LibraryInfoTemplateAssociation_table.drop()
except Exception:
log.exception("Dropping library_info_template_association table failed.")
try:
LibraryFolderInfoTemplateAssociation_table.drop()
except Exception:
log.exception("Dropping library_folder_info_template_association table failed.")
try:
LibraryDatasetInfoTemplateAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_info_template_association table failed.")
try:
LibraryInfoAssociation_table.drop()
except Exception:
log.exception("Dropping library_info_association table failed.")
try:
LibraryFolderInfoAssociation_table.drop()
except Exception:
log.exception("Dropping library_folder_info_association table failed.")
try:
LibraryDatasetInfoAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_info_association table failed.")
try:
LibraryItemInfoElement_table.drop()
except Exception:
log.exception("Dropping library_item_info_element table failed.")
try:
LibraryItemInfo_table.drop()
except Exception:
log.exception("Dropping library_item_info table failed.")
try:
LibraryItemInfoTemplate_table.drop()
except Exception:
log.exception("Dropping library_item_info_template table failed.")
TABLES = [
UserGroupAssociation_table,
UserRoleAssociation_table,
GroupRoleAssociation_table,
Group_table,
DatasetPermissions_table,
LibraryPermissions_table,
LibraryFolderPermissions_table,
LibraryDatasetPermissions_table,
LibraryDatasetDatasetAssociationPermissions_table,
LibraryItemInfoPermissions_table,
LibraryItemInfoTemplatePermissions_table,
DefaultUserPermissions_table,
DefaultHistoryPermissions_table,
Role_table,
LibraryDatasetDatasetInfoAssociation_table,
LibraryDataset_table,
LibraryDatasetDatasetAssociation_table,
LibraryDatasetDatasetInfoTemplateAssociation_table,
JobExternalOutputMetadata_table,
Library_table,
LibraryFolder_table,
LibraryItemInfoTemplateElement_table,
LibraryInfoTemplateAssociation_table,
LibraryFolderInfoTemplateAssociation_table,
LibraryDatasetInfoTemplateAssociation_table,
LibraryInfoAssociation_table,
LibraryFolderInfoAssociation_table,
LibraryDatasetInfoAssociation_table,
LibraryItemInfoElement_table,
LibraryItemInfo_table,
LibraryItemInfoTemplate_table,
]
for table in TABLES:
drop_table(table)
# Drop the index on the Job.state column - changeset 2192
drop_index('ix_job_state', 'job', 'state', metadata)
# Drop 1 column from the stored_workflow table - changeset 2328
try:
StoredWorkflow_table = Table("stored_workflow", metadata, autoload=True)
except NoSuchTableError:
StoredWorkflow_table = None
log.debug("Failed loading table stored_workflow")
if StoredWorkflow_table is not None:
try:
col = StoredWorkflow_table.c.importable
col.drop()
except Exception:
log.exception("Dropping column 'importable' from stored_workflow table failed.")
drop_column('importable', 'stored_workflow', metadata)
# Drop 1 column from the metadata_file table
try:
MetadataFile_table = Table("metadata_file", metadata, autoload=True)
except NoSuchTableError:
MetadataFile_table = None
log.debug("Failed loading table metadata_file")
if MetadataFile_table is not None:
try:
col = MetadataFile_table.c.lda_id
col.drop()
except Exception:
log.exception("Dropping column 'lda_id' from metadata_file table failed.")
drop_column('lda_id', 'metadata_file', metadata)
# Drop 1 column from the history_dataset_association table
try:
HistoryDatasetAssociation_table = Table("history_dataset_association", metadata, autoload=True)
except NoSuchTableError:
HistoryDatasetAssociation_table = None
log.debug("Failed loading table history_dataset_association")
if HistoryDatasetAssociation_table is not None:
try:
col = HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id
col.drop()
except Exception:
log.exception("Dropping column 'copied_from_library_dataset_dataset_association_id' from history_dataset_association table failed.")
drop_column('copied_from_library_dataset_dataset_association_id', HistoryDatasetAssociation_table)
# Drop 2 columns from the galaxy_user table
try:
User_table = Table("galaxy_user", metadata, autoload=True)
except NoSuchTableError:
User_table = None
log.debug("Failed loading table galaxy_user")
if User_table is not None:
try:
col = User_table.c.deleted
col.drop()
except Exception:
log.exception("Dropping column 'deleted' from galaxy_user table failed.")
try:
col = User_table.c.purged
col.drop()
except Exception:
log.exception("Dropping column 'purged' from galaxy_user table failed.")
User_table = Table("galaxy_user", metadata, autoload=True)
drop_column('deleted', User_table)
drop_column('purged', User_table)
@@ -1,7 +1,8 @@
"""
"""
from __future__ import print_function
import logging
import sys
from sqlalchemy import (
MetaData,
@@ -14,21 +15,17 @@ from galaxy.model.migrate.versions.util import (
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
User_table = Table("galaxy_user", metadata, autoload=True)
# The next add_index() calls are not needed any more after commit
# 7ee93c0995123b0f357abd649326295dfa06766c , but harmless
add_index('ix_galaxy_user_deleted', User_table, 'deleted')
add_index('ix_galaxy_user_purged', User_table, 'purged')
# Set the default data in the galaxy_user table, but only for null values
@@ -1,18 +1,42 @@
from __future__ import print_function
import datetime
import errno
import logging
import os
import time
from sqlalchemy import and_, Boolean, Column, DateTime, false, ForeignKey, Integer, MetaData, not_, Numeric, Table, TEXT, true
from sqlalchemy.orm import backref, mapper, relation, scoped_session, sessionmaker
from sqlalchemy import (
and_,
Boolean,
Column,
DateTime,
false,
ForeignKey,
Integer,
MetaData,
not_,
Numeric,
Table,
TEXT,
true
)
from sqlalchemy.orm import (
backref,
mapper,
relation,
scoped_session,
sessionmaker
)
from galaxy.model.custom_types import MetadataType, TrimmedString
from galaxy.model.custom_types import (
MetadataType,
TrimmedString
)
from galaxy.model.metadata import MetadataCollection
from galaxy.util.bunch import Bunch
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
now = datetime.datetime.utcnow
metadata = MetaData()
context = scoped_session(sessionmaker(autoflush=False, autocommit=True))
@@ -690,7 +714,9 @@ def __guess_dataset_by_filename(filename):
def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
log.debug("Fixing a discrepancy concerning deleted shared history items.")
affected_items = 0
start_time = time.time()
@@ -734,5 +760,4 @@ def upgrade(migrate_engine):
def downgrade(migrate_engine):
metadata.bind = migrate_engine
log.debug("Downgrade is not possible.")
pass
@@ -5,18 +5,10 @@ column, specifically 'qual' is changed to be 'qual454'.
from __future__ import print_function
import logging
import sys
from sqlalchemy import MetaData
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
@@ -6,19 +6,24 @@ histories in the same way that workflows are shared.
from __future__ import print_function
import logging
import sys
from sqlalchemy import Boolean, Column, ForeignKey, Integer, MetaData, Table
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy import (
Boolean,
Column,
ForeignKey,
Integer,
MetaData,
Table
)
from galaxy.model.migrate.versions.util import (
add_column,
create_table,
drop_column,
drop_table
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
HistoryUserShareAssociation_table = Table("history_user_share_association", metadata,
@@ -28,48 +33,18 @@ HistoryUserShareAssociation_table = Table("history_user_share_association", meta
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
# Load existing tables
metadata.bind = migrate_engine
metadata.reflect()
# Create the history_user_share_association table
try:
HistoryUserShareAssociation_table.create()
except Exception:
log.exception("Creating history_user_share_association table failed.")
# Add 1 column to the history table
try:
History_table = Table("history", metadata, autoload=True)
except NoSuchTableError:
History_table = None
log.debug("Failed loading table history")
if History_table is not None:
try:
col = Column('importable', Boolean, index=True, default=False)
col.create(History_table, index_name='ix_history_importable')
assert col is History_table.c.importable
except Exception:
log.exception("Adding column 'importable' to history table failed.")
create_table(HistoryUserShareAssociation_table)
col = Column('importable', Boolean, index=True, default=False)
add_column(col, 'history', metadata, index_name='ix_history_importable')
def downgrade(migrate_engine):
metadata.bind = migrate_engine
# Load existing tables
metadata.reflect()
# Drop 1 column from the history table
try:
History_table = Table("history", metadata, autoload=True)
except NoSuchTableError:
History_table = None
log.debug("Failed loading table history")
if History_table is not None:
try:
col = History_table.c.importable
col.drop()
except Exception:
log.exception("Dropping column 'importable' from history table failed.")
# Drop the history_user_share_association table
try:
HistoryUserShareAssociation_table.drop()
except Exception:
log.exception("Dropping history_user_share_association table failed.")
drop_column('importable', 'history', metadata)
drop_table(HistoryUserShareAssociation_table)
@@ -13,40 +13,47 @@ from __future__ import print_function
import datetime
import logging
import sys
from migrate import ForeignKeyConstraint
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, TEXT
from sqlalchemy import (
Boolean,
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table,
TEXT
)
# Need our custom types, but don't import anything else from model
from galaxy.model.custom_types import JSONType, TrimmedString
from galaxy.model.custom_types import (
JSONType,
TrimmedString
)
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
now = datetime.datetime.utcnow
metadata = MetaData()
FormDefinitionCurrent_table = Table('form_definition_current', metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, default=now, onupdate=now),
Column("latest_form_id", Integer, index=True),
Column("deleted", Boolean, index=True, default=False))
FormDefinition_table = Table('form_definition', metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, default=now, onupdate=now),
Column("name", TrimmedString(255), nullable=False),
Column("desc", TEXT),
Column("form_definition_current_id", Integer, ForeignKey("form_definition_current.id"), index=True, nullable=False),
Column("form_definition_current_id", Integer, ForeignKey("form_definition_current.id", use_alter=True), index=True, nullable=False),
Column("fields", JSONType()))
FormDefinitionCurrent_table = Table('form_definition_current', metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, default=now, onupdate=now),
Column("latest_form_id", Integer, ForeignKey("form_definition.id"), index=True),
Column("deleted", Boolean, index=True, default=False))
FormValues_table = Table('form_values', metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
@@ -101,90 +108,30 @@ SampleEvent_table = Table('sample_event', metadata,
Column("sample_state_id", Integer, ForeignKey("sample_state.id"), index=True),
Column("comment", TEXT))
TABLES = [
FormDefinition_table,
FormDefinitionCurrent_table,
FormValues_table,
RequestType_table,
Request_table,
Sample_table,
SampleState_table,
SampleEvent_table
]
def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
# Add all of the new tables above
try:
FormDefinitionCurrent_table.create()
except Exception:
log.exception("Creating form_definition_current table failed.")
try:
FormDefinition_table.create()
except Exception:
log.exception("Creating form_definition table failed.")
# Add 1 foreign key constraint to the form_definition_current table
if FormDefinitionCurrent_table is not None and FormDefinition_table is not None:
try:
cons = ForeignKeyConstraint([FormDefinitionCurrent_table.c.latest_form_id],
[FormDefinition_table.c.id],
name='form_definition_current_latest_form_id_fk')
# Create the constraint
cons.create()
except Exception:
log.exception("Adding foreign key constraint 'form_definition_current_latest_form_id_fk' to table 'form_definition_current' failed.")
try:
FormValues_table.create()
except Exception:
log.exception("Creating form_values table failed.")
try:
RequestType_table.create()
except Exception:
log.exception("Creating request_type table failed.")
try:
Request_table.create()
except Exception:
log.exception("Creating request table failed.")
try:
Sample_table.create()
except Exception:
log.exception("Creating sample table failed.")
try:
SampleState_table.create()
except Exception:
log.exception("Creating sample_state table failed.")
try:
SampleEvent_table.create()
except Exception:
log.exception("Creating sample_event table failed.")
for table in TABLES:
create_table(table)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
try:
FormDefinition_table.drop()
except Exception:
log.exception("Dropping form_definition table failed.")
try:
FormDefinitionCurrent_table.drop()
except Exception:
log.exception("Dropping form_definition_current table failed.")
try:
FormValues_table.drop()
except Exception:
log.exception("Dropping form_values table failed.")
try:
Request_table.drop()
except Exception:
log.exception("Dropping request table failed.")
try:
RequestType_table.drop()
except Exception:
log.exception("Dropping request_type table failed.")
try:
Sample_table.drop()
except Exception:
log.exception("Dropping sample table failed.")
try:
SampleState_table.drop()
except Exception:
log.exception("Dropping sample_state table failed.")
try:
SampleEvent_table.drop()
except Exception:
log.exception("Dropping sample_event table failed.")
for table in reversed(TABLES):
drop_table(table)
@@ -6,21 +6,20 @@ This migration script adds a new column to 2 tables:
from __future__ import print_function
import logging
import sys
from sqlalchemy import Boolean, Column, MetaData
from sqlalchemy import (
Boolean,
Column,
MetaData
)
from galaxy.model.custom_types import TrimmedString
from galaxy.model.migrate.versions.util import add_column, drop_column
from galaxy.model.migrate.versions.util import (
add_column,
drop_column
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
@@ -12,21 +12,20 @@ from __future__ import print_function
import datetime
import logging
import sys
from sqlalchemy import Column, DateTime, ForeignKey, Integer, MetaData, Table
from sqlalchemy import (
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table
)
# Need our custom types, but don't import anything else from model
from galaxy.model.custom_types import TrimmedString
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
now = datetime.datetime.utcnow
metadata = MetaData()
HistoryDatasetAssociationDisplayAtAuthorization_table = Table("history_dataset_association_display_at_authorization", metadata,
@@ -39,9 +38,8 @@ HistoryDatasetAssociationDisplayAtAuthorization_table = Table("history_dataset_a
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
# Load existing tables
metadata.bind = migrate_engine
metadata.reflect()
try:
HistoryDatasetAssociationDisplayAtAuthorization_table.create()
@@ -1,6 +1,6 @@
"""
This script fixes a problem introduced in the previous migration script
0010_hda_display_at_atuhz_table.py . MySQL has a name length limit and
0010_hda_display_at_authz_table.py . MySQL has a name length limit and
thus the index "ix_hdadaa_history_dataset_association_id" has to be
manually created.
"""
@@ -8,7 +8,6 @@ from __future__ import print_function
import datetime
import logging
import sys
from sqlalchemy import MetaData
@@ -17,14 +16,8 @@ from galaxy.model.migrate.versions.util import (
drop_index,
)
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
now = datetime.datetime.utcnow
metadata = MetaData()
@@ -8,21 +8,27 @@ from __future__ import print_function
import datetime
import logging
import sys
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, TEXT
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy import (
Boolean,
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table,
TEXT
)
from galaxy.model.custom_types import TrimmedString
from galaxy.model.migrate.versions.util import (
add_column,
create_table,
drop_column
)
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
now = datetime.datetime.utcnow
metadata = MetaData()
UserAddress_table = Table("user_address", metadata,
@@ -49,38 +55,19 @@ def upgrade(migrate_engine):
metadata.reflect()
# Add all of the new tables above
try:
UserAddress_table.create()
except Exception:
log.exception("Creating user_address table failed.")
create_table(UserAddress_table)
# Add 1 column to the request_type table
try:
RequestType_table = Table("request_type", metadata, autoload=True)
except NoSuchTableError:
RequestType_table = None
log.debug("Failed loading table request_type")
if RequestType_table is not None:
try:
col = Column("deleted", Boolean, index=True, default=False)
col.create(RequestType_table, index_name='ix_request_type_deleted')
assert col is RequestType_table.c.deleted
except Exception:
log.exception("Adding column 'deleted' to request_type table failed.")
col = Column("deleted", Boolean, index=True, default=False)
add_column(col, 'request_type', metadata, index_name='ix_request_type_deleted')
# Delete the submitted column
# This fails for sqlite, so skip the drop -- no conflicts in the future
try:
Request_table = Table("request", metadata, autoload=True)
except NoSuchTableError:
Request_table = None
log.debug("Failed loading table request")
if Request_table is not None:
# SQLAlchemy Migrate has a bug when dropping a boolean column in SQLite
if migrate_engine.name != 'sqlite':
Request_table.c.submitted.drop()
col = Column("state", TrimmedString(255), index=True)
col.create(Request_table, index_name='ix_request_state')
assert col is Request_table.c.state
Request_table = Table("request", metadata, autoload=True)
# SQLAlchemy Migrate has a bug when dropping a boolean column in SQLite
if migrate_engine.name != 'sqlite':
drop_column('submitted', Request_table)
col = Column("state", TrimmedString(255), index=True)
add_column(col, Request_table, metadata, index_name='ix_request_state')
def downgrade(migrate_engine):
@@ -10,28 +10,44 @@ new association tables:
1) library_info_association
2) library_folder_info_association
3) library_dataset_dataset_info_association
If using mysql, this script will throw an (OperationalError) exception due to a long index name on
the library_dataset_dataset_info_association table, which is OK because the script creates an index
with a shortened name.
"""
from __future__ import print_function
import logging
import sys
from sqlalchemy import Column, ForeignKey, Index, Integer, MetaData, Table
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy import (
Column,
ForeignKey,
Integer,
MetaData,
Table
)
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
OLD_TABLE_NAMES = [
'library_item_info_permissions',
'library_item_info_template_permissions',
'library_item_info_element',
'library_item_info_template_element',
'library_info_template_association',
'library_folder_info_template_association',
'library_dataset_info_template_association',
'library_dataset_dataset_info_template_association',
'library_info_association',
'library_folder_info_association',
'library_dataset_info_association',
'library_dataset_dataset_info_association',
'library_item_info',
'library_item_info_template',
]
LibraryInfoAssociation_table = Table('library_info_association', metadata,
Column("id", Integer, primary_key=True),
Column("library_id", Integer, ForeignKey("library.id"), index=True),
@@ -50,178 +66,27 @@ LibraryDatasetDatasetInfoAssociation_table = Table('library_dataset_dataset_info
Column("form_definition_id", Integer, ForeignKey("form_definition.id"), index=True),
Column("form_values_id", Integer, ForeignKey("form_values.id"), index=True))
NEW_TABLES = [
LibraryInfoAssociation_table,
LibraryFolderInfoAssociation_table,
LibraryDatasetDatasetInfoAssociation_table
]
def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
# Load existing tables
metadata.reflect()
# Drop all of the original library_item_info tables
# NOTE: all existing library item into template data is eliminated here via table drops
try:
LibraryItemInfoPermissions_table = Table("library_item_info_permissions", metadata, autoload=True)
except NoSuchTableError:
LibraryItemInfoPermissions_table = None
log.debug("Failed loading table library_item_info_permissions")
try:
LibraryItemInfoPermissions_table.drop()
except Exception:
log.exception("Dropping library_item_info_permissions table failed.")
try:
LibraryItemInfoTemplatePermissions_table = Table("library_item_info_template_permissions", metadata, autoload=True)
except NoSuchTableError:
LibraryItemInfoTemplatePermissions_table = None
log.debug("Failed loading table library_item_info_template_permissions")
try:
LibraryItemInfoTemplatePermissions_table.drop()
except Exception:
log.exception("Dropping library_item_info_template_permissions table failed.")
try:
LibraryItemInfoElement_table = Table("library_item_info_element", metadata, autoload=True)
except NoSuchTableError:
LibraryItemInfoElement_table = None
log.debug("Failed loading table library_item_info_element")
try:
LibraryItemInfoElement_table.drop()
except Exception:
log.exception("Dropping library_item_info_element table failed.")
try:
LibraryItemInfoTemplateElement_table = Table("library_item_info_template_element", metadata, autoload=True)
except NoSuchTableError:
LibraryItemInfoTemplateElement_table = None
log.debug("Failed loading table library_item_info_template_element")
try:
LibraryItemInfoTemplateElement_table.drop()
except Exception:
log.exception("Dropping library_item_info_template_element table failed.")
try:
LibraryInfoTemplateAssociation_table = Table("library_info_template_association", metadata, autoload=True)
except NoSuchTableError:
LibraryInfoTemplateAssociation_table = None
log.debug("Failed loading table library_info_template_association")
try:
LibraryInfoTemplateAssociation_table.drop()
except Exception:
log.exception("Dropping library_info_template_association table failed.")
try:
LibraryFolderInfoTemplateAssociation_table = Table("library_folder_info_template_association", metadata, autoload=True)
except NoSuchTableError:
LibraryFolderInfoTemplateAssociation_table = None
log.debug("Failed loading table library_folder_info_template_association")
try:
LibraryFolderInfoTemplateAssociation_table.drop()
except Exception:
log.exception("Dropping library_folder_info_template_association table failed.")
try:
LibraryDatasetInfoTemplateAssociation_table = Table("library_dataset_info_template_association", metadata, autoload=True)
except NoSuchTableError:
LibraryDatasetInfoTemplateAssociation_table = None
log.debug("Failed loading table library_dataset_info_template_association")
try:
LibraryDatasetInfoTemplateAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_info_template_association table failed.")
try:
LibraryDatasetDatasetInfoTemplateAssociation_table = Table("library_dataset_dataset_info_template_association", metadata, autoload=True)
except NoSuchTableError:
LibraryDatasetDatasetInfoTemplateAssociation_table = None
log.debug("Failed loading table library_dataset_dataset_info_template_association")
try:
LibraryDatasetDatasetInfoTemplateAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_dataset_info_template_association table failed.")
try:
LibraryInfoAssociation_table = Table("library_info_association", metadata, autoload=True)
except NoSuchTableError:
LibraryInfoAssociation_table = None
log.debug("Failed loading table library_info_association")
try:
LibraryInfoAssociation_table.drop()
except Exception:
log.exception("Dropping library_info_association table failed.")
try:
LibraryFolderInfoAssociation_table = Table("library_folder_info_association", metadata, autoload=True)
except NoSuchTableError:
LibraryFolderInfoAssociation_table = None
log.debug("Failed loading table library_folder_info_association")
try:
LibraryFolderInfoAssociation_table.drop()
except Exception:
log.exception("Dropping library_folder_info_association table failed.")
try:
LibraryDatasetInfoAssociation_table = Table("library_dataset_info_association", metadata, autoload=True)
except NoSuchTableError:
LibraryDatasetInfoAssociation_table = None
log.debug("Failed loading table library_dataset_info_association")
try:
LibraryDatasetInfoAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_info_association table failed.")
try:
LibraryDatasetDatasetInfoAssociation_table = Table("library_dataset_dataset_info_association", metadata, autoload=True)
except NoSuchTableError:
LibraryDatasetDatasetInfoAssociation_table = None
log.debug("Failed loading table library_dataset_dataset_info_association")
try:
LibraryDatasetDatasetInfoAssociation_table.drop()
except Exception:
log.exception("Dropping library_dataset_dataset_info_association table failed.")
try:
LibraryItemInfo_table = Table("library_item_info", metadata, autoload=True)
except NoSuchTableError:
LibraryItemInfo_table = None
log.debug("Failed loading table library_item_info")
try:
LibraryItemInfo_table.drop()
except Exception:
log.exception("Dropping library_item_info table failed.")
try:
LibraryItemInfoTemplate_table = Table("library_item_info_template", metadata, autoload=True)
except NoSuchTableError:
LibraryItemInfoTemplate_table = None
log.debug("Failed loading table library_item_info_template")
try:
LibraryItemInfoTemplate_table.drop()
except Exception:
log.exception("Dropping library_item_info_template table failed.")
for table_name in OLD_TABLE_NAMES:
drop_table(table_name, metadata)
# Create all new tables above
try:
LibraryInfoAssociation_table.create()
except Exception:
log.exception("Creating library_info_association table failed.")
try:
LibraryFolderInfoAssociation_table.create()
except Exception:
log.exception("Creating library_folder_info_association table failed.")
try:
LibraryDatasetDatasetInfoAssociation_table.create()
except Exception:
log.exception("Creating library_dataset_dataset_info_association table failed.")
# Fix index on LibraryDatasetDatasetInfoAssociation_table for mysql
if migrate_engine.name == 'mysql':
# Load existing tables
metadata.reflect()
i = Index("ix_lddaia_ldda_id", LibraryDatasetDatasetInfoAssociation_table.c.library_dataset_dataset_association_id)
try:
i.create()
except Exception:
log.exception("Adding index 'ix_lddaia_ldda_id' to table 'library_dataset_dataset_info_association' table failed.")
for table in NEW_TABLES:
create_table(table)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
log.debug("Downgrade is not possible.")
pass
+13 -24
View File
@@ -21,15 +21,18 @@ now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
metadata = MetaData()
Page_table = Table("page", metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, default=now, onupdate=now),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True, nullable=False),
Column("latest_revision_id", Integer,
ForeignKey("page_revision.id", use_alter=True, name='page_latest_revision_id_fk'), index=True),
Column("title", TEXT),
Column("slug", TEXT, unique=True, index=True))
Page_table = Table(
"page", metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, default=now, onupdate=now),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True, nullable=False),
Column("latest_revision_id", Integer,
ForeignKey("page_revision.id", use_alter=True, name='page_latest_revision_id_fk'), index=True),
Column("title", TEXT),
Column("slug", TEXT),
Index('ix_page_slug', 'slug', unique=True, mysql_length=200),
)
PageRevision_table = Table("page_revision", metadata,
Column("id", Integer, primary_key=True),
@@ -45,21 +48,7 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
try:
if migrate_engine.name == 'mysql':
# Strip slug index prior to creation so we can do it manually.
slug_index = None
for ix in Page_table.indexes:
if ix.name == 'ix_page_slug':
slug_index = ix
Page_table.indexes.remove(slug_index)
Page_table.create()
if migrate_engine.name == 'mysql':
# Create slug index manually afterward.
i = Index("ix_page_slug", Page_table.c.slug, mysql_length=200)
i.create()
except Exception:
log.exception("Could not create page table")
create_table(Page_table)
create_table(PageRevision_table)
col = Column('username', String(255), index=True, unique=True, default=False)
@@ -1,12 +1,6 @@
"""
This migration script adds the tables necessary to support tagging of histories,
datasets, and history-dataset associations (user views of datasets).
If using mysql, this script will display the following error, which is corrected in the next
migration script:
history_dataset_association_tag_association table failed: (OperationalError)
(1059, "Identifier name 'ix_history_dataset_association_tag_association_history_dataset_association_id'
is too long)
"""
from __future__ import print_function
@@ -1,13 +1,18 @@
"""
This script fixes a problem introduced in 0015_tagging.py. MySQL has a name length
limit and thus the index "ix_hda_ta_history_dataset_association_id" has to be
manually created.
This script was used to fix a problem introduced in 0015_tagging.py. MySQL has a
name length limit and thus the index "ix_hda_ta_history_dataset_association_id"
had to be manually created.
This is now fixed in SQLAlchemy Migrate.
"""
from __future__ import print_function
import logging
from sqlalchemy import MetaData
from sqlalchemy import (
MetaData,
Table
)
from galaxy.model.migrate.versions.util import (
add_index,
@@ -23,7 +28,9 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
add_index('ix_hda_ta_history_dataset_association_id', 'history_dataset_association_tag_association', 'history_dataset_association_id', metadata)
HistoryDatasetAssociationTagAssociation_table = Table('history_dataset_association_tag_association', metadata, autoload=True)
if not any([_.name for _ in index.columns] == ['history_dataset_association_id'] for index in HistoryDatasetAssociationTagAssociation_table.indexes):
add_index('ix_hda_ta_history_dataset_association_id', HistoryDatasetAssociationTagAssociation_table, 'history_dataset_association_id')
def downgrade(migrate_engine):
@@ -5,48 +5,32 @@ library_dataset.name, library_dataset_dataset_association.name.
from __future__ import print_function
import logging
import sys
from sqlalchemy import Index, MetaData, Table
from sqlalchemy import MetaData
from galaxy.model.migrate.versions.util import (
add_index,
drop_index
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
LibraryFolder_table = Table("library_folder", metadata, autoload=True)
LibraryDatasetDatasetAssociation_table = Table("library_dataset_dataset_association", metadata, autoload=True)
LibraryDataset_table = Table("library_dataset", metadata, autoload=True)
# Load existing tables
metadata.bind = migrate_engine
metadata.reflect()
# Add 1 index to the library_folder table
i = Index('ix_library_folder_name', LibraryFolder_table.c.name, mysql_length=200)
try:
i.create()
except Exception:
log.exception("Adding index 'ix_library_folder_name' to library_folder table failed.")
# Add 1 index to the library_dataset_dataset_association table
i = Index('ix_library_dataset_dataset_association_name', LibraryDatasetDatasetAssociation_table.c.name)
try:
i.create()
except Exception:
log.exception("Adding index 'ix_library_dataset_dataset_association_name' to library_dataset_dataset_association table failed.")
# Add 1 index to the library_dataset table
i = Index('ix_library_dataset_name', LibraryDataset_table.c.name)
try:
i.create()
except Exception:
log.exception("Adding index 'ix_library_dataset_name' to library_dataset table failed.")
add_index('ix_library_folder_name', 'library_folder', 'name', metadata)
add_index('ix_library_dataset_dataset_association_name', 'library_dataset_dataset_association', 'name', metadata)
add_index('ix_library_dataset_name', 'library_dataset', 'name', metadata)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
log.debug("Downgrade is not possible.")
metadata.reflect()
drop_index('ix_library_dataset_name', 'library_dataset', 'name', metadata)
drop_index('ix_library_dataset_dataset_association_name', 'library_dataset_dataset_association', 'name', metadata)
drop_index('ix_library_folder_name', 'library_folder', 'name', metadata)
@@ -6,79 +6,42 @@ to the form_definition table.
from __future__ import print_function
import logging
import sys
from migrate import ForeignKeyConstraint
from sqlalchemy import Column, Integer, MetaData, Table
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy import (
Column,
ForeignKey,
Integer,
MetaData,
Table
)
# Need our custom types, but don't import anything else from model
from galaxy.model.custom_types import JSONType, TrimmedString
from galaxy.model.custom_types import (
JSONType,
TrimmedString
)
from galaxy.model.migrate.versions.util import (
add_column,
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
# Load existing tables
metadata.bind = migrate_engine
metadata.reflect()
# Create the folder_id column
try:
Request_table = Table("request", metadata, autoload=True)
except NoSuchTableError:
Request_table = None
log.debug("Failed loading table request")
if Request_table is not None:
try:
col = Column("folder_id", Integer, index=True)
col.create(Request_table, index_name='ix_request_folder_id')
assert col is Request_table.c.folder_id
except Exception:
log.exception("Adding column 'folder_id' to request table failed.")
try:
LibraryFolder_table = Table("library_folder", metadata, autoload=True)
except NoSuchTableError:
LibraryFolder_table = None
log.debug("Failed loading table library_folder")
# Add 1 foreign key constraint to the library_folder table
if migrate_engine.name != 'sqlite' and Request_table is not None and LibraryFolder_table is not None:
try:
cons = ForeignKeyConstraint([Request_table.c.folder_id],
[LibraryFolder_table.c.id],
name='request_folder_id_fk')
# Create the constraint
cons.create()
except Exception:
log.exception("Adding foreign key constraint 'request_folder_id_fk' to table 'library_folder' failed.")
col = Column("folder_id", Integer, ForeignKey('library_folder.id'), index=True)
add_column(col, 'request', metadata, index_name='ix_request_folder_id')
# Create the type column in form_definition
try:
FormDefinition_table = Table("form_definition", metadata, autoload=True)
except NoSuchTableError:
FormDefinition_table = None
log.debug("Failed loading table form_definition")
if FormDefinition_table is not None:
try:
col = Column("type", TrimmedString(255), index=True)
col.create(FormDefinition_table, index_name='ix_form_definition_type')
assert col is FormDefinition_table.c.type
except Exception:
log.exception("Adding column 'type' to form_definition table failed.")
try:
col = Column("layout", JSONType())
col.create(FormDefinition_table)
assert col is FormDefinition_table.c.layout
except Exception:
log.exception("Adding column 'layout' to form_definition table failed.")
FormDefinition_table = Table("form_definition", metadata, autoload=True)
col = Column("type", TrimmedString(255), index=True)
add_column(col, FormDefinition_table, metadata, index_name='ix_form_definition_type')
col = Column("layout", JSONType())
add_column(col, FormDefinition_table, metadata)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
pass
@@ -8,7 +8,6 @@ column.
from __future__ import print_function
import logging
import sys
from sqlalchemy import (
Column,
@@ -29,13 +28,6 @@ from galaxy.model.migrate.versions.util import (
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
JobToOutputLibraryDataset_table = Table("job_to_output_library_dataset", metadata,
@@ -54,11 +46,7 @@ def upgrade(migrate_engine):
create_table(JobToOutputLibraryDataset_table)
# Create the library_folder_id column
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
col = Column("library_folder_id", Integer, ForeignKey('library_folder.id', name='job_library_folder_id_fk'), index=True)
else:
col = Column("library_folder_id", Integer, index=True)
col = Column("library_folder_id", Integer, ForeignKey('library_folder.id', name='job_library_folder_id_fk'), index=True)
add_column(col, 'job', metadata, index_name='ix_job_library_folder_id')
# Create the ix_dataset_state index
@@ -6,7 +6,15 @@ from __future__ import print_function
import logging
from sqlalchemy import Index, MetaData, Table
from sqlalchemy import (
MetaData,
Table
)
from galaxy.model.migrate.versions.util import (
add_index,
drop_index
)
log = logging.getLogger(__name__)
metadata = MetaData()
@@ -20,16 +28,13 @@ def upgrade(migrate_engine):
Page_table = Table("page", metadata, autoload=True)
try:
# Sqlite doesn't support .alter, so we need to drop an recreate
i = Index("ix_page_slug", Page_table.c.slug)
i.drop()
drop_index("ix_page_slug", Page_table, 'slug')
i = Index("ix_page_slug", Page_table.c.slug, unique=False)
i.create()
add_index("ix_page_slug", Page_table, 'slug', unique=False)
except Exception:
# Mysql doesn't have a named index, but alter should work
Page_table.c.slug.alter(unique=False)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
pass
@@ -4,7 +4,6 @@ This script adds a foreign key to the form_values table in the galaxy_user table
from __future__ import print_function
import logging
import sys
from sqlalchemy import (
Column,
@@ -13,16 +12,12 @@ from sqlalchemy import (
MetaData
)
from galaxy.model.migrate.versions.util import add_column, drop_column
from galaxy.model.migrate.versions.util import (
add_column,
drop_column
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
@@ -31,11 +26,7 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
col = Column("form_values_id", Integer, ForeignKey('form_values.id', name='user_form_values_id_fk'), index=True)
else:
col = Column("form_values_id", Integer, index=True)
col = Column("form_values_id", Integer, ForeignKey('form_values.id', name='user_form_values_id_fk'), index=True)
add_column(col, 'galaxy_user', metadata, index_name='ix_galaxy_user_form_values_id')
@@ -6,22 +6,27 @@ from __future__ import print_function
import datetime
import logging
import sys
from sqlalchemy import Column, DateTime, ForeignKey, Integer, MetaData, Table, TEXT
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy import (
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table,
TEXT
)
from galaxy.model.custom_types import TrimmedString
from galaxy.model.migrate.versions.util import localtimestamp, nextval
from galaxy.model.migrate.versions.util import (
create_table,
drop_column,
localtimestamp,
nextval
)
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
now = datetime.datetime.utcnow
metadata = MetaData()
RequestEvent_table = Table('request_event', metadata,
@@ -38,13 +43,8 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
# Add new request_event table
try:
RequestEvent_table.create()
except Exception:
log.exception("Creating request_event table failed.")
create_table(RequestEvent_table)
# move the current state of all existing requests to the request_event table
cmd = \
"INSERT INTO request_event " + \
"SELECT %s AS id," + \
@@ -57,18 +57,7 @@ def upgrade(migrate_engine):
cmd = cmd % (nextval(migrate_engine, 'request_event'), localtimestamp(migrate_engine), localtimestamp(migrate_engine), 'Imported from request table')
migrate_engine.execute(cmd)
if migrate_engine.name != 'sqlite':
# Delete the state column
try:
Request_table = Table("request", metadata, autoload=True)
except NoSuchTableError:
Request_table = None
log.debug("Failed loading table request")
if Request_table is not None:
try:
Request_table.c.state.drop()
except Exception:
log.exception("Deleting column 'state' to request table failed.")
drop_column('state', 'request', metadata)
def downgrade(migrate_engine):
@@ -6,35 +6,33 @@ set up with read-only access to database/files
from __future__ import print_function
import logging
import sys
from sqlalchemy import Column, MetaData, String, Table
from sqlalchemy import (
Column,
MetaData,
String,
)
from galaxy.model.migrate.versions.util import (
add_column,
drop_column
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
# Load existing tables
metadata.bind = migrate_engine
metadata.reflect()
try:
job_external_output_metadata = Table("job_external_output_metadata", metadata, autoload=True)
col = Column("filename_override_metadata", String(255))
col.create(job_external_output_metadata)
assert col is job_external_output_metadata.c.filename_override_metadata
except Exception:
log.exception("Adding column 'filename_override_metadata' to job_external_output_metadata table failed.")
col = Column("filename_override_metadata", String(255))
add_column(col, 'job_external_output_metadata', metadata)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
pass
metadata.reflect()
drop_column('filename_override_metadata', 'job_external_output_metadata', metadata)
@@ -5,9 +5,18 @@ from __future__ import print_function
import logging
from sqlalchemy import Column, Index, MetaData, Table, TEXT
from sqlalchemy import (
Column,
MetaData,
Table,
TEXT
)
from galaxy.model.migrate.versions.util import drop_column
from galaxy.model.migrate.versions.util import (
add_column,
add_index,
drop_column
)
log = logging.getLogger(__name__)
metadata = MetaData()
@@ -19,18 +28,11 @@ def upgrade(migrate_engine):
metadata.reflect()
History_table = Table("history", metadata, autoload=True)
# Mysql needs manual index creation because of max length index.
if migrate_engine.name != 'mysql':
# Create slug column.
c = Column("slug", TEXT, index=True)
c.create(History_table, index_name='ix_history_slug')
else:
c = Column("slug", TEXT)
c.create(History_table, index_name='')
i = Index("ix_history_slug", History_table.c.slug, mysql_length=200)
i.create()
assert c is History_table.c.slug
c = Column("slug", TEXT)
add_column(c, History_table, metadata)
# Index needs to be added separately because MySQL cannot index a TEXT/BLOB
# column without specifying mysql_length
add_index('ix_history_slug', History_table, 'slug')
def downgrade(migrate_engine):
@@ -50,11 +50,7 @@ def upgrade(migrate_engine):
metadata.reflect()
# Create user_id column in history_tag_association table.
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
c = Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True)
else:
c = Column("user_id", Integer, index=True)
c = Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True)
add_column(c, 'history_tag_association', metadata, index_name='ix_history_tag_association_user_id')
# Populate column so that user_id is the id of the user who owns the history (and, up to now, was the only person able to tag the history).
@@ -62,11 +58,7 @@ def upgrade(migrate_engine):
"UPDATE history_tag_association SET user_id=( SELECT user_id FROM history WHERE history_tag_association.history_id = history.id )")
# Create user_id column in history_dataset_association_tag_association table.
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
c = Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True)
else:
c = Column("user_id", Integer, index=True)
c = Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True)
add_column(c, 'history_dataset_association_tag_association', metadata, index_name='ix_history_dataset_association_tag_association_user_id')
# Populate column so that user_id is the id of the user who owns the history_dataset_association (and, up to now, was the only person able to tag the page).
@@ -74,12 +66,7 @@ def upgrade(migrate_engine):
"UPDATE history_dataset_association_tag_association SET user_id=( SELECT history.user_id FROM history, history_dataset_association WHERE history_dataset_association.history_id = history.id AND history_dataset_association.id = history_dataset_association_tag_association.history_dataset_association_id)")
# Create user_id column in page_tag_association table.
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
c = Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True)
else:
# Create user_id column in page_tag_association table.
c = Column("user_id", Integer, index=True)
c = Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True)
add_column(c, 'page_tag_association', metadata, index_name='ix_page_tag_association_user_id')
# Populate column so that user_id is the id of the user who owns the page (and, up to now, was the only person able to tag the page).
@@ -5,39 +5,38 @@ from __future__ import print_function
import logging
from sqlalchemy import Column, Index, MetaData, Table, TEXT
from sqlalchemy import (
Column,
MetaData,
Table,
TEXT
)
from galaxy.model.migrate.versions.util import (
add_column,
add_index,
drop_column
)
log = logging.getLogger(__name__)
metadata = MetaData()
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
StoredWorkflow_table = Table("stored_workflow", metadata, autoload=True)
# Create slug column.
c = Column("slug", TEXT)
c.create(StoredWorkflow_table)
assert c is StoredWorkflow_table.c.slug
# Create slug index.
if migrate_engine.name != 'sqlite':
try:
i = Index("ix_stored_workflow_slug", StoredWorkflow_table.c.slug, mysql_length=200)
i.create()
except Exception:
# Mysql doesn't have a named index, but alter should work
StoredWorkflow_table.c.slug.alter(unique=False)
add_column(c, StoredWorkflow_table, metadata)
# Index needs to be added separately because MySQL cannot index a TEXT/BLOB
# column without specifying mysql_length
add_index('ix_stored_workflow_slug', StoredWorkflow_table, 'slug')
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
StoredWorkflow_table = Table("stored_workflow", metadata, autoload=True)
StoredWorkflow_table.c.slug.drop()
drop_column('slug', 'stored_workflow', metadata)
@@ -22,7 +22,7 @@ def upgrade(migrate_engine):
# Create published column in history table.
History_table = Table("history", metadata, autoload=True)
c = Column("published", Boolean, index=True)
add_column(c, History_table, index_name='ix_history_published')
add_column(c, History_table, metadata, index_name='ix_history_published')
if migrate_engine.name != 'sqlite':
# Create index for published column in history table.
try:
@@ -35,7 +35,7 @@ def upgrade(migrate_engine):
# Create published column in stored workflows table.
StoredWorkflow_table = Table("stored_workflow", metadata, autoload=True)
c = Column("published", Boolean, index=True)
add_column(c, StoredWorkflow_table, index_name='ix_stored_workflow_published')
add_column(c, StoredWorkflow_table, metadata, index_name='ix_stored_workflow_published')
if migrate_engine.name != 'sqlite':
# Create index for published column in stored workflows table.
try:
@@ -48,7 +48,7 @@ def upgrade(migrate_engine):
# Create importable column in page table.
Page_table = Table("page", metadata, autoload=True)
c = Column("importable", Boolean, index=True)
add_column(c, Page_table, index_name='ix_page_importable')
add_column(c, Page_table, metadata, index_name='ix_page_importable')
if migrate_engine.name != 'sqlite':
# Create index for importable column in page table.
try:
@@ -5,36 +5,63 @@ from __future__ import print_function
import logging
from sqlalchemy import Column, ForeignKey, Index, Integer, MetaData, Table, TEXT, Unicode
from sqlalchemy import (
Column,
ForeignKey,
Index,
Integer,
MetaData,
Table,
TEXT,
Unicode
)
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
log = logging.getLogger(__name__)
metadata = MetaData()
# Annotation tables.
HistoryAnnotationAssociation_table = Table("history_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("history_id", Integer, ForeignKey("history.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT))
HistoryAnnotationAssociation_table = Table(
"history_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("history_id", Integer, ForeignKey("history.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT),
Index("ix_history_anno_assoc_annotation", 'annotation', mysql_length=200),
)
HistoryDatasetAssociationAnnotationAssociation_table = Table("history_dataset_association_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("history_dataset_association_id", Integer, ForeignKey("history_dataset_association.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT))
HistoryDatasetAssociationAnnotationAssociation_table = Table(
"history_dataset_association_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("history_dataset_association_id", Integer,
ForeignKey("history_dataset_association.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT),
Index("ix_history_dataset_anno_assoc_annotation", 'annotation', mysql_length=200),
)
StoredWorkflowAnnotationAssociation_table = Table("stored_workflow_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("stored_workflow_id", Integer, ForeignKey("stored_workflow.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT))
StoredWorkflowAnnotationAssociation_table = Table(
"stored_workflow_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("stored_workflow_id", Integer, ForeignKey("stored_workflow.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT),
Index("ix_stored_workflow_ann_assoc_annotation", 'annotation', mysql_length=200),
)
WorkflowStepAnnotationAssociation_table = Table("workflow_step_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT))
WorkflowStepAnnotationAssociation_table = Table(
"workflow_step_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT),
Index("ix_workflow_step_ann_assoc_annotation", 'annotation', mysql_length=200),
)
# Tagging tables.
@@ -47,86 +74,27 @@ WorkflowStepTagAssociation_table = Table("workflow_step_tag_association", metada
Column("value", Unicode(255), index=True),
Column("user_value", Unicode(255), index=True))
TABLES = [
HistoryAnnotationAssociation_table,
HistoryDatasetAssociationAnnotationAssociation_table,
StoredWorkflowAnnotationAssociation_table,
WorkflowStepAnnotationAssociation_table,
WorkflowStepTagAssociation_table
]
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
# Create history_annotation_association table.
try:
HistoryAnnotationAssociation_table.create()
except Exception:
log.exception("Creating history_annotation_association table failed.")
# Create history_dataset_association_annotation_association table.
try:
HistoryDatasetAssociationAnnotationAssociation_table.create()
except Exception:
log.exception("Creating history_dataset_association_annotation_association table failed.")
# Create stored_workflow_annotation_association table.
try:
StoredWorkflowAnnotationAssociation_table.create()
except Exception:
log.exception("Creating stored_workflow_annotation_association table failed.")
# Create workflow_step_annotation_association table.
try:
WorkflowStepAnnotationAssociation_table.create()
except Exception:
log.exception("Creating workflow_step_annotation_association table failed.")
# Create workflow_step_tag_association table.
try:
WorkflowStepTagAssociation_table.create()
except Exception:
log.exception("Creating workflow_step_tag_association table failed.")
haaa = Index("ix_history_anno_assoc_annotation", HistoryAnnotationAssociation_table.c.annotation, mysql_length=200)
hdaaa = Index("ix_history_dataset_anno_assoc_annotation", HistoryDatasetAssociationAnnotationAssociation_table.c.annotation, mysql_length=200)
swaaa = Index("ix_stored_workflow_ann_assoc_annotation", StoredWorkflowAnnotationAssociation_table.c.annotation, mysql_length=200)
wsaaa = Index("ix_workflow_step_ann_assoc_annotation", WorkflowStepAnnotationAssociation_table.c.annotation, mysql_length=200)
try:
haaa.create()
hdaaa.create()
swaaa.create()
wsaaa.create()
except Exception:
log.exception("Creating annotation indices failed.")
for table in TABLES:
create_table(table)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
# Drop history_annotation_association table.
try:
HistoryAnnotationAssociation_table.drop()
except Exception:
log.exception("Dropping history_annotation_association table failed.")
# Drop history_dataset_association_annotation_association table.
try:
HistoryDatasetAssociationAnnotationAssociation_table.drop()
except Exception:
log.exception("Dropping history_dataset_association_annotation_association table failed.")
# Drop stored_workflow_annotation_association table.
try:
StoredWorkflowAnnotationAssociation_table.drop()
except Exception:
log.exception("Dropping stored_workflow_annotation_association table failed.")
# Drop workflow_step_annotation_association table.
try:
WorkflowStepAnnotationAssociation_table.drop()
except Exception:
log.exception("Dropping workflow_step_annotation_association table failed.")
# Drop workflow_step_tag_association table.
try:
WorkflowStepTagAssociation_table.drop()
except Exception:
log.exception("Dropping workflow_step_tag_association table failed.")
for table in TABLES:
drop_table(table)
@@ -8,7 +8,6 @@ from __future__ import print_function
import datetime
import logging
import sys
from sqlalchemy import (
Column,
@@ -26,15 +25,8 @@ from galaxy.model.migrate.versions.util import (
drop_column
)
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
now = datetime.datetime.utcnow
metadata = MetaData()
@@ -49,31 +41,25 @@ def upgrade(migrate_engine):
# Delete the library_id column in 'request' table
Request_table = Table("request", metadata, autoload=True)
# TODO: Dropping a column used in a foreign key fails in MySQL, need to remove the FK first.
drop_column('library_id', Request_table)
# Delete the folder_id column in 'request' table
# TODO: Dropping a column used in a foreign key fails in MySQL, need to remove the FK first.
drop_column('folder_id', Request_table)
# Add the dataset_files column in 'sample' table
Sample_table = Table("sample", metadata, autoload=True)
col = Column("dataset_files", JSONType())
add_column(col, Sample_table)
add_column(col, Sample_table, metadata)
# Add the library_id column in 'sample' table
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
col = Column("library_id", Integer, ForeignKey("library.id"), index=True)
else:
col = Column("library_id", Integer, index=True)
add_column(col, Sample_table, index_name='ix_sample_library_id')
col = Column("library_id", Integer, ForeignKey("library.id"), index=True)
add_column(col, Sample_table, metadata, index_name='ix_sample_library_id')
# Add the library_id column in 'sample' table
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
col = Column("folder_id", Integer, ForeignKey("library_folder.id"), index=True)
else:
col = Column("folder_id", Integer, index=True)
add_column(col, Sample_table, index_name='ix_sample_library_folder_id')
col = Column("folder_id", Integer, ForeignKey("library_folder.id"), index=True)
add_column(col, Sample_table, metadata, index_name='ix_sample_library_folder_id')
def downgrade(migrate_engine):
@@ -86,18 +72,10 @@ def downgrade(migrate_engine):
drop_column('dataset_files', Sample_table)
Request_table = Table("request", metadata, autoload=True)
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
col = Column('folder_id', Integer, ForeignKey('library_folder.id', name='request_folder_id_fk'), index=True)
else:
col = Column('folder_id', Integer, index=True)
add_column(col, Request_table, index_name='ix_request_folder_id')
col = Column('folder_id', Integer, ForeignKey('library_folder.id'), index=True)
add_column(col, Request_table, metadata, index_name='ix_request_folder_id')
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
col = Column('library_id', Integer, ForeignKey("library.id"), index=True)
else:
col = Column('library_id', Integer, index=True)
add_column(col, Request_table, index_name='ix_request_library_id')
col = Column('library_id', Integer, ForeignKey("library.id"), index=True)
add_column(col, Request_table, metadata, index_name='ix_request_library_id')
drop_column('datatx_info', 'request_type', metadata)
@@ -5,15 +5,20 @@ from __future__ import print_function
import logging
from sqlalchemy import Column, MetaData, Table, TEXT
from sqlalchemy import (
Column,
MetaData,
Table,
TEXT
)
log = logging.getLogger(__name__)
metadata = MetaData()
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
try:
Library_table = Table("library", metadata, autoload=True)
@@ -5,16 +5,32 @@ from __future__ import print_function
import logging
from sqlalchemy import Column, ForeignKey, Integer, MetaData, Table, TEXT
from sqlalchemy import (
Column,
ForeignKey,
Index,
Integer,
MetaData,
Table,
TEXT
)
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
log = logging.getLogger(__name__)
metadata = MetaData()
PageAnnotationAssociation_table = Table("page_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("page_id", Integer, ForeignKey("page.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=True))
PageAnnotationAssociation_table = Table(
"page_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("page_id", Integer, ForeignKey("page.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT),
Index('ix_page_annotation_association_annotation', 'annotation', mysql_length=200),
)
def upgrade(migrate_engine):
@@ -22,19 +38,11 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
# Create history_annotation_association table.
try:
PageAnnotationAssociation_table.create()
except Exception:
log.exception("Creating page_annotation_association table failed.")
create_table(PageAnnotationAssociation_table)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
# Drop page_annotation_association table.
try:
PageAnnotationAssociation_table.drop()
except Exception:
log.exception("Dropping page_annotation_association table failed.")
drop_table(PageAnnotationAssociation_table)
@@ -6,11 +6,20 @@ from __future__ import print_function
import datetime
import logging
from sqlalchemy import Column, DateTime, ForeignKey, Integer, MetaData, Table
from sqlalchemy import (
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table
)
from galaxy.model.migrate.versions.util import create_table, drop_table
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
now = datetime.datetime.utcnow
metadata = MetaData()
@@ -6,9 +6,20 @@ from __future__ import print_function
import datetime
import logging
from sqlalchemy import Column, DateTime, ForeignKey, Integer, MetaData, Table
from sqlalchemy import (
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table
)
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
now = datetime.datetime.utcnow
metadata = MetaData()
@@ -21,14 +32,11 @@ def upgrade(migrate_engine):
# 1) Drop
for table_name in ["workflow_invocation_step", "workflow_invocation"]:
try:
t = Table(table_name, metadata, autoload=True)
t.drop()
metadata.remove(t)
except Exception:
log.exception("Failed to drop table '%s', ignoring (might result in wrong schema)" % table_name)
t = Table(table_name, metadata, autoload=True)
drop_table(t)
metadata.remove(t)
# 2) Readd
# 2) Re-add
WorkflowInvocation_table = Table("workflow_invocation", metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
@@ -44,13 +52,8 @@ def upgrade(migrate_engine):
Column("job_id", Integer, ForeignKey("job.id"), index=True, nullable=True))
for table in [WorkflowInvocation_table, WorkflowInvocationStep_table]:
try:
table.create()
except Exception:
log.exception("Failed to create table '%s', ignoring (might result in wrong schema)" % table.name)
create_table(table)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
# No downgrade
pass
@@ -5,9 +5,26 @@ from __future__ import print_function
import logging
from sqlalchemy import Boolean, Column, ForeignKey, Index, Integer, MetaData, Table, TEXT, Unicode
from sqlalchemy import (
Boolean,
Column,
ForeignKey,
Index,
Integer,
MetaData,
Table,
TEXT,
Unicode
)
from galaxy.model.migrate.versions.util import engine_false
from galaxy.model.migrate.versions.util import (
add_column,
add_index,
create_table,
drop_column,
drop_table,
engine_false
)
log = logging.getLogger(__name__)
metadata = MetaData()
@@ -32,11 +49,20 @@ VisualizationTagAssociation_table = Table("visualization_tag_association", metad
# Annotating visualizations.
VisualizationAnnotationAssociation_table = Table("visualization_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("visualization_id", Integer, ForeignKey("visualization.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT, index=False))
VisualizationAnnotationAssociation_table = Table(
"visualization_annotation_association", metadata,
Column("id", Integer, primary_key=True),
Column("visualization_id", Integer, ForeignKey("visualization.id"), index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
Column("annotation", TEXT),
Index('ix_visualization_annotation_association_annotation', 'annotation', mysql_length=200),
)
TABLES = [
VisualizationUserShareAssociation_table,
VisualizationTagAssociation_table,
VisualizationAnnotationAssociation_table
]
def upgrade(migrate_engine):
@@ -44,134 +70,54 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
Visualiation_table = Table("visualization", metadata, autoload=True)
# Create visualization_user_share_association table.
try:
VisualizationUserShareAssociation_table.create()
except Exception:
log.exception("Creating visualization_user_share_association table failed.")
for table in TABLES:
create_table(table)
# Add columns & create indices for supporting sharing to visualization table.
Visualization_table = Table("visualization", metadata, autoload=True)
deleted_column = Column("deleted", Boolean, default=False, index=True)
importable_column = Column("importable", Boolean, default=False, index=True)
slug_column = Column("slug", TEXT)
published_column = Column("published", Boolean, index=True)
add_column(deleted_column, Visualization_table, metadata, index_name="ix_visualization_deleted")
try:
# Add column.
deleted_column.create(Visualiation_table, index_name="ix_visualization_deleted")
assert deleted_column is Visualiation_table.c.deleted
# Fill column with default value.
cmd = "UPDATE visualization SET deleted = %s" % engine_false(migrate_engine)
migrate_engine.execute(cmd)
except Exception:
log.exception("Adding deleted column to visualization table failed.")
log.exception("Updating column 'deleted' of table 'visualization' failed.")
importable_column = Column("importable", Boolean, default=False, index=True)
add_column(importable_column, Visualization_table, metadata, index_name='ix_visualization_importable')
try:
# Add column.
importable_column.create(Visualiation_table, index_name='ix_visualization_importable')
assert importable_column is Visualiation_table.c.importable
# Fill column with default value.
cmd = "UPDATE visualization SET importable = %s" % engine_false(migrate_engine)
migrate_engine.execute(cmd)
except Exception:
log.exception("Adding importable column to visualization table failed.")
log.exception("Updating column 'importable' of table 'visualization' failed.")
slug_column = Column("slug", TEXT)
add_column(slug_column, Visualization_table, metadata)
# Index needs to be added separately because MySQL cannot index a TEXT/BLOB
# column without specifying mysql_length
add_index('ix_visualization_slug', Visualization_table, 'slug')
published_column = Column("published", Boolean, index=True)
add_column(published_column, Visualization_table, metadata, index_name='ix_visualization_published')
try:
slug_column.create(Visualiation_table)
assert slug_column is Visualiation_table.c.slug
except Exception:
log.exception("Adding slug column to visualization table failed.")
try:
if migrate_engine.name == 'mysql':
# Have to create index manually.
cmd = "CREATE INDEX ix_visualization_slug ON visualization ( slug ( 100 ) )"
migrate_engine.execute(cmd)
else:
i = Index("ix_visualization_slug", Visualiation_table.c.slug)
i.create()
except Exception:
log.exception("Adding index 'ix_visualization_slug' failed.")
try:
# Add column.
published_column.create(Visualiation_table, index_name='ix_visualization_published')
assert published_column is Visualiation_table.c.published
# Fill column with default value.
cmd = "UPDATE visualization SET published = %s" % engine_false(migrate_engine)
migrate_engine.execute(cmd)
except Exception:
log.exception("Adding published column to visualization table failed.")
# Create visualization_tag_association table.
try:
VisualizationTagAssociation_table.create()
except Exception:
log.exception("Creating visualization_tag_association table failed.")
# Create visualization_annotation_association table.
try:
VisualizationAnnotationAssociation_table.create()
except Exception:
log.exception("Creating visualization_annotation_association table failed.")
# Need to create index for visualization annotation manually to deal with errors.
try:
if migrate_engine.name == 'mysql':
# Have to create index manually.
cmd = "CREATE INDEX ix_visualization_annotation_association_annotation ON visualization_annotation_association ( annotation ( 100 ) )"
migrate_engine.execute(cmd)
else:
i = Index("ix_visualization_annotation_association_annotation", VisualizationAnnotationAssociation_table.c.annotation)
i.create()
except Exception:
log.exception("Adding index 'ix_visualization_annotation_association_annotation' failed.")
log.exception("Updating column 'published' of table 'visualization' failed.")
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
Visualiation_table = Table("visualization", metadata, autoload=True)
# Drop visualization_user_share_association table.
try:
VisualizationUserShareAssociation_table.drop()
except Exception:
log.exception("Dropping visualization_user_share_association table failed.")
Visualization_table = Table("visualization", metadata, autoload=True)
drop_column('deleted', Visualization_table)
drop_column('importable', Visualization_table)
drop_column('slug', Visualization_table)
drop_column('published', Visualization_table)
# Drop columns for supporting sharing from visualization table.
try:
Visualiation_table.c.deleted.drop()
except Exception:
log.exception("Dropping deleted column from visualization table failed.")
try:
Visualiation_table.c.importable.drop()
except Exception:
log.exception("Dropping importable column from visualization table failed.")
try:
Visualiation_table.c.slug.drop()
except Exception:
log.exception("Dropping slug column from visualization table failed.")
try:
Visualiation_table.c.published.drop()
except Exception:
log.exception("Dropping published column from visualization table failed.")
# Drop visualization_tag_association table.
try:
VisualizationTagAssociation_table.drop()
except Exception:
log.exception("Dropping visualization_tag_association table failed.")
# Drop visualization_annotation_association table.
try:
VisualizationAnnotationAssociation_table.drop()
except Exception:
log.exception("Dropping visualization_annotation_association table failed.")
for table in TABLES:
drop_table(table)
@@ -5,12 +5,21 @@ from __future__ import print_function
import logging
from sqlalchemy import Column, ForeignKey, Integer, MetaData, String, Table
from sqlalchemy import (
Column,
ForeignKey,
Integer,
MetaData,
String,
Table
)
# Need our custom types, but don't import anything else from model
from galaxy.model.custom_types import JSONType
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
metadata = MetaData()
@@ -21,27 +30,15 @@ PostJobAction_table = Table("post_job_action", metadata,
Column("output_name", String(255), nullable=True),
Column("action_arguments", JSONType, nullable=True))
# PostJobActionAssociation_table = Table("post_job_action_association", metadata,
# Column("id", Integer, primary_key=True),
# Column("post_job_action_id", Integer, ForeignKey("post_job_action.id"), index=True, nullable=False),
# Column("job_id", Integer, ForeignKey("job.id"), index=True, nullable=False))
tables = [PostJobAction_table] # , PostJobActionAssociation_table]
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
for table in tables:
try:
table.create()
except Exception:
log.exception("Failed to create table '%s', ignoring (might result in wrong schema)" % table.name)
create_table(PostJobAction_table)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
for table in tables:
table.drop()
drop_table(PostJobAction_table)
@@ -4,21 +4,21 @@ Add a user_id column to the job table.
from __future__ import print_function
import logging
import sys
from sqlalchemy import Column, ForeignKey, Integer, MetaData, Table
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy import (
Column,
ForeignKey,
Integer,
MetaData,
Table
)
from galaxy.model.migrate.versions.util import add_column, drop_column
from galaxy.model.migrate.versions.util import (
add_column,
drop_column
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
@@ -27,37 +27,28 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
Job_table = Table("job", metadata, autoload=True)
col = Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True, nullable=True)
add_column(col, Job_table, metadata, index_name='ix_job_user_id')
try:
Job_table = Table("job", metadata, autoload=True)
except NoSuchTableError:
Job_table = None
log.debug("Failed loading table job")
if Job_table is not None:
# SQLAlchemy Migrate has a bug when adding a column with both a ForeignKey and a index in SQLite
if migrate_engine.name != 'sqlite':
col = Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True, nullable=True)
else:
col = Column("user_id", Integer, nullable=True)
add_column(col, Job_table, index_name='ix_job_user_id')
try:
cmd = "SELECT job.id AS galaxy_job_id, " \
+ "galaxy_session.user_id AS galaxy_user_id " \
+ "FROM job " \
+ "JOIN galaxy_session ON job.session_id = galaxy_session.id;"
job_users = migrate_engine.execute(cmd).fetchall()
print("Updating user_id column in job table for ", len(job_users), " rows...")
print("")
update_count = 0
for row in job_users:
if row.galaxy_user_id:
cmd = "UPDATE job SET user_id = %d WHERE id = %d" % (int(row.galaxy_user_id), int(row.galaxy_job_id))
update_count += 1
migrate_engine.execute(cmd)
print("Updated the user_id column for ", update_count, " rows in the job table. ")
print(len(job_users) - update_count, " rows have no user_id since the value was NULL in the galaxy_session table.")
print("")
except Exception:
log.exception("Updating job.user_id column failed.")
cmd = "SELECT job.id AS galaxy_job_id, " \
+ "galaxy_session.user_id AS galaxy_user_id " \
+ "FROM job " \
+ "JOIN galaxy_session ON job.session_id = galaxy_session.id;"
job_users = migrate_engine.execute(cmd).fetchall()
print("Updating user_id column in job table for ", len(job_users), " rows...")
print("")
update_count = 0
for row in job_users:
if row.galaxy_user_id:
cmd = "UPDATE job SET user_id = %d WHERE id = %d" % (int(row.galaxy_user_id), int(row.galaxy_job_id))
update_count += 1
migrate_engine.execute(cmd)
print("Updated column 'user_id' for ", update_count, " rows of table 'job'.")
print(len(job_users) - update_count, " rows have no user_id since the value was NULL in the galaxy_session table.")
print("")
except Exception:
log.exception("Updating column 'user_id' of table 'job' failed.")
def downgrade(migrate_engine):
@@ -4,21 +4,19 @@ Add a state column to the history_dataset_association and library_dataset_datase
from __future__ import print_function
import logging
import sys
from sqlalchemy import Column, MetaData, Table
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy import (
Column,
MetaData,
)
from galaxy.model.custom_types import TrimmedString
from galaxy.model.migrate.versions.util import (
add_column,
drop_column
)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
formatter = logging.Formatter(format)
handler.setFormatter(formatter)
log.addHandler(handler)
metadata = MetaData()
DATASET_INSTANCE_TABLE_NAMES = ['history_dataset_association', 'library_dataset_dataset_association']
@@ -29,36 +27,15 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
dataset_instance_tables = []
for table_name in DATASET_INSTANCE_TABLE_NAMES:
try:
dataset_instance_tables.append((table_name, Table(table_name, metadata, autoload=True)))
except NoSuchTableError:
log.debug("Failed loading table %s" % table_name)
if dataset_instance_tables:
for table_name, dataset_instance_table in dataset_instance_tables:
index_name = "ix_%s_state" % table_name
try:
col = Column("state", TrimmedString(64), index=True, nullable=True)
col.create(dataset_instance_table, index_name=index_name)
assert col is dataset_instance_table.c.state
except Exception:
log.exception("Adding column 'state' to %s table failed.", table_name)
col = Column("state", TrimmedString(64), index=True, nullable=True)
index_name = "ix_%s_state" % table_name
add_column(col, table_name, metadata, index_name=index_name)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
dataset_instance_tables = []
for table_name in DATASET_INSTANCE_TABLE_NAMES:
try:
dataset_instance_tables.append((table_name, Table(table_name, metadata, autoload=True)))
except NoSuchTableError:
log.debug("Failed loading table %s" % table_name)
if dataset_instance_tables:
for table_name, dataset_instance_table in dataset_instance_tables:
try:
col = dataset_instance_table.c.state
col.drop()
except Exception:
log.exception("Dropping column 'state' from %s table failed.", table_name)
drop_column('state', table_name, metadata)
@@ -21,7 +21,7 @@ def upgrade(migrate_engine):
# Create and initialize imported column in job table.
Jobs_table = Table("job", metadata, autoload=True)
c = Column("imported", Boolean, default=False, index=True)
add_column(c, Jobs_table, index_name="ix_job_imported")
add_column(c, Jobs_table, metadata, index_name="ix_job_imported")
try:
migrate_engine.execute("UPDATE job SET imported=%s" % engine_false(migrate_engine))
except Exception:
@@ -75,5 +75,4 @@ def upgrade(migrate_engine):
def downgrade(migrate_engine):
metadata.bind = migrate_engine
pass
@@ -6,9 +6,18 @@ from __future__ import print_function
import logging
from json import loads
from sqlalchemy import Column, Index, MetaData, Table, TEXT
from sqlalchemy import (
Column,
MetaData,
Table,
TEXT
)
from galaxy.model.migrate.versions.util import add_column, drop_column
from galaxy.model.migrate.versions.util import (
add_column,
add_index,
drop_column
)
log = logging.getLogger(__name__)
metadata = MetaData()
@@ -24,14 +33,13 @@ def upgrade(migrate_engine):
# Create dbkey columns.
x = Column("dbkey", TEXT)
add_column(x, Visualization_table)
add_column(x, Visualization_table, metadata)
y = Column("dbkey", TEXT)
add_column(y, Visualization_revision_table)
# Manually create indexes for compatability w/ mysql_length.
xi = Index("ix_visualization_dbkey", Visualization_table.c.dbkey, mysql_length=200)
xi.create()
yi = Index("ix_visualization_revision_dbkey", Visualization_revision_table.c.dbkey, mysql_length=200)
yi.create()
add_column(y, Visualization_revision_table, metadata)
# Indexes need to be added separately because MySQL cannot index a TEXT/BLOB
# column without specifying mysql_length
add_index("ix_visualization_dbkey", Visualization_table, 'dbkey')
add_index("ix_visualization_revision_dbkey", Visualization_revision_table, 'dbkey')
all_viz = migrate_engine.execute("SELECT visualization.id as viz_id, visualization_revision.id as viz_rev_id, visualization_revision.config FROM visualization_revision \
LEFT JOIN visualization ON visualization.id=visualization_revision.visualization_id")
@@ -5,11 +5,21 @@ from __future__ import print_function
import logging
from sqlalchemy import Column, ForeignKey, Integer, MetaData, String, Table
from sqlalchemy import (
Column,
ForeignKey,
Integer,
MetaData,
String,
Table
)
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
metadata = MetaData()
WorkflowOutput_table = Table("workflow_output", metadata,
@@ -17,22 +27,15 @@ WorkflowOutput_table = Table("workflow_output", metadata,
Column("workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True, nullable=False),
Column("output_name", String(255), nullable=True))
tables = [WorkflowOutput_table]
def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
for table in tables:
try:
table.create()
except Exception:
log.warning("Failed to create table '%s', ignoring (might result in wrong schema)" % table.name)
create_table(WorkflowOutput_table)
def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
for table in tables:
table.drop()
drop_table(WorkflowOutput_table)
@@ -33,7 +33,7 @@ def upgrade(migrate_engine):
# create the column again as JSONType
col = Column("notification", JSONType())
add_column(col, Request_table)
add_column(col, Request_table, metadata)
cmd = "SELECT id, user_id, notify FROM request"
result = migrate_engine.execute(cmd)
@@ -55,6 +55,6 @@ def downgrade(migrate_engine):
Request_table = Table("request", metadata, autoload=True)
if migrate_engine.name != 'sqlite':
c = Column("notify", Boolean, default=False)
add_column(c, Request_table)
add_column(c, Request_table, metadata)
drop_column('notification', Request_table)

Some files were not shown because too many files have changed in this diff Show More