Beispiel #1
0
def stats(host):
	conn = cache.connect(host=host)
	st = conn.stats()
	for k in st:
		v = st[k]
		if isinstance(v, str):
			print '%s = "%s"' % (k, v)
		else: 
			print '%s = %s' % (k, v)
Beispiel #2
0
def get(lfn, path, symlink):
	if not os.path.isabs(path):
		path = os.path.abspath(path)
		
	if os.path.exists(path):
		sys.stderr.write("Path %s already exists. Removing." % path)
		os.unlink(path)
		
	conn = cache.connect()
	conn.get(lfn, path, symlink)
Beispiel #3
0
def put(path, lfn, smart_move):
	# If the path doesn't exist, then skip it
	if not os.path.exists(path):
		sys.stderr.write("Path %s does not exist\n" % path)
		return
		
	if not os.path.isabs(path):
		path = os.path.abspath(path)
	
	conn = cache.connect()
	conn.put(path, lfn, smart_move)
Beispiel #4
0
def multiput(stream, symlink):
	pairs = []
	for l in stream.readlines():
		l = l.strip()
		if len(l)==0 or l.startswith('#'):
			continue
		path, lfn = l.split()
		
		if not os.path.exists(path):
			sys.stderr.write("Path %s does not exists\n" % path)
			continue
		
		if not os.path.isabs(path):
			path = os.path.abspath(path)
			
		pairs.append([path, lfn])
	
	conn = cache.connect()
	conn.multiput(pairs, symlink)
Beispiel #5
0
def multiget(stream, symlink):
	pairs = []
	for l in stream.readlines():
		l = l.strip()
		if len(l)==0 or l.startswith('#'):
			continue
		lfn, path = l.split()

		if not os.path.isabs(path):
			path = os.path.abspath(path)
					
		if os.path.exists(path):
			sys.stderr.write("Path %s already exists. Removing." % path)
			os.unlink(path)
		
		pairs.append([lfn, path])
	
	conn = cache.connect()
	conn.multiget(pairs, symlink)
Beispiel #6
0
def rls_clear():
	conn = cache.connect()
	conn.rls_clear()
Beispiel #7
0
def clear(host):
	conn = cache.connect(host=host)
	conn.clear()
Beispiel #8
0
def get_bloom_filter(m, k):
	conn = cache.connect()
	bloom = conn.get_bloom_filter(m, k)
	for i in range(0, len(bloom)):
		print 'BloomFilter%d = "%s"' % (i, bloom[i])
Beispiel #9
0
def rls_delete(lfn, pfn):
	conn = cache.connect()
	conn.rls_delete(lfn, pfn)
Beispiel #10
0
def rls_lookup(lfn):
	conn = cache.connect()
	pfns = conn.rls_lookup(lfn)
	for pfn in pfns:
		print pfn
Beispiel #11
0
def rls_add(lfn, pfn):
	conn = cache.connect()
	conn.rls_add(lfn, pfn)
Beispiel #12
0
def ls(host):
	conn = cache.connect(host=host)
	results = conn.list()
	for rec in results:
		print rec['lfn'], rec['status']
Beispiel #13
0
def remove(lfn, force):
	conn = cache.connect()
	conn.remove(lfn, force)