From a3da69004a2c780c051ce6a0b99d6f8d16bc9e1e Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Thu, 17 Sep 2020 12:42:39 -0400 Subject: [PATCH 001/556] Converting Collections to Vue WIP --- .../DatasetCollectionElementView.vue | 93 +++ .../mvc/collection/ListCollectionCreator.vue | 651 ++++++++++++++++++ .../collection/ListCollectionCreatorModal.vue | 52 ++ .../mvc/collection/PairCollectionCreator.vue | 42 ++ .../collection/PairCollectionCreatorModal.vue | 41 ++ .../RuleBasedCollectionCreatorModal.vue | 97 +++ .../collection/mixins/CollectionCreator.vue | 113 +++ .../mixins/CollectionCreatorMixin.vue | 500 ++++++++++++++ .../mixins/CollectionCreatorModalMixin.vue | 40 ++ client/src/mvc/history/history-view-edit.js | 14 +- 10 files changed, 1640 insertions(+), 3 deletions(-) create mode 100644 client/src/mvc/collection/DatasetCollectionElementView.vue create mode 100644 client/src/mvc/collection/ListCollectionCreator.vue create mode 100644 client/src/mvc/collection/ListCollectionCreatorModal.vue create mode 100644 client/src/mvc/collection/PairCollectionCreator.vue create mode 100644 client/src/mvc/collection/PairCollectionCreatorModal.vue create mode 100644 client/src/mvc/collection/RuleBasedCollectionCreatorModal.vue create mode 100644 client/src/mvc/collection/mixins/CollectionCreator.vue create mode 100644 client/src/mvc/collection/mixins/CollectionCreatorMixin.vue create mode 100644 client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue diff --git a/client/src/mvc/collection/DatasetCollectionElementView.vue b/client/src/mvc/collection/DatasetCollectionElementView.vue new file mode 100644 index 00000000000..2b584011f6b --- /dev/null +++ b/client/src/mvc/collection/DatasetCollectionElementView.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/client/src/mvc/collection/ListCollectionCreator.vue b/client/src/mvc/collection/ListCollectionCreator.vue new file mode 100644 index 00000000000..8a9e6406c6b --- /dev/null +++ b/client/src/mvc/collection/ListCollectionCreator.vue @@ -0,0 +1,651 @@ + + + + + diff --git a/client/src/mvc/collection/ListCollectionCreatorModal.vue b/client/src/mvc/collection/ListCollectionCreatorModal.vue new file mode 100644 index 00000000000..ea96d11771f --- /dev/null +++ b/client/src/mvc/collection/ListCollectionCreatorModal.vue @@ -0,0 +1,52 @@ + diff --git a/client/src/mvc/collection/PairCollectionCreator.vue b/client/src/mvc/collection/PairCollectionCreator.vue new file mode 100644 index 00000000000..6113e9e669d --- /dev/null +++ b/client/src/mvc/collection/PairCollectionCreator.vue @@ -0,0 +1,42 @@ + + diff --git a/client/src/mvc/collection/PairCollectionCreatorModal.vue b/client/src/mvc/collection/PairCollectionCreatorModal.vue new file mode 100644 index 00000000000..4c50a2bbc26 --- /dev/null +++ b/client/src/mvc/collection/PairCollectionCreatorModal.vue @@ -0,0 +1,41 @@ + diff --git a/client/src/mvc/collection/RuleBasedCollectionCreatorModal.vue b/client/src/mvc/collection/RuleBasedCollectionCreatorModal.vue new file mode 100644 index 00000000000..12966849747 --- /dev/null +++ b/client/src/mvc/collection/RuleBasedCollectionCreatorModal.vue @@ -0,0 +1,97 @@ + \ No newline at end of file diff --git a/client/src/mvc/collection/mixins/CollectionCreator.vue b/client/src/mvc/collection/mixins/CollectionCreator.vue new file mode 100644 index 00000000000..3a41763c37f --- /dev/null +++ b/client/src/mvc/collection/mixins/CollectionCreator.vue @@ -0,0 +1,113 @@ + + + diff --git a/client/src/mvc/collection/mixins/CollectionCreatorMixin.vue b/client/src/mvc/collection/mixins/CollectionCreatorMixin.vue new file mode 100644 index 00000000000..24e88c4a313 --- /dev/null +++ b/client/src/mvc/collection/mixins/CollectionCreatorMixin.vue @@ -0,0 +1,500 @@ + + + diff --git a/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue b/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue new file mode 100644 index 00000000000..46d021396eb --- /dev/null +++ b/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue @@ -0,0 +1,40 @@ + + + diff --git a/client/src/mvc/history/history-view-edit.js b/client/src/mvc/history/history-view-edit.js index 7911709d8ad..41addefa56f 100644 --- a/client/src/mvc/history/history-view-edit.js +++ b/client/src/mvc/history/history-view-edit.js @@ -7,7 +7,9 @@ import HDA_LI_EDIT from "mvc/history/hda-li-edit"; import HDCA_LI_EDIT from "mvc/history/hdca-li-edit"; import { mountModelTags } from "components/Tags"; import ANNOTATIONS from "mvc/annotation"; -import LIST_COLLECTION_CREATOR from "mvc/collection/list-collection-creator"; +import Vue from "vue"; +import ListCollectionCreatorModal from "mvc/collection/ListCollectionCreatorModal"; +import RuleBasedCollectionCreatorModal from "mvc/collection/RuleBasedCollectionCreatorModal"; import PAIR_COLLECTION_CREATOR from "mvc/collection/pair-collection-creator"; import LIST_OF_PAIRS_COLLECTION_CREATOR from "mvc/collection/list-of-pairs-collection-creator"; import faIconButton from "ui/fa-icon-button"; @@ -372,13 +374,19 @@ var HistoryViewEdit = _super.extend( hideSourceItems = hideSourceItems || false; var createFunc; if (collectionType == "list") { - createFunc = LIST_COLLECTION_CREATOR.createListCollection; + const ListCollectionCreatorModalClass = Vue.extend(ListCollectionCreatorModal); + const inst = new ListCollectionCreatorModalClass(); + inst.$mount(); + createFunc = inst.createListCollection; } else if (collectionType == "paired") { createFunc = PAIR_COLLECTION_CREATOR.createPairCollection; } else if (collectionType == "list:paired") { createFunc = LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection; } else if (collectionType.startsWith("rules")) { - createFunc = LIST_COLLECTION_CREATOR.createCollectionViaRules; + const RuleBasedCollectionCreatorModalClass = Vue.extend(RuleBasedCollectionCreatorModal); + const inst = new RuleBasedCollectionCreatorModalClass(); + inst.$mount(); + createFunc = inst.createCollectionViaRules; } else { console.warn(`Unknown collectionType encountered ${collectionType}`); } From d3c00fb43a1f588d766cc21a299267c45312b7f6 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Thu, 17 Sep 2020 22:38:59 -0400 Subject: [PATCH 002/556] Converting Collections to Vue WIP --- .../collection/DatasetCollectionElementView.vue | 14 +------------- .../src/mvc/collection/ListCollectionCreator.vue | 10 +++------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/client/src/mvc/collection/DatasetCollectionElementView.vue b/client/src/mvc/collection/DatasetCollectionElementView.vue index 2b584011f6b..e70af15f4ea 100644 --- a/client/src/mvc/collection/DatasetCollectionElementView.vue +++ b/client/src/mvc/collection/DatasetCollectionElementView.vue @@ -44,7 +44,6 @@ export default { }, clickDiscard: function () { this.$emit("element-is-discarded", this.element); - this.$destroy(); }, // }, //TODO: template, rendering, OR conditional 'rendering (i.e. belongs in template) @@ -63,18 +62,7 @@ export default { // this.$el.addClass("dragging"); // this.$el.parent().trigger("collection-element.dragstart", [this]); // }, - //TODO: actual method - must be rewritten, assess whether methods/created/computed/etc. - // /** animate the removal of this element and pub */ - // discard() { - // var view = this; - // var parentWidth = this.$el.parent().width(); - // this.$el.animate({ "margin-right": parentWidth }, "fast", () => { - // view.trigger("discard", { - // source: view, - // }); - // view.destroy(); - // }); - // }, + /** string rep */ toString() { return "DatasetCollectionElementView()"; diff --git a/client/src/mvc/collection/ListCollectionCreator.vue b/client/src/mvc/collection/ListCollectionCreator.vue index 8a9e6406c6b..a98b4d6cb72 100644 --- a/client/src/mvc/collection/ListCollectionCreator.vue +++ b/client/src/mvc/collection/ListCollectionCreator.vue @@ -138,13 +138,14 @@ export default { titleUndoButton: _l("Undo all reordering and discards"), titleDeselectButton: _l("De-select all selected datasets"), selectedDatasetElems: [], + workingElements:[], }; }, mixins: [CollectionCreatorMixin], props: { initialElements: { - required: false, - default: [], + required: true, + type: Array, }, creationFn: { type: Function, @@ -191,7 +192,6 @@ export default { return this.selectedDatasetElems; }, returnWorkingElements: function () { - console.log("in returnWE method"); return this.workingElements; }, }, @@ -204,11 +204,7 @@ export default { } }, elementDiscarded(e) { - console.log("BOB deleting " + e.id); - //this.workingElements.splice(this.workingElements.indexOf(e), 1); this.$delete(this.workingElements, this.workingElements.indexOf(e)); - console.log(this.workingElements); - this.$forceUpdate(); return this.workingElements; }, clickClearAll() { From a2da8910bfbcf0667ace4247de2496ad1fda3fc1 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Tue, 22 Sep 2020 14:38:08 +0100 Subject: [PATCH 003/556] Can set undesired execution hosts to avoid in LSF --- lib/galaxy/jobs/runners/util/cli/job/lsf.py | 30 ++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/jobs/runners/util/cli/job/lsf.py b/lib/galaxy/jobs/runners/util/cli/job/lsf.py index 0c4a805ac24..dd302f8f8b3 100644 --- a/lib/galaxy/jobs/runners/util/cli/job/lsf.py +++ b/lib/galaxy/jobs/runners/util/cli/job/lsf.py @@ -1,6 +1,7 @@ # A simple CLI runner for slurm that can be used when running Galaxy from a # non-submit host and using a Slurm cluster. from logging import getLogger +from os import path from galaxy.jobs import JobState try: @@ -37,7 +38,7 @@ class LSF(BaseJobExec): # Map arguments using argmap. for k, v in self.params.items(): - if k == 'plugin': + if k == 'plugin' or k == 'excluded_hosts': continue try: if k == 'memory': @@ -53,6 +54,9 @@ class LSF(BaseJobExec): template_scriptargs = '' for k, v in scriptargs.items(): template_scriptargs += '#BSUB {} {}\n'.format(k, v) + # Excluded hosts use the same -R option already in use for mem, so easier adding here. + for host in self._get_excluded_hosts(): + template_scriptargs += '#BSUB -R \"select[hname!=\'{}\']\"\n'.format(host) return dict(headers=template_scriptargs) def submit(self, script_file): @@ -124,6 +128,30 @@ class LSF(BaseJobExec): }.get(state) except KeyError: raise KeyError("Failed to map LSF status code [%s] to job state." % state) + + def _get_excluded_hosts(self): + """ + Reads a file in the set path with one node name per line. All these nodes will be added + to the exclusion list for execution. + + The path can be added to destinations like this: + + + LocalShell + LSF + 16000 + 7 + /path/to/file/with/hosts/to/exclude/one/per/line.txt + + + :param pathExcludedNodes: + :return: list with node names + """ + if "excluded_hosts" in self.params: + path_excluded = self.params["excluded_hosts"] + if path.isfile(path_excluded): + return open(path_excluded).read().splitlines() + return list() __all__ = ('LSF',) From 2262b9c44898bd3134f23d6e24e0100fce58fd3b Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Tue, 22 Sep 2020 14:51:52 +0100 Subject: [PATCH 004/556] Add some doc on job_conf advanced sample --- lib/galaxy/config/sample/job_conf.xml.sample_advanced | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/galaxy/config/sample/job_conf.xml.sample_advanced b/lib/galaxy/config/sample/job_conf.xml.sample_advanced index 46302ca0260..90a57df2f6f 100644 --- a/lib/galaxy/config/sample/job_conf.xml.sample_advanced +++ b/lib/galaxy/config/sample/job_conf.xml.sample_advanced @@ -820,6 +820,10 @@ 16000 8 BigMem + + /path/to/file/with/hosts/to/be/excluded/one_per_line.txt From fa5bc510310db4dd87b59313772b33ded3b019ba Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Tue, 22 Sep 2020 11:12:24 -0400 Subject: [PATCH 005/556] Converting Collections to Vue WIP --- .../mvc/collection/mixins/CollectionCreatorModalMixin.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue b/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue index 46d021396eb..75b72e5efc9 100644 --- a/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue +++ b/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue @@ -14,7 +14,7 @@ export default { const creatorOptions = _.defaults(options || {}, { oncancel: function () { modal.hide(); - this.$destroy(); + deferred.reject("cancelled"); }, oncreate: function (creator, response) { modal.hide(); @@ -35,6 +35,4 @@ export default { }, }, }; - - - + \ No newline at end of file From c4cbf29278eecbce761c3c7369b36ecf7eb89d6c Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Tue, 22 Sep 2020 21:34:46 +0100 Subject: [PATCH 006/556] Please lintern --- lib/galaxy/jobs/runners/util/cli/job/lsf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/jobs/runners/util/cli/job/lsf.py b/lib/galaxy/jobs/runners/util/cli/job/lsf.py index dd302f8f8b3..25bfa0262ea 100644 --- a/lib/galaxy/jobs/runners/util/cli/job/lsf.py +++ b/lib/galaxy/jobs/runners/util/cli/job/lsf.py @@ -128,14 +128,14 @@ class LSF(BaseJobExec): }.get(state) except KeyError: raise KeyError("Failed to map LSF status code [%s] to job state." % state) - + def _get_excluded_hosts(self): """ Reads a file in the set path with one node name per line. All these nodes will be added to the exclusion list for execution. - + The path can be added to destinations like this: - + LocalShell LSF @@ -151,7 +151,7 @@ class LSF(BaseJobExec): path_excluded = self.params["excluded_hosts"] if path.isfile(path_excluded): return open(path_excluded).read().splitlines() - return list() + return list() __all__ = ('LSF',) From 68a0825ff3d06a35026fb8939d1ae3241efb11e3 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Mon, 28 Sep 2020 21:15:38 -0400 Subject: [PATCH 007/556] Converting Collections to Vue WIP --- .../mvc/collection/ListCollectionCreator.vue | 137 ++++++------------ .../mvc/collection/PairCollectionCreator.vue | 4 - .../RuleBasedCollectionCreatorModal.vue | 6 +- .../mvc/collection/list-collection-creator.js | 6 +- .../mixins/CollectionCreatorModalMixin.vue | 2 +- 5 files changed, 50 insertions(+), 105 deletions(-) diff --git a/client/src/mvc/collection/ListCollectionCreator.vue b/client/src/mvc/collection/ListCollectionCreator.vue index a98b4d6cb72..8fd09339aa8 100644 --- a/client/src/mvc/collection/ListCollectionCreator.vue +++ b/client/src/mvc/collection/ListCollectionCreator.vue @@ -138,7 +138,7 @@ export default { titleUndoButton: _l("Undo all reordering and discards"), titleDeselectButton: _l("De-select all selected datasets"), selectedDatasetElems: [], - workingElements:[], + workingElements: [], }; }, mixins: [CollectionCreatorMixin], @@ -236,10 +236,49 @@ export default { this.elementViews = []; // copy initial list, sort, add ids if needed this.workingElements = this.initialElements.slice(0); - // this._ensureElementIds(); - // this._validateElements(); + this._ensureElementIds(); + this._validateElements(); // this._mangleDuplicateNames(); }, + /** add ids to dataset objs in initial list if none */ + _ensureElementIds: function () { + this.workingElements.forEach((element) => { + if (!Object.prototype.hasOwnProperty.call(element, "id")) { + element.id = element._uid; + } + }); + return this.workingElements; + }, + // /** separate working list into valid and invalid elements for this collection */ + _validateElements: function () { + var creator = this; + creator.invalidElements = []; + this.workingElements = this.workingElements.filter((element) => { + var problem = creator._isElementInvalid(element); + if (problem) { + creator.invalidElements.push({ + element: element, + text: problem, + }); + } + return !problem; + }); + return this.workingElements; + }, + /** describe what is wrong with a particular element if anything */ + _isElementInvalid: function (element) { + if (element.history_content_type === "dataset_collection") { + return _l("is a collection, this is not allowed"); + } + var validState = element.state === STATES.OK || STATES.NOT_READY_STATE.contains(element.state); + if (!validState) { + return _l("has errored, is paused, or is not accessible"); + } + if (element.deleted || element.purged) { + return _l("has been deleted or purged"); + } + return null; + }, /** convert element into JSON compatible with the collections API */ _elementToJSON: function (element) { // return element.toJSON(); @@ -289,29 +328,6 @@ export default { // // this.$( '.create-collection' ).removeClass( 'disable' ); // } // }, - // /** render the elements in order (or a warning if no elements found) */ - // _renderList: function (speed, callback) { - // //this.debug( '-- _renderList' ); - // var creator = this; - // var $tmp = $("
"); - // var $list = creator.$list(); - // _.each(this.elementViews, (view) => { - // view.destroy(); - // creator.removeElementView(view); - // }); - // creator.workingElements.forEach((element) => { - // var elementView = creator._createElementView(element); - // $tmp.append(elementView.$el); - // }); - // creator._renderClearSelected(); - // $list.empty().append($tmp.children()); - // _.invoke(creator.elementViews, "render"); - // if ($list.height() > $list.css("max-height")) { - // $list.css("border-width", "1px 0px 1px 0px"); - // } else { - // $list.css("border-width", "0px"); - // } - // }, // /** set up event handlers on self */ // _setUpBehaviors: function () { // this.on("error", this._errorHandler); @@ -387,45 +403,6 @@ export default { // this.$dragging = null; // }, //TODO: actual method - must be rewritten, assess whether methods/created/computed/etc. - // /** separate working list into valid and invalid elements for this collection */ - // _validateElements: function () { - // var creator = this; - // creator.invalidElements = []; - // this.workingElements = this.workingElements.filter((element) => { - // var problem = creator._isElementInvalid(element); - // if (problem) { - // creator.invalidElements.push({ - // element: element, - // text: problem, - // }); - // } - // return !problem; - // }); - // return this.workingElements; - // }, - // /** add ids to dataset objs in initial list if none */ - // _ensureElementIds: function () { - // this.workingElements.forEach((element) => { - // if (!Object.prototype.hasOwnProperty.call(element, "id")) { - // element.id = _.uniqueId(); - // } - // }); - // return this.workingElements; - // }, - // /** describe what is wrong with a particular element if anything */ - // _isElementInvalid: function (element) { - // if (element.history_content_type === "dataset_collection") { - // return _l("is a collection, this is not allowed"); - // } - // var validState = element.state === STATES.OK || _.contains(STATES.NOT_READY_STATES, element.state); - // if (!validState) { - // return _l("has errored, is paused, or is not accessible"); - // } - // if (element.deleted || element.purged) { - // return _l("has been deleted or purged"); - // } - // return null; - // }, // /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */ // _mangleDuplicateNames: function () { // var SAFETY = 900; @@ -505,36 +482,6 @@ export default { // $list: function () { // return this.$(".collection-elements"); // }, - // /** create an element view, cache in elementViews, set up listeners, and return */ - // _createElementView: function (element) { - // var elementView = new this.elementViewClass({ - // //TODO: use non-generic class or not all - // // model : COLLECTION.DatasetDCE( element ) - // element: element, - // selected: _.has(this.selectedIds, element.id), - // }); - // this.elementViews.push(elementView); - // this._listenToElementView(elementView); - // return elementView; - // }, - // /** listen to any element events */ - // _listenToElementView: function (view) { - // var creator = this; - // creator.listenTo(view, { - // select: function (data) { - // var element = data.source.element; - // if (data.selected) { - // creator.selectedIds[element.id] = true; - // } else { - // delete creator.selectedIds[element.id]; - // } - // creator.trigger("elements:select", data); - // }, - // discard: function (data) { - // creator.trigger("elements:discard", data); - // }, - // }); - // }, // /** resync the creator's list of elements based on the DOM order */ // _syncOrderToDom: function () { // var creator = this; diff --git a/client/src/mvc/collection/PairCollectionCreator.vue b/client/src/mvc/collection/PairCollectionCreator.vue index 6113e9e669d..6293c385793 100644 --- a/client/src/mvc/collection/PairCollectionCreator.vue +++ b/client/src/mvc/collection/PairCollectionCreator.vue @@ -36,7 +36,3 @@ - diff --git a/client/src/mvc/collection/RuleBasedCollectionCreatorModal.vue b/client/src/mvc/collection/RuleBasedCollectionCreatorModal.vue index 12966849747..2e315fb3dae 100644 --- a/client/src/mvc/collection/RuleBasedCollectionCreatorModal.vue +++ b/client/src/mvc/collection/RuleBasedCollectionCreatorModal.vue @@ -4,9 +4,7 @@ import _ from "underscore"; import _l from "utils/localization"; import Vue from "vue"; export default { - mixins: [ - CollectionCreatorModalMixin, - ], + mixins: [CollectionCreatorModalMixin], methods: { ruleBasedCollectionCreatorModal: function (elements, elementsType, importType, options) { // importType in [datasets, collection] @@ -94,4 +92,4 @@ export default { }, }, }; - \ No newline at end of file + diff --git a/client/src/mvc/collection/list-collection-creator.js b/client/src/mvc/collection/list-collection-creator.js index f30bf474afd..66e96823c1e 100644 --- a/client/src/mvc/collection/list-collection-creator.js +++ b/client/src/mvc/collection/list-collection-creator.js @@ -1,6 +1,7 @@ import _ from "underscore"; import jQuery from "jquery"; import Backbone from "backbone"; +import CCMM from "./mixins/CollectionCreatorModalMixin"; import HDCA from "mvc/history/hdca-model"; import STATES from "mvc/dataset/states"; import BASE_MVC from "mvc/base-mvc"; @@ -1045,7 +1046,10 @@ var collectionCreatorModal = function _collectionCreatorModal(elements, options, options = _.defaults(options || {}, { elements: elements, }); - const { deferred, creatorOptions, showEl } = collectionCreatorModalSetup(options); + const clazz = Vue.extend(CCMM); + const inst = new clazz(); + inst.$mount(); + const { deferred, creatorOptions, showEl } = inst.collectionCreatorModalSetup(options); var creator = new CreatorClass(creatorOptions); showEl(creator.$el); creator.render(); diff --git a/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue b/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue index 75b72e5efc9..e8b1f03d434 100644 --- a/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue +++ b/client/src/mvc/collection/mixins/CollectionCreatorModalMixin.vue @@ -35,4 +35,4 @@ export default { }, }, }; - \ No newline at end of file + From 041e34400a14071b855ba70cd620eeaab29fd7ac Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Wed, 30 Sep 2020 09:58:56 +0100 Subject: [PATCH 008/556] Return inside with Co-authored-by: Nicola Soranzo --- lib/galaxy/jobs/runners/util/cli/job/lsf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/jobs/runners/util/cli/job/lsf.py b/lib/galaxy/jobs/runners/util/cli/job/lsf.py index 25bfa0262ea..7de48a2e620 100644 --- a/lib/galaxy/jobs/runners/util/cli/job/lsf.py +++ b/lib/galaxy/jobs/runners/util/cli/job/lsf.py @@ -150,7 +150,8 @@ class LSF(BaseJobExec): if "excluded_hosts" in self.params: path_excluded = self.params["excluded_hosts"] if path.isfile(path_excluded): - return open(path_excluded).read().splitlines() + with open(path_excluded) as f: + return f.read().splitlines() return list() From 4d5137f12a1c9a52bbb55169f4c71289e0dc275f Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Wed, 30 Sep 2020 18:45:51 -0400 Subject: [PATCH 009/556] Converting Collections to Vue WIP --- .../mvc/collection/ListCollectionCreator.vue | 348 ++++++++++-------- .../collection/mixins/CollectionCreator.vue | 5 - .../mixins/CollectionCreatorMixin.vue | 21 -- 3 files changed, 185 insertions(+), 189 deletions(-) diff --git a/client/src/mvc/collection/ListCollectionCreator.vue b/client/src/mvc/collection/ListCollectionCreator.vue index 8fd09339aa8..dc2161777d3 100644 --- a/client/src/mvc/collection/ListCollectionCreator.vue +++ b/client/src/mvc/collection/ListCollectionCreator.vue @@ -1,112 +1,164 @@ @@ -192,6 +191,12 @@ import BootstrapVue from "bootstrap-vue"; Vue.use(BootstrapVue); export default { + created() { + this._setUpCommonSettings(this.$props); + this._instanceSetUp(); + this._elementsSetUp(); + }, + components: { DatasetCollectionElementView }, data: function () { return { minElements: 1, @@ -224,12 +229,6 @@ export default { type: Function, required: true, }, - /** fn to call when the collection is created (scoped to this) */ - oncreate: { - type: Function, - required: false, - default: () => {}, - }, /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */ oncancel: { type: Function, @@ -284,20 +283,6 @@ export default { }, }, methods: { - elementSelected(e) { - if (!this.selectedDatasetElems.includes(e.id)) { - this.selectedDatasetElems.push(e.id); - } else { - this.selectedDatasetElems.splice(this.selectedDatasetElems.indexOf(e.id), 1); - } - }, - elementDiscarded(e) { - this.$delete(this.workingElements, this.workingElements.indexOf(e)); - return this.workingElements; - }, - clickClearAll() { - this.selectedDatasetElems = []; - }, l(str) { // _l conflicts private methods of Vue internals, expose as l instead return _l(str); @@ -326,7 +311,7 @@ export default { this.workingElements = this.initialElements.slice(0); this._ensureElementIds(); this._validateElements(); - // this._mangleDuplicateNames(); + this._mangleDuplicateNames(); }, /** add ids to dataset objs in initial list if none */ _ensureElementIds: function () { @@ -362,6 +347,44 @@ export default { } return null; }, + // /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */ + _mangleDuplicateNames: function () { + var SAFETY = 900; + var counter = 1; + var existingNames = {}; + this.workingElements.forEach((element) => { + var currName = element.name; + while (Object.prototype.hasOwnProperty.call(existingNames, currName)) { + currName = `${element.name} (${counter})`; + counter += 1; + if (counter >= SAFETY) { + throw new Error("Safety hit in while loop - thats impressive"); + } + } + element.name = currName; + existingNames[element.name] = true; + }); + }, + elementSelected(e) { + if (!this.selectedDatasetElems.includes(e.id)) { + this.selectedDatasetElems.push(e.id); + } else { + this.selectedDatasetElems.splice(this.selectedDatasetElems.indexOf(e.id), 1); + } + }, + elementDiscarded(e) { + this.$delete(this.workingElements, this.workingElements.indexOf(e)); + return this.workingElements; + }, + clickClearAll() { + this.selectedDatasetElems = []; + }, + hideOriginalsToggle: function () { + this.defaultHideSourceItems = !this.defaultHideSourceItems; + }, + clickedCreate: function () { + this.creationFn(this.workingElements, this._getName, this.defaultHideSourceItems); + }, /** convert element into JSON compatible with the collections API */ _elementToJSON: function (element) { // return element.toJSON(); @@ -387,28 +410,6 @@ export default { // // this.$( '.create-collection' ).removeClass( 'disable' ); // } // }, - // /** set up event handlers on self */ - // _setUpBehaviors: function () { - // this.on("error", this._errorHandler); - // this.once("rendered", function () { - // this.trigger("rendered:initial", this); - // }); - // this.on("elements:select", function (data) { - // this._renderClearSelected(); - // }); - // this.on("elements:discard", function (data) { - // var element = data.source.element; - // this.removeElementView(data.source); - // this.workingElements = _.without(this.workingElements, element); - // if (!this.workingElements.length) { - // this._renderNoElementsLeft(); - // } - // }); - // //this.on( 'all', function(){ - // // this.info( arguments ); - // //}); - // return this; - // }, // /** track the mouse drag over the list adding a placeholder to show where the drop would occur */ // _dragoverElements: function (ev) { // //this.debug( '_dragoverElements:', ev ); @@ -457,51 +458,27 @@ export default { // this.$dragging = null; // }, //TODO: actual method - must be rewritten, assess whether methods/created/computed/etc. - // /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */ - // _mangleDuplicateNames: function () { - // var SAFETY = 900; - // var counter = 1; - // var existingNames = {}; - // this.workingElements.forEach((element) => { - // var currName = element.name; - // while (Object.prototype.hasOwnProperty.call(existingNames, currName)) { - // currName = `${element.name} (${counter})`; - // counter += 1; - // if (counter >= SAFETY) { - // throw new Error("Safety hit in while loop - thats impressive"); - // } + /** handle errors with feedback and details to the user (if available) */ + // _errorHandler: function (data) { + // this.error(data); + // var creator = this; + // var content = data.message || _l("An error occurred"); + // if (data.xhr) { + // var xhr = data.xhr; + // var message = data.message; + // if (xhr.readyState === 0 && xhr.status === 0) { + // content += `: ${_l("Galaxy could not be reached and may be updating.")}${_l( + // " Try again in a few minutes." + // )}`; + // } else if (xhr.responseJSON) { + // content += `:
${JSON.stringify(xhr.responseJSON)}
`; + // } else { + // content += `: ${message}`; // } - // element.name = currName; - // existingNames[element.name] = true; - // }); + // } + // creator._showAlert(content, "alert-danger"); // }, - // /** handle errors with feedback and details to the user (if available) */ - // _errorHandler: function (data) { - // this.error(data); - // var creator = this; - // var content = data.message || _l("An error occurred"); - // if (data.xhr) { - // var xhr = data.xhr; - // var message = data.message; - // if (xhr.readyState === 0 && xhr.status === 0) { - // content += `: ${_l("Galaxy could not be reached and may be updating.")}${_l( - // " Try again in a few minutes." - // )}`; - // } else if (xhr.responseJSON) { - // content += `:
${JSON.stringify(xhr.responseJSON)}
`; - // } else { - // content += `: ${message}`; - // } - // } - // creator._showAlert(content, "alert-danger"); - // }, }, - created() { - this._setUpCommonSettings(this.$props); - this._instanceSetUp(); - this._elementsSetUp(); - }, - components: { DatasetCollectionElementView }, }; diff --git a/client/src/mvc/collection/mixins/CollectionCreator.vue b/client/src/mvc/collection/mixins/CollectionCreator.vue index a66e8bb5205..bdd748f1ce5 100644 --- a/client/src/mvc/collection/mixins/CollectionCreator.vue +++ b/client/src/mvc/collection/mixins/CollectionCreator.vue @@ -38,11 +38,15 @@
- +
{{ l("Name:") }}
@@ -61,7 +65,7 @@
-
@@ -78,6 +82,15 @@ export default { type: Function, required: true, }, + creationFn: { + type: Function, + required: true, + }, + }, + computed: { + validInput: function () { + return this.collectionName.length > 0; + }, }, data: function () { return { @@ -87,6 +100,7 @@ export default { placeholderEnterName: _l("Enter a name for your new collection"), dropdownText: _l("Create a single pair"), isExpanded: false, + collectionName: "", }; }, methods: { @@ -94,8 +108,6 @@ export default { // _l conflicts private methods of Vue internals, expose as l instead return _l(str); }, - // ........................................................................ header - /** expand help */ _clickForHelp: function () { this.isExpanded = !this.isExpanded; return this.isExpanded; @@ -103,6 +115,12 @@ export default { _cancelCreate: function () { this.oncancel(); }, + _getName: function () { + return this.collectionName; + }, + _setUpCommonSettings: function (attributes) { + this.hideOriginals = attributes.defaultHideSourceItems || false; + }, }, }; diff --git a/client/src/mvc/collection/mixins/CollectionCreatorMixin.vue b/client/src/mvc/collection/mixins/CollectionCreatorMixin.vue index 2d642372f33..b175932714e 100644 --- a/client/src/mvc/collection/mixins/CollectionCreatorMixin.vue +++ b/client/src/mvc/collection/mixins/CollectionCreatorMixin.vue @@ -1,52 +1,10 @@ diff --git a/client/src/mvc/collection/ListCollectionCreator.vue b/client/src/mvc/collection/ListCollectionCreator.vue index 7901268da66..dc3fbced570 100644 --- a/client/src/mvc/collection/ListCollectionCreator.vue +++ b/client/src/mvc/collection/ListCollectionCreator.vue @@ -46,7 +46,11 @@ - + -
+
@@ -174,8 +178,6 @@ - - --> @@ -234,6 +236,15 @@ export default { type: Function, required: true, }, + oncreate: { + type: Function, + required: true, + }, + defaultHideSourceItems: { + type: Boolean, + required: false, + default: true, + }, /** distance from list edge to begin autoscrolling list */ autoscrollDist: { type: Number, @@ -246,11 +257,6 @@ export default { required: false, default: "rgba( 64, 255, 255, 1.0 )", }, - defaultHideSourceItems: { - type: Boolean, - required: false, - default: true, - }, }, watch: {}, computed: { @@ -365,31 +371,35 @@ export default { existingNames[element.name] = true; }); }, - elementSelected(e) { + elementSelected: function (e) { if (!this.selectedDatasetElems.includes(e.id)) { this.selectedDatasetElems.push(e.id); } else { this.selectedDatasetElems.splice(this.selectedDatasetElems.indexOf(e.id), 1); } }, - elementDiscarded(e) { + elementDiscarded: function (e) { this.$delete(this.workingElements, this.workingElements.indexOf(e)); return this.workingElements; }, - clickClearAll() { + clickClearAll: function () { this.selectedDatasetElems = []; }, hideOriginalsToggle: function () { this.defaultHideSourceItems = !this.defaultHideSourceItems; }, - clickedCreate: function () { - this.creationFn(this.workingElements, this._getName, this.defaultHideSourceItems); + clickedCreate: function (collectionName) { + this.creationFn(this.workingElements, collectionName, this.defaultHideSourceItems); + this.oncreate(); }, /** convert element into JSON compatible with the collections API */ _elementToJSON: function (element) { // return element.toJSON(); return element; }, + _getName: function () { + return; + }, /** reset all data to the initial state */ reset: function () { this._instanceSetUp(); @@ -400,16 +410,6 @@ export default { return "ListCollectionCreator"; }, //TODO: template, rendering, OR conditional rendering (i.e. belongs in template) - // _disableNameAndCreate: function (disable) { - // disable = !_.isUndefined(disable) ? disable : true; - // if (disable) { - // this.$(".collection-name").prop("disabled", true); - // this.$(".create-collection").toggleClass("disabled", true); - // // } else { - // // this.$( '.collection-name' ).prop( 'disabled', false ); - // // this.$( '.create-collection' ).removeClass( 'disable' ); - // } - // }, // /** track the mouse drag over the list adding a placeholder to show where the drop would occur */ // _dragoverElements: function (ev) { // //this.debug( '_dragoverElements:', ev ); diff --git a/client/src/mvc/collection/mixins/CollectionCreator.vue b/client/src/mvc/collection/mixins/CollectionCreator.vue index bdd748f1ce5..e5f5f09055a 100644 --- a/client/src/mvc/collection/mixins/CollectionCreator.vue +++ b/client/src/mvc/collection/mixins/CollectionCreator.vue @@ -38,7 +38,11 @@
@@ -65,7 +69,11 @@
-
From ce95df1df07b886813add04c57fea41bd3f3d562 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Fri, 9 Oct 2020 00:55:16 -0400 Subject: [PATCH 022/556] Converting Collections to Vue WIP --- .../DatasetCollectionElementView.vue | 8 +- .../mvc/collection/ListCollectionCreator.vue | 359 +++++++++--------- 2 files changed, 171 insertions(+), 196 deletions(-) diff --git a/client/src/mvc/collection/DatasetCollectionElementView.vue b/client/src/mvc/collection/DatasetCollectionElementView.vue index 15b0c2c611e..ec83b14063f 100644 --- a/client/src/mvc/collection/DatasetCollectionElementView.vue +++ b/client/src/mvc/collection/DatasetCollectionElementView.vue @@ -1,5 +1,5 @@