Parent Directory
|
Revision Log
|
Revision Graph
adler32 update
#Error codes
"""Error codes for DMU functions
Error codes have to be positive integers:
0 is reserved for succesful completion, so cannot be an error
N<10 are errors assigned in the final functions (DQ2ProdClient, DQ2UserClient)
N>100 are errors returned by the SiteMovers
"""
#If you add constants to this file please modify the error dictionary accordingly!
#status code from dq2put_get
ERR_MOVEFAILED = 1
ERR_NOPFC = 2
ERR_TIMEOUT = 3
ERR_DDMREG = 4
ERR_DDMREGDUP = 5
#Status codes from movers
# fail = 3
#ERR_COPY = 1 # copy command failed
ERR_MISSFILEXML = 117 # Missing input file in xml
ERR_MISSFILE = 101 # Missing input file
ERR_SIGPIPE = 102
ERR_FAILEDSIZELOCAL = 103 #put
ERR_FAILEDMD5LOCAL = 104 #put
ERR_FAILEDCP = 110 # 5 for other command
ERR_FAILEDSIZE = 111
ERR_WRONGSIZE = 112
ERR_FAILEDMD5 = 113 #8 in uberftp
ERR_WRONGMD5 = 114 #7 in uberftp
ERR_NOPROXY = 115
ERR_NOSTORAGE = 116
ERR_MKDIR = 118
ERR_CHMOD = 119
ERR_FAILEDADLOCAL = 123
ERR_WRONGAD = 124
# ERR_NOSDDMSRV = 17 included in ERR_NOSTORAGE, goal of the connection is to get the storage
# This dictionary contains a list of valid errors:
# key: error code
# value: [ acronym, extended explanation]
error_dic = {
#status code from dq2put_get
ERR_MOVEFAILED: ["ERR_MOVEFAILED", "Move failed"],
ERR_NOPFC: ["ERR_NOPFC", "No PFC"],
ERR_TIMEOUT: ["ERR_TIMEOUT", "Time-out"],
ERR_DDMREG: ["ERR_DDMREG", "DDM reg error"],
ERR_DDMREGDUP: ["ERR_DDMREGDUP", "LFNnonunique returned by DQ2"],
#Status codes from movers
# fail = 3
#ERR_COPY = 1 # copy command failed
ERR_MISSFILE: ["ERR_MISSFILE", "Input file missing"],
ERR_MISSFILEXML: ["ERR_MISSFILEXML", "Missing file xml"],
ERR_FAILEDCP: ["ERR_FAILEDCP", "File copy failed"],
ERR_SIGPIPE: ["ERR_SIGPIPE", "Copy failed with a sigpipe signal. It may cause empty files to be created in dcs"],
ERR_FAILEDMD5: ["ERR_FAILEDMD5", "Failed md5sum"],
ERR_FAILEDMD5LOCAL: ["ERR_FAILEDMD5LOCAL", "Failed local md5sum"],
ERR_WRONGMD5: ["ERR_WRONGMD5", "Wrong md5sum"],
ERR_FAILEDADLOCAL: ["ERR_FAILEDADLOCAL", "The local adler32 command failed."],
ERR_WRONGAD: ["ERR_WRONGAD", "Wrong adler32."],
ERR_FAILEDSIZE: ["ERR_FAILEDSIZE", "Failed size"],
ERR_FAILEDSIZELOCAL: ["ERR_FAILEDSIZELOCAL", "Failed local size"],
ERR_WRONGSIZE: ["ERR_WRONGSIZE", "Wrong size"],
ERR_MKDIR: ["ERR_MKDIR", "mkdir error"],
ERR_CHMOD: ["ERR_CHMOD", "chmod error"],
ERR_NOPROXY: ["ERR_NOPROXY", "No proxy"],
ERR_NOSTORAGE: ["ERR_NOSTORAGE", "No storage"],
}
def getErrorStr(s):
"""Avoids exception if an error is not in the dictionary.
An empty string is returned if the error is not in the dictionary.
"""
try:
rets = error_dic[s][0]
except:
rets = ''
return rets
def getErrorStrVerbose(s):
"""Returns error acronym and explanation. Avoids exception if an error is not in the dictionary.
An empty string is returned if the error is not in the dictionary.
"""
try:
rets = "%s - %s" % (error_dic[s][0], error_dic[s][1])
except:
rets = ''
return rets
def _test_errors():
print "Error test. %s errors total" % len(error_dic.keys())
print "Error (code), explanation"
for i in error_dic.keys():
print "%s (%s): %s" % (error_dic[i][0], i, error_dic[i][1])
| CERN Central CVS service | ViewVC Help |
| Powered by ViewVC 1.0.9 |