예제 #1
0
def run(task):

	# Initialization

	conf = task.conf

	log = task.logger()

	es = EntityServer(conf["entities"])
	em = es.manager()

	rs = RepositoryServer(conf["repositories"])
	data_repo = rs.repository("data")

	# Run

	for k, v in vars(types).items():
		if k.startswith("CNV_"):
			log.info("Preparing '{0}' ...".format(v))
			em.ensure_collection_exists(v)
			path = rpath.absolute(v.replace(".", "/"))
			log.debug("\tData: {0}".format(path))
			data_repo.mkdir_if_not_exists(path)

	em.close()
	es.close()
	data_repo.close()
	rs.close()
	
	return 0
예제 #2
0
def skip_file(overwrite, repo, path, prev_url, source_files=None, repo_server=None):
	if overwrite:
		return False

	if prev_url is None:
		return False

	r, p = decompose_url(prev_url)
	p = rpath.absolute(p)
	path = rpath.absolute(path)

	if repo.name() != r or path != p:
		return False
	
	if repo.exists(path):
		#TODO compare source mtime with path ctime
		#TODO check whether it is partial or completed
		return True

	return False