commit/galaxy-central: jmchilton: More performant database interaction during collection creation.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/1fae433a54ea/ Changeset: 1fae433a54ea User: jmchilton Date: 2014-05-19 19:15:48 Summary: More performant database interaction during collection creation. Affected #: 2 files diff -r 9452c068ec99c52c66dcb2bbb208787f8d379d22 -r 1fae433a54eaaab6392da9e9a8eec94a3b568c14 lib/galaxy/dataset_collections/__init__.py --- a/lib/galaxy/dataset_collections/__init__.py +++ b/lib/galaxy/dataset_collections/__init__.py @@ -180,7 +180,6 @@ return dataset_collection_instance def __recursively_create_collections( self, trans, element_identifiers ): - # TODO: Optimize - don't recheck parent, reload created model, just use as is. for index, element_identifier in enumerate( element_identifiers ): try: if not element_identifier[ "src" ] == "new_collection": @@ -197,9 +196,7 @@ collection_type=collection_type, element_identifiers=element_identifier[ "element_identifiers" ], ) - self.__persist( collection ) - element_identifier[ "src" ] = "dc" - element_identifier[ "id" ] = trans.security.encode_id( collection.id ) + element_identifier[ "__object__" ] = collection return element_identifiers @@ -215,7 +212,12 @@ # # consistent with other API methods though. # element_identifier = dict( src='hda', id=str( element_identifier ) ) - # dateset_identifier is dict {src=hda|ldda, id=<encoded_id>} + # Previously created collection already found in request, just pass + # through as is. + if "__object__" in element_identifier: + return element_identifier[ "__object__" ] + + # dateset_identifier is dict {src=hda|ldda|hdca|new_collection, id=<encoded_id>} try: src_type = element_identifier.get( 'src', 'hda' ) except AttributeError: @@ -233,8 +235,6 @@ # TODO: Option to copy? Force copy? Copy or allow if not owned? element = self.__get_history_collection_instance( trans, encoded_id ).collection # TODO: ldca. - elif src_type == "dc": - element = self.get_dataset_collection( trans, encoded_id ) else: raise RequestParameterInvalidException( "Unknown src_type parameter supplied '%s'." % src_type ) return element diff -r 9452c068ec99c52c66dcb2bbb208787f8d379d22 -r 1fae433a54eaaab6392da9e9a8eec94a3b568c14 lib/galaxy/dataset_collections/util.py --- a/lib/galaxy/dataset_collections/util.py +++ b/lib/galaxy/dataset_collections/util.py @@ -6,6 +6,7 @@ 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" 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." def api_payload_to_create_params( payload ): @@ -32,6 +33,9 @@ and verify the structure is valid. """ for element_identifier in element_identifiers: + if "__object__" in element_identifier: + message = ERROR_MESSAGE_INVALID_PARAMETER_FOUND % ( "__model_object__", element_identifier ) + raise exceptions.RequestParameterInvalidException( message ) if "name" not in element_identifier: message = ERROR_MESSAGE_NO_NAME % element_identifier raise exceptions.RequestParameterInvalidException( message ) 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