Skip to content
Snippets Groups Projects
Commit 554a45dc authored by Andrea Michelotti's avatar Andrea Michelotti
Browse files

added factor and offset for json too

parent f9a5f531
No related branches found
No related tags found
No related merge requests found
Pipeline #128613 failed
......@@ -33,7 +33,7 @@ build_image:
- docker login baltig.infn.it:4567 -u amichelo -p ${DOCKER_REGISTRY}
- docker build --no-cache -f Dockerfile -t baltig.infn.it:4567/lnf-da-control/memcached2influx:1.0 .
- docker push baltig.infn.it:4567/lnf-da-control/memcached2influx:1.0
- docker push baltig.infn.it:4567/lnf-da-control/memcached2influx:1.1
deploy_dafne:
stage: deploy
......
......@@ -125,43 +125,48 @@
},
{
"name": "SPARC:AC1BCM01",
"type": "json",
"type": "json","factor":1.0,
"description": "Charge",
"rate": 10,
"keybind": "AC1BCM01_DYN"
},{
"name": "SPARC:AC1FBCM1",
"type": "json",
"type": "json","factor":1.0,
"description": "Charge",
"rate": 10,
"keybind": "AC1FBCM1_DYN"
},{
"name": "SPARC:AC1FCP01",
"type": "json",
"type": "json","factor":1.0,
"description": "Charge",
"rate": 10,
"keybind": "AC1FCP01_DYN"
},{
"name": "SPARC:AC2BCM01",
"type": "json",
"type": "json","factor":1.0,
"description": "Charge",
"rate": 10,
"keybind": "AC2BCM01_DYN"
},{
"name": "SPARC:DGLBCM01",
"type": "json",
"type": "json","factor":1.0,
"description": "Charge",
"rate": 10,
"keybind": "DGLBCM01_DYN"
},{
"name": "SPARC:DGLBCM02",
"type": "json",
"type": "json","factor":1.0,
"description": "Charge",
"rate": 10,
"keybind": "DGLBCM02_DYN"
},{
"name": "SPARC:PTLBCM01",
"type": "json",
"type": "json","factor":1.0,
"description": "Charge",
"rate": 10,
"keybind": "PTLBCM01_DYN"
......
......@@ -197,6 +197,12 @@ elif args.file:
pattern = re.compile('[\W_]+')
result = re.sub(pattern, '', no_spaces)
# print(f'Key: {result.lower()}, Value: {value}')
if isinstance(value,(int,float)):
if 'factor' in k:
value=value*k['factor']
if 'offset_value' in k:
value=value+k['offset_value']
data_point = {
"measurement": k['name'],
"time": datetime.utcnow(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment