[hg] galaxy 1603: Fixes for upload tool job creation.
details: http://www.bx.psu.edu/hg/galaxy/rev/85347b21a1b8 changeset: 1603:85347b21a1b8 user: Greg Von Kuster <greg@bx.psu.edu> date: Tue Nov 04 13:20:39 2008 -0500 description: Fixes for upload tool job creation. 1 file(s) affected in this change: lib/galaxy/tools/actions/upload.py diffs (58 lines): diff -r 531be9ea2486 -r 85347b21a1b8 lib/galaxy/tools/actions/upload.py --- a/lib/galaxy/tools/actions/upload.py Tue Nov 04 11:56:09 2008 -0500 +++ b/lib/galaxy/tools/actions/upload.py Tue Nov 04 13:20:39 2008 -0500 @@ -36,7 +36,7 @@ except: job.tool_version = "1.0.0" job.flush() - log.debug( 'tool %s created job id %d' % ( tool.id, job.id ) ) + log.info( 'tool %s created job id %d' % ( tool.id, job.id ) ) trans.log_event( 'created job id %d' % job.id, tool_id=tool.id ) if 'local_filename' in dir( data_file ): # Use the existing file @@ -88,11 +88,11 @@ return self.upload_empty( trans, job, "No data error:", "either you pasted no data, the url you specified is invalid, or you have not specified a file." ) hda = data_list[0] job.state = trans.app.model.Job.states.OK - file_size_str = nice_size( hda.dataset.file_size ) - job.info = "Uploaded file '%s', size: %s" % ( file_name, file_size_str ) + file_size_str = datatypes.data.nice_size( hda.dataset.file_size ) + job.info = "%s, size: %s" % ( hda.info, file_size_str ) job.flush() - log.debug( 'tool %s job id %d ended ok, file: %s, size: %s' % ( tool.id, job.id, file_name, file_size_str ) ) - trans.log_event( 'job id %d ended ok, file: %s, size: %s' % ( job.id, file_name, file_size_str ), tool_id=tool.id ) + log.info( 'job id %d ended ok, file size: %s' % ( job.id, file_size_str ) ) + trans.log_event( 'job id %d ended ok, file size: %s' % ( job.id, file_size_str ), tool_id=tool.id ) return dict( output=hda ) def upload_empty(self, trans, job, err_code, err_msg): @@ -111,7 +111,7 @@ job.info = err_msg # If the failure is due to a Galaxy framework exception, save the traceback job.flush() - log.debug( 'tool %s job id %d ended with errors' % ( job.tool_id, job.id ) ) + log.info( 'job id %d ended with errors' % job.id ) trans.log_event( 'job id %d ended with errors' % job.id, tool_id=job.tool_id ) return dict( output=data ) @@ -301,20 +301,5 @@ temp.close() return False -def nice_size( size ): - """Returns a readably formatted string with the size""" - words = [ 'bytes', 'Kb', 'Mb', 'Gb' ] - try: - size = float( size ) - except: - return '??? bytes' - for ind, word in enumerate( words ): - step = 1024 ** ( ind + 1 ) - if step > size: - size = size / float( 1024 ** ind ) - out = "%.1f %s" % ( size, word ) - return out - return '??? bytes' - class BadFileException( Exception ): pass
participants (1)
-
Greg Von Kuster