def createUnitAndJobChain(path, config, terminate=False): path = unicodeToStr(path) if os.path.isdir(path): path = path + "/" logger.debug('Creating unit and job chain for %s with %s', path, config) unit = None if os.path.isdir(path): if config[3] == "SIP": UUID = findOrCreateSipInDB(path) unit = unitSIP(path, UUID) elif config[3] == "DIP": UUID = findOrCreateSipInDB(path, unit_type='DIP') unit = unitDIP(path, UUID) elif config[3] == "Transfer": unit = unitTransfer(path) elif os.path.isfile(path): if config[3] == "Transfer": unit = unitTransfer(path) else: return UUID = uuid.uuid4() unit = unitFile(path, UUID) else: return jobChain(unit, config[1]) if terminate: exit(0)
def createUnitAndJobChain(path, config, terminate=False): path = unicodeToStr(path) if os.path.isdir(path): path = path + "/" print "createUnitAndJobChain", path, config unit = None if os.path.isdir(path): if config[3] == "SIP": UUID = findOrCreateSipInDB(path) unit = unitSIP(path, UUID) elif config[3] == "DIP": UUID = findOrCreateSipInDB(path) unit = unitDIP(path, UUID) elif config[3] == "Transfer": #UUID = findOrCreateSipInDB(path) unit = unitTransfer(path) elif os.path.isfile(path): if config[3] == "Transfer": unit = unitTransfer(path) else: return UUID = uuid.uuid4() unit = unitFile(path, UUID) else: return jobChain(unit, config[1]) if terminate: exit(0)
def createUnitAndJobChain(path, watched_dir, workflow): path = unicodeToStr(path) if os.path.isdir(path): path = path + "/" logger.debug('Starting chain for %s', path) if not os.path.exists(path): return unit = None unit_type = watched_dir["unit_type"] if os.path.isdir(path): if unit_type == "SIP": UUID = findOrCreateSipInDB(path) unit = unitSIP(path, UUID) elif unit_type == "DIP": UUID = findOrCreateSipInDB(path, unit_type='DIP') unit = unitDIP(path, UUID) elif unit_type == "Transfer": unit = unitTransfer(path) elif os.path.isfile(path): if unit_type == "Transfer": unit = unitTransfer(path) else: return jobChain(unit, watched_dir.chain, workflow)