Example #1
0
def processFile(domainName, user, edbName, filePath):
    logger=logging.getLogger('loadRUSedb.processFile')

    dmn=domain(domainName)
    edb=Edb(domainName,user,edbName) 

    if not dmn.edbUserExist(user):
        logger.error("Directory for user '"+user+"' does not exist in edb directory for domain '"+domain+"'")
        sys.exit()

    if not edb.exists():
        edb.create()
        logger.info("EDB '"+edb.name+"' for user '"+user+"' in domain '"+dmn.name+"' created")

    if filePath[-3:]==".gz":
        utilities.gunzip(filePath)
        filePath=filePath[:-3]
    filePath=filePath[:-5] #removing .data from the file name

    #converting from dos-format to linux
    utilities.dos2linux(filePath+".asc")
    utilities.dos2linux(filePath+".data")

    #create grid object
    gridname=path.basename(filePath)
    grid=Egrid(dmn.name,user,edb.name,gridname)

    grid.load(filePath)  #load grid into edb