@@ -0,0 +1,1709 @@
+%22%22%22%0Autilities routines associated with globus%0A%0A%22%22%22%0Aimport sys%0Aimport inspect%0Aimport traceback%0Afrom globus_sdk import GlobusAPIError%0Afrom globus_sdk import NetworkError%0Afrom globus_sdk import GlobusError%0Afrom globus_sdk import GlobusConnectionError%0Afrom globus_sdk import GlobusTimeoutError%0A%0Afrom pandaharvester.harvestercore import core_utils%0Afrom pandalogger.PandaLogger import PandaLogger%0Afrom pandalogger.LogWrapper import LogWrapper%0A%0A# handle exception from globus software%0Adef handle_globus_exception(tmp_log):%0A    if not isinstance(tmp_log, LogWrapper):%0A        methodName = '%7B0%7D : '.format(inspect.stack()%5B1%5D%5B3%5D)%0A    else:%0A        methodName = ''%0A    # extract errtype and check if it a GlobusError Class%0A    errtype, errvalue = sys.exc_info()%5B:2%5D%0A    err_str = %22%7B0%7D %7B1%7D %22.format(methodName, errtype.__name__)%0A    if isinstance(errvalue,GlobusAPIError):%0A        # Error response from the REST service, check the code and message for%0A        # details.%0A        err_str += %22Error Code: %7B0%7D Error Message: %7B1%7D %22%0A                   .format(errvalue.code, errvalue.message)        %0A    else if isinstance(errvalue, NetworkError):%0A        err_str += %22Network Failure. Possibly a firewall or connectivity issue %22%0A    else if isinstance(errvalue,  GlobusConnectionError):%0A        err_str += %22A connection error occured while making a REST request. %22%0A    else if isinstance(errvalue,  GlobusTimeoutError):%0A        err_str += %22A REST request timeout. %22%0A    else if isinstance(errvalue,  GlobusError):%0A        err_str += %22Totally unexpected GlobusError! %22%0A    else :  # some other error%0A        err_str = %22%7B0%7D %22.format(errvalue)%0A    err_str += traceback.format_exc()%0A    tmp_log.error(err_str)%0A    return err_str%0A

create new utility function for handling globus errors