3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d5125e51cefa/ Changeset: d5125e51cefa Branch: next-stable User: jmchilton Date: 2014-05-24 00:20:55 Summary: Add some more colllection creation logging. Bug report from takadonet of collection request with 280 items only creating 60 - want to know if request got chopped off by proxy or paste, there was some logic error in my code, or if it hit some sort of db/transaction limit. This logging should help dianose that (hopefully). If I find the bug, I will remove this extra logging. Affected #: 2 files diff -r 13e3b3e1c194b70dc8d17fc669d314264a000151 -r d5125e51cefab1b43bf004eaa1b57623149c7202 lib/galaxy/dataset_collections/__init__.py --- a/lib/galaxy/dataset_collections/__init__.py +++ b/lib/galaxy/dataset_collections/__init__.py @@ -76,6 +76,7 @@ trans.sa_session.add( output_dataset ) dataset_collection_instance.implicit_output_name = implicit_collection_info[ "implicit_output_name" ] + log.debug("Created collection with %d elements" % ( len( dataset_collection_instance.collection.elements ) ) ) # Handle setting hid parent.add_dataset_collection( dataset_collection_instance ) elif isinstance( parent, model.LibraryFolder ): diff -r 13e3b3e1c194b70dc8d17fc669d314264a000151 -r d5125e51cefab1b43bf004eaa1b57623149c7202 lib/galaxy/dataset_collections/util.py --- a/lib/galaxy/dataset_collections/util.py +++ b/lib/galaxy/dataset_collections/util.py @@ -2,6 +2,9 @@ from galaxy import web from galaxy import model +import logging +log = logging.getLogger( __name__ ) + ERROR_MESSAGE_UNKNOWN_SRC = "Unknown dataset source (src) %s." ERROR_MESSAGE_NO_NESTED_IDENTIFIERS = "Dataset source new_collection requires nested element_identifiers for new collection." ERROR_MESSAGE_NO_NAME = "Cannot load invalid dataset identifier - missing name - %s" @@ -32,6 +35,7 @@ """ Scan through the list of element identifiers supplied by the API consumer and verify the structure is valid. """ + log.debug( "Validating %d element identifiers for collection creation." % len( element_identifiers ) ) for element_identifier in element_identifiers: if "__object__" in element_identifier: message = ERROR_MESSAGE_INVALID_PARAMETER_FOUND % ( "__model_object__", element_identifier ) https://bitbucket.org/galaxy/galaxy-central/commits/a5f097248869/ Changeset: a5f097248869 Branch: next-stable User: jmchilton Date: 2014-05-27 15:20:39 Summary: Bugfix: Explicitly enforce implicit collection unique element identifier constraint. Think this is responsible for bug when collections API does not create as many collections as requested. Affected #: 2 files diff -r d5125e51cefab1b43bf004eaa1b57623149c7202 -r a5f097248869df64d6f16a2e7dc14c3ceffbcce1 lib/galaxy/dataset_collections/util.py --- a/lib/galaxy/dataset_collections/util.py +++ b/lib/galaxy/dataset_collections/util.py @@ -10,6 +10,7 @@ ERROR_MESSAGE_NO_NAME = "Cannot load invalid dataset identifier - missing name - %s" ERROR_MESSAGE_NO_COLLECTION_TYPE = "No collection_type define for nested collection %s." ERROR_MESSAGE_INVALID_PARAMETER_FOUND = "Found invalid parameter %s in element identifier description %s." +ERROR_MESSAGE_DUPLICATED_IDENTIFIER_FOUND = "Found duplicated element idenfier name %s." def api_payload_to_create_params( payload ): @@ -36,6 +37,7 @@ and verify the structure is valid. """ log.debug( "Validating %d element identifiers for collection creation." % len( element_identifiers ) ) + identifier_names = set() for element_identifier in element_identifiers: if "__object__" in element_identifier: message = ERROR_MESSAGE_INVALID_PARAMETER_FOUND % ( "__model_object__", element_identifier ) @@ -43,6 +45,12 @@ if "name" not in element_identifier: message = ERROR_MESSAGE_NO_NAME % element_identifier raise exceptions.RequestParameterInvalidException( message ) + name = element_identifier[ "name" ] + if name in identifier_names: + message = ERROR_MESSAGE_DUPLICATED_IDENTIFIER_FOUND % name + raise exceptions.RequestParameterInvalidException( message ) + else: + identifier_names.add( name ) src = element_identifier.get( "src", "hda" ) if src not in [ "hda", "hdca", "ldda", "new_collection" ]: message = ERROR_MESSAGE_UNKNOWN_SRC % src diff -r d5125e51cefab1b43bf004eaa1b57623149c7202 -r a5f097248869df64d6f16a2e7dc14c3ceffbcce1 test/api/test_dataset_collections.py --- a/test/api/test_dataset_collections.py +++ b/test/api/test_dataset_collections.py @@ -106,6 +106,19 @@ create_response = self._post( "dataset_collections", payload ) self._assert_status_code_is( create_response, 403 ) + def test_enforces_unique_names( self ): + element_identifiers = self.dataset_collection_populator.list_identifiers( self.history_id ) + element_identifiers[ 2 ][ "name" ] = element_identifiers[ 0 ][ "name" ] + payload = dict( + instance_type="history", + history_id=self.history_id, + element_identifiers=json.dumps(element_identifiers), + collection_type="list", + ) + + create_response = self._post( "dataset_collections", payload ) + self._assert_status_code_is( create_response, 400 ) + def _check_create_response( self, create_response ): self._assert_status_code_is( create_response, 200 ) dataset_collection = create_response.json() https://bitbucket.org/galaxy/galaxy-central/commits/8f1f131bdeb4/ Changeset: 8f1f131bdeb4 User: jmchilton Date: 2014-05-27 15:21:18 Summary: Merge latest next-stable. Affected #: 2 files diff -r f94244370cfa4b6e685a5ea46a2b2d4ede42b749 -r 8f1f131bdeb49f876a06d748d97cfb48ec329550 lib/galaxy/dataset_collections/util.py --- a/lib/galaxy/dataset_collections/util.py +++ b/lib/galaxy/dataset_collections/util.py @@ -10,6 +10,7 @@ ERROR_MESSAGE_NO_NAME = "Cannot load invalid dataset identifier - missing name - %s" ERROR_MESSAGE_NO_COLLECTION_TYPE = "No collection_type define for nested collection %s." ERROR_MESSAGE_INVALID_PARAMETER_FOUND = "Found invalid parameter %s in element identifier description %s." +ERROR_MESSAGE_DUPLICATED_IDENTIFIER_FOUND = "Found duplicated element idenfier name %s." def api_payload_to_create_params( payload ): @@ -36,6 +37,7 @@ and verify the structure is valid. """ log.debug( "Validating %d element identifiers for collection creation." % len( element_identifiers ) ) + identifier_names = set() for element_identifier in element_identifiers: if "__object__" in element_identifier: message = ERROR_MESSAGE_INVALID_PARAMETER_FOUND % ( "__model_object__", element_identifier ) @@ -43,6 +45,12 @@ if "name" not in element_identifier: message = ERROR_MESSAGE_NO_NAME % element_identifier raise exceptions.RequestParameterInvalidException( message ) + name = element_identifier[ "name" ] + if name in identifier_names: + message = ERROR_MESSAGE_DUPLICATED_IDENTIFIER_FOUND % name + raise exceptions.RequestParameterInvalidException( message ) + else: + identifier_names.add( name ) src = element_identifier.get( "src", "hda" ) if src not in [ "hda", "hdca", "ldda", "new_collection" ]: message = ERROR_MESSAGE_UNKNOWN_SRC % src diff -r f94244370cfa4b6e685a5ea46a2b2d4ede42b749 -r 8f1f131bdeb49f876a06d748d97cfb48ec329550 test/api/test_dataset_collections.py --- a/test/api/test_dataset_collections.py +++ b/test/api/test_dataset_collections.py @@ -106,6 +106,19 @@ create_response = self._post( "dataset_collections", payload ) self._assert_status_code_is( create_response, 403 ) + def test_enforces_unique_names( self ): + element_identifiers = self.dataset_collection_populator.list_identifiers( self.history_id ) + element_identifiers[ 2 ][ "name" ] = element_identifiers[ 0 ][ "name" ] + payload = dict( + instance_type="history", + history_id=self.history_id, + element_identifiers=json.dumps(element_identifiers), + collection_type="list", + ) + + create_response = self._post( "dataset_collections", payload ) + self._assert_status_code_is( create_response, 400 ) + def _check_create_response( self, create_response ): self._assert_status_code_is( create_response, 200 ) dataset_collection = create_response.json() 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.