[hg] galaxy 3333: LIMS data acquisition: now the data transfer u...
details: http://www.bx.psu.edu/hg/galaxy/rev/7af418485514 changeset: 3333:7af418485514 user: rc date: Thu Feb 04 17:00:46 2010 -0500 description: LIMS data acquisition: now the data transfer user logs out after the transfer is complete diffstat: lib/galaxy/web/controllers/requests_admin.py | 13 +++++++++-- scripts/galaxy_messaging/server/data_transfer.py | 26 +++++++++++++++++------ templates/admin/requests/show_request.mako | 2 +- 3 files changed, 30 insertions(+), 11 deletions(-) diffs (104 lines): diff -r ef0622415211 -r 7af418485514 lib/galaxy/web/controllers/requests_admin.py --- a/lib/galaxy/web/controllers/requests_admin.py Thu Feb 04 16:23:32 2010 -0500 +++ b/lib/galaxy/web/controllers/requests_admin.py Thu Feb 04 17:00:46 2010 -0500 @@ -1449,8 +1449,14 @@ dataset_files=sample.dataset_files) elif params.get( 'start_transfer_button', False ): for f in files_list: - sample.dataset_files.append([os.path.join(folder_path, f), - sample.transfer_status.NOT_STARTED]) + if f[-1] == os.sep: + # the selected item is a folder so transfer all the + # folder contents + sample.dataset_files.append([os.path.join(folder_path, f), + sample.transfer_status.NOT_STARTED]) + else: + sample.dataset_files.append([os.path.join(folder_path, f), + sample.transfer_status.NOT_STARTED]) trans.sa_session.add( sample ) trans.sa_session.flush() return self.__start_datatx(trans, sample) @@ -1547,7 +1553,8 @@ trans.sa_session.flush() return trans.response.send_redirect( web.url_for( controller='requests_admin', action='show_datatx_page', - sample_id=trans.security.encode_id(sample.id))) + sample_id=trans.security.encode_id(sample.id), + folder_path=os.path.dirname(dfile))) diff -r ef0622415211 -r 7af418485514 scripts/galaxy_messaging/server/data_transfer.py --- a/scripts/galaxy_messaging/server/data_transfer.py Thu Feb 04 16:23:32 2010 -0500 +++ b/scripts/galaxy_messaging/server/data_transfer.py Thu Feb 04 17:00:46 2010 -0500 @@ -44,6 +44,13 @@ logging.basicConfig(filename=logfile, level=logging.DEBUG, format="%(asctime)s [%(levelname)s] %(message)s") +class DataTransferException(Exception): + def __init__(self, value): + self.msg = value + def __str__(self): + return repr(self.msg) + + class DataTransfer(object): def __init__(self, host, username, password, remote_file, sample_id, @@ -102,14 +109,14 @@ self.error_and_exit() - def error_and_exit(self): + def error_and_exit(self, msg=''): ''' This method is called any exception is raised. This prints the traceback and terminates this script ''' logging.error(traceback.format_exc()) - logging.error('FATAL ERROR') - self.update_status('Error') + logging.error('FATAL ERROR.'+msg) + self.update_status('Error.'+msg) sys.exit(1) def transfer_file(self): @@ -159,7 +166,7 @@ url = "%s/user/create?email=%s&username=%s&password=%s&confirm=%s&create_user_button=Submit" % ( base_url, email, email, password, password ) f = opener.open(url) if f.read().find("Now logged in as "+email) == -1: - raise Exception + raise DataTransferException("The "+email+" user could not login to Galaxy") # after login, add dataset to the library params = urllib.urlencode(dict( cntrller='library_admin', tool_id='upload1', @@ -177,9 +184,14 @@ logging.debug(url) logging.debug(params) f = opener.open(url, params) - #print f.read() - except: - self.error_and_exit() + if f.read().find("Data Library") == -1: + raise DataTransferException("Dataset could not be uploaded to the data library") + # finally logout + f = opener.open(base_url+'/user/logout') + if f.read().find("You are no longer logged in.") == -1: + raise DataTransferException("The "+email+" user could not logout of Galaxy") + except DataTransferException, (e): + self.error_and_exit(e.msg) def update_status(self, status): ''' diff -r ef0622415211 -r 7af418485514 templates/admin/requests/show_request.mako --- a/templates/admin/requests/show_request.mako Thu Feb 04 16:23:32 2010 -0500 +++ b/templates/admin/requests/show_request.mako Thu Feb 04 17:00:46 2010 -0500 @@ -43,7 +43,7 @@ </script> <style type="text/css"> .msg_head { - padding: 15px 0px; + padding: 10px 0px; cursor: pointer; }
participants (1)
-
Greg Von Kuster