commit/galaxy-central: 5 new changesets
5 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/bf3c4ce994bf/ Changeset: bf3c4ce994bf User: jmchilton Date: 2014-04-21 21:26:56 Summary: Fix comment in lib/galaxy/workflow/run.py Affected #: 1 file diff -r 64ae9dc170214097c419febe12e52b86bea12020 -r bf3c4ce994bf25c3744338a3d8edbdb5da847fe4 lib/galaxy/workflow/run.py --- a/lib/galaxy/workflow/run.py +++ b/lib/galaxy/workflow/run.py @@ -66,9 +66,10 @@ workflow_invocation = model.WorkflowInvocation() workflow_invocation.workflow = self.workflow - # Web controller will populate stateful modules on each step before calling invoke - # but not API controller. More work should be done to further harmonize these methods - # going forward if possible - if possible moving more web controller logic here. + # Web controller will populate state on each step before calling + # invoke but not API controller. More work should be done to further + # harmonize these methods going forward if possible - if possible + # moving more web controller logic here. state_populated = not self.workflow.steps or hasattr( self.workflow.steps[ 0 ], "state" ) if not state_populated: self._populate_state( ) https://bitbucket.org/galaxy/galaxy-central/commits/6d1b5997e85b/ Changeset: 6d1b5997e85b User: jmchilton Date: 2014-04-21 21:27:01 Summary: Workflow Editor: Rename can_accept to canAccept. Affected #: 2 files diff -r bf3c4ce994bf25c3744338a3d8edbdb5da847fe4 -r 6d1b5997e85b9bdb75308fdb5db6cb5fa7e09941 static/scripts/galaxy.workflow_editor.canvas.js --- a/static/scripts/galaxy.workflow_editor.canvas.js +++ b/static/scripts/galaxy.workflow_editor.canvas.js @@ -41,7 +41,7 @@ this.datatypes = attr.datatypes; this.multiple = attr.multiple; }, - can_accept: function ( other ) { + canAccept: function ( other ) { if ( this.connectors.length < 1 || this.multiple) { for ( var t in this.datatypes ) { var cat_outputs = new Array(); @@ -989,7 +989,7 @@ var terminal = this.el.terminal; // Accept a dragable if it is an output terminal and has a // compatible type - return $(d.drag).hasClass( "output-terminal" ) && terminal.can_accept( d.drag.terminal ); + return $(d.drag).hasClass( "output-terminal" ) && terminal.canAccept( d.drag.terminal ); }, onDropStart: function( e, d ) { diff -r bf3c4ce994bf25c3744338a3d8edbdb5da847fe4 -r 6d1b5997e85b9bdb75308fdb5db6cb5fa7e09941 test/qunit/tests/workflow_editor_tests.js --- a/test/qunit/tests/workflow_editor_tests.js +++ b/test/qunit/tests/workflow_editor_tests.js @@ -76,7 +76,7 @@ }, test_accept: function( other ) { other = other || { node: {}, datatypes: [ "txt" ] }; - return this.input_terminal.can_accept( other ); + return this.input_terminal.canAccept( other ); } } ); https://bitbucket.org/galaxy/galaxy-central/commits/a1d1f25181f4/ Changeset: a1d1f25181f4 User: jmchilton Date: 2014-04-21 21:27:01 Summary: Workflow Editor: Improve tests related to input terminal canAccept/datatypes. Elminate stub, create mock tree off inputs (demonstrates what server is feeding), add test for direct and subtype. Add tests for PJA changing output connection datatypes. Affected #: 1 file diff -r 6d1b5997e85b9bdb75308fdb5db6cb5fa7e09941 -r a1d1f25181f4689de3e946ed1ce1aa5494e7d781 test/qunit/tests/workflow_editor_tests.js --- a/test/qunit/tests/workflow_editor_tests.js +++ b/test/qunit/tests/workflow_editor_tests.js @@ -16,20 +16,25 @@ window.workflow = null; window.canvas_manager = null; - // Stub used over stubbing issubtype for unit testing datatype comparisons. - var issubtypeStub = null; QUnit.moduleStart(function() { - if( issubtypeStub === null) { - issubtypeStub = sinon.stub( window, "issubtype" ); - } - }); - QUnit.moduleDone(function() { - if( issubtypeStub !== null) { - issubtypeStub.restore(); - issubtypeStub = null; - } - }); + window.populate_datatype_info({ + ext_to_class_name: { + 'txt': 'Text', + 'data': 'Data', + 'tabular': 'Tabular', + 'binary': 'Binary', + 'bam': 'Bam' + }, + class_to_classes: { + 'Data': { 'Data': true }, + 'Text': { 'Text': true, 'Data': true }, + 'Tabular': { 'Tabular': true, 'Text': true, 'Data': true }, + 'Binary': { 'Data': true, 'Binary': true }, + 'Bam': { 'Data': true, 'Binary': true, 'Bam': true } + } + } ); + } ); var with_canvas_container = function( f ) { var canvas_container = $("<div id='canvas-container'>"); @@ -77,6 +82,11 @@ test_accept: function( other ) { other = other || { node: {}, datatypes: [ "txt" ] }; return this.input_terminal.canAccept( other ); + }, + pja_change_datatype_node: function( output_name, newtype ) { + var pja = { action_type: "ChangeDatatypeAction", output_name: output_name, action_arguments: { newtype: newtype } }; + var otherNode = { post_job_actions: [ pja ] }; + return otherNode; } } ); @@ -119,18 +129,46 @@ ok( connector.destroy.called ); } ); - test( "can accept correct datatype", function() { - issubtypeStub.returns(true); + test( "can accept exact datatype", function() { + var other = { node: {}, datatypes: [ "txt" ] }; // input also txt + ok( this.test_accept() ) ; } ); - test( "cannot accept incorrect datatypes", function() { - issubtypeStub.returns(false); - ok( ! this.test_accept() ); + test( "can accept subclass datatype", function() { + var other = { node: {}, datatypes: [ "tabular" ] }; // tabular subclass of input txt + + ok( this.test_accept() ) ; + } ); + + test( "cannot accept incorrect datatype", function() { + var other = { node: {}, datatypes: [ "binary" ] }; // binary is not txt + + ok( ! this.test_accept( other ) ); + } ); + + test( "can accept incorrect datatype if converted with PJA", function() { + var otherNode = this.pja_change_datatype_node( "out1", "txt" ); + var other = { node: otherNode, datatypes: [ "binary" ], name: "out1" }; // Was binary but converted to txt + + ok( this.test_accept( other ) ); + } ); + + test( "cannot accept incorrect datatype if converted with PJA to incompatible type", function() { + var otherNode = this.pja_change_datatype_node( "out1", "bam" ); // bam's are not txt + var other = { node: otherNode, datatypes: [ "binary" ], name: "out1" }; + + ok( ! this.test_accept( other ) ); + } ); + + test( "cannot accept incorrect datatype if some other output converted with PJA to compatible type", function() { + var otherNode = this.pja_change_datatype_node( "out2", "txt" ); + var other = { node: otherNode, datatypes: [ "binary" ], name: "out1" }; + + ok( ! this.test_accept( other ) ); } ); test( "can accept inputs", function() { - issubtypeStub.returns(false); // Other is data input module - always accept (currently - could be // more intelligent by looking at what else input is connected to. var other = { node: {}, datatypes: [ "input" ] }; @@ -138,7 +176,6 @@ } ); test( "cannot accept when already connected", function() { - issubtypeStub.returns(true); var self = this; // If other is subtype but already connected, cannot accept this.with_test_connector( {}, function() { @@ -379,12 +416,22 @@ /* global NodeView */ module( "Node view ", { setup: function() { - this.set_for_node( {} ); + this.set_for_node( { input_terminals: {}, output_terminals: {}, markChanged: function() {} } ); }, set_for_node: function( node ) { - var element = $("<div>"); + var element = $("<div><div class='toolFormBody'></div></div>"); this.view = new NodeView( { node: node, el: element[ 0 ] } ); }, + connectAttachedTerminal: function( inputType, outputType ) { + this.view.addDataInput( { name: "TestName", extensions: [ inputType ] } ); + var terminal = this.view.node.input_terminals[ "TestName" ]; + + var outputTerminal = new OutputTerminal( { name: "TestOuptut", datatypes: [ outputType ] } ); + outputTerminal.node = { markChanged: function() {}, post_job_actions: [] }; + var c = new Connector( outputTerminal, terminal ); + + return c; + } } ); test( "tool error styling", function() { @@ -413,6 +460,14 @@ } ); + test( "replacing terminal on data input update preserves connections", function() { + var connector = this.connectAttachedTerminal( "txt", "txt" ); + var newElement = $("<div class='inputs'></div>"); + this.view.replaceDataInput( { name: "TestName", extensions: ["txt"] }, newElement ); + var terminal = newElement.find(".input-terminal")[ 0 ].terminal; + ok( connector.handle2 === terminal ); + } ); + /* global InputTerminalView */ module( "Input terminal view", { setup: function() { https://bitbucket.org/galaxy/galaxy-central/commits/69a77f2783fc/ Changeset: 69a77f2783fc User: jmchilton Date: 2014-04-21 21:27:01 Summary: Workflow Editor: Break canAccept into smaller pieces (inputFilled and attachable). Want to reuse attachable right away to fix a bug - and the smaller pieces are good refactoring to support different kinds of input types in dataset collections downstream. Affected #: 1 file diff -r a1d1f25181f4689de3e946ed1ce1aa5494e7d781 -r 69a77f2783fcd9317f1da329c3f7a5512762ce99 static/scripts/galaxy.workflow_editor.canvas.js --- a/static/scripts/galaxy.workflow_editor.canvas.js +++ b/static/scripts/galaxy.workflow_editor.canvas.js @@ -42,23 +42,31 @@ this.multiple = attr.multiple; }, canAccept: function ( other ) { - if ( this.connectors.length < 1 || this.multiple) { - for ( var t in this.datatypes ) { - var cat_outputs = new Array(); - cat_outputs = cat_outputs.concat(other.datatypes); - if (other.node.post_job_actions){ - for (var pja_i in other.node.post_job_actions){ - var pja = other.node.post_job_actions[pja_i]; - if (pja.action_type == "ChangeDatatypeAction" && (pja.output_name == '' || pja.output_name == other.name) && pja.action_arguments){ - cat_outputs.push(pja.action_arguments['newtype']); - } + if( this._inputFilled() ) { + return false; + } else { + return this.attachable( other ); + } + }, + _inputFilled: function( ) { + return ! ( this.connectors.length < 1 || this.multiple ); + }, + attachable: function( other ) { + for ( var t in this.datatypes ) { + var cat_outputs = new Array(); + cat_outputs = cat_outputs.concat(other.datatypes); + if (other.node.post_job_actions){ + for (var pja_i in other.node.post_job_actions){ + var pja = other.node.post_job_actions[pja_i]; + if (pja.action_type == "ChangeDatatypeAction" && (pja.output_name == '' || pja.output_name == other.name) && pja.action_arguments){ + cat_outputs.push(pja.action_arguments['newtype']); } } - // FIXME: No idea what to do about case when datatype is 'input' - for ( var other_datatype_i in cat_outputs ) { - if ( cat_outputs[other_datatype_i] == "input" || issubtype( cat_outputs[other_datatype_i], this.datatypes[t] ) ) { - return true; - } + } + // FIXME: No idea what to do about case when datatype is 'input' + for ( var other_datatype_i in cat_outputs ) { + if ( cat_outputs[other_datatype_i] == "input" || issubtype( cat_outputs[other_datatype_i], this.datatypes[t] ) ) { + return true; } } } https://bitbucket.org/galaxy/galaxy-central/commits/4df5e43d8651/ Changeset: 4df5e43d8651 User: jmchilton Date: 2014-04-21 21:27:01 Summary: Bugfix: Workflow editor could get in invalid state when trying to preserve connections. Workflow editor would preserve connections when a tool would update its state (for instance switching a conditional or adding repeat) - but conditional switching can result in connections being invalid (wouldn't have passed can_accept previously). Consider the following tool for instance which changes datatypes of an input based on a conditional (https://gist.github.com/jmchilton/11152628). Affected #: 2 files diff -r 69a77f2783fcd9317f1da329c3f7a5512762ce99 -r 4df5e43d865176cdeb929db7fbf18c3b9af98591 static/scripts/galaxy.workflow_editor.canvas.js --- a/static/scripts/galaxy.workflow_editor.canvas.js +++ b/static/scripts/galaxy.workflow_editor.canvas.js @@ -806,8 +806,14 @@ $(this).find( ".input-terminal" ).each( function() { var c = this.terminal.connectors[0]; if ( c ) { - t.terminal.connectors[0] = c; - c.handle2 = t.terminal; + var terminal = t.terminal; + if( c.handle1 && ! terminal.attachable( c.handle1 ) ) { + // connection no longer valid, destroy it + c.destroy(); + } else { + terminal.connectors[0] = c; + c.handle2 = terminal; + } } }); $(this).remove(); diff -r 69a77f2783fcd9317f1da329c3f7a5512762ce99 -r 4df5e43d865176cdeb929db7fbf18c3b9af98591 test/qunit/tests/workflow_editor_tests.js --- a/test/qunit/tests/workflow_editor_tests.js +++ b/test/qunit/tests/workflow_editor_tests.js @@ -468,6 +468,16 @@ ok( connector.handle2 === terminal ); } ); + test( "replacing terminal on data input destroys invalid connections", function() { + var connector = this.connectAttachedTerminal( "txt", "txt" ); + var newElement = $("<div class='inputs'></div>"); + var connector_destroy_spy = sinon.spy( connector, "destroy" ); + // Replacing input with same name - but now of type bam should destroy connection. + this.view.replaceDataInput( { name: "TestName", extensions: ["bam"] }, newElement ); + var terminal = newElement.find(".input-terminal")[ 0 ].terminal; + ok( connector_destroy_spy.called ); + } ); + /* global InputTerminalView */ module( "Input terminal view", { setup: function() { Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org