[fix] clitools: toRedis exporter should work
This commit is contained in:
parent
3dff5d92af
commit
e794ee2c5e
@ -17,12 +17,10 @@ by cocoa
|
||||
|
||||
'''
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
import ast
|
||||
import json
|
||||
import os
|
||||
import redis
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import redis
|
||||
import time
|
||||
|
||||
argsparser = argparse.ArgumentParser(description="Redis exporter LJ")
|
||||
@ -51,12 +49,9 @@ try:
|
||||
time.sleep(0.01)
|
||||
line = line.rstrip('\n')
|
||||
line=line[1:-1]
|
||||
# Decode as list of lists
|
||||
pointsList = ast.literal_eval(line)
|
||||
# convert to list of tuples
|
||||
pointsList = [tuple(elem) for elem in pointsList]
|
||||
# Convert to JSON string
|
||||
line = json.dumps( pointsList )
|
||||
line = line.replace("[",'(')
|
||||
line = line.replace("]",')')
|
||||
line = "[{}]".format(line)
|
||||
if r.set(key,line)==True:
|
||||
debug("exports::redis set("+str(key)+") to "+line)
|
||||
except EOFError:
|
||||
|
Loading…
Reference in New Issue
Block a user