Fix error message displayed when setting metadata_externally.

e.g:
Exception exceptions.TypeError: TypeError('<galaxy.datatypes.metadata.MetadataTempFile object at 0x40d9a10> is not JSON serializable',) in <bound method MutableAttrInstanceState._cleanup of <sqlalchemy.orm.state.MutableAttrInstanceState object at 0x40d99d0>> ignored
This commit is contained in:
Daniel Blankenberg
2009-11-09 15:33:38 -05:00
parent 1746480910
commit 3fdac6ca6b
+3
View File
@@ -8,6 +8,7 @@ top level directly.
import logging
logging.basicConfig()
log = logging.getLogger( __name__ )
import os, sys, cPickle
assert sys.version_info[:2] >= ( 2, 4 )
@@ -24,6 +25,7 @@ import galaxy.model.mapping #need to load this before we unpickle, in order to s
galaxy.model.Job() #this looks REAL stupid, but it is REQUIRED in order for SA to insert parameters into the classes defined by the mappers --> it appears that instantiating ANY mapper'ed class would suffice here
galaxy.datatypes.metadata.DATABASE_CONNECTION_AVAILABLE = False #Let metadata know that there is no database connection, and to just assume object ids are valid
from galaxy.util import stringify_dictionary_keys
from sqlalchemy.orm import clear_mappers
def __main__():
file_path = sys.argv.pop( 1 )
@@ -48,5 +50,6 @@ def __main__():
simplejson.dump( ( True, 'Metadata has been set successfully' ), open( filename_results_code, 'wb+' ) ) #setting metadata has suceeded
except Exception, e:
simplejson.dump( ( False, str( e ) ), open( filename_results_code, 'wb+' ) ) #setting metadata has failed somehow
clear_mappers()
__main__()