Skip to content
Snippets Groups Projects
Commit 8b3417a7 authored by Quentin Codelupi's avatar Quentin Codelupi
Browse files

Final Init

parent ba5d4773
No related branches found
No related tags found
No related merge requests found
pyconf.py
\ No newline at end of file
# Property Pull
Property pull is a Python project for the Cern's BLM section.
It get precise data property for diamond devices by NXCALS and store it in lighter format on a MYSQL DB.
In order to be used in other application.
## Installation
## Usage
## Left to do
...@@ -2,6 +2,7 @@ import json ...@@ -2,6 +2,7 @@ import json
import sys import sys
import mysql.connector import mysql.connector
import pyconf as cfg
from cern.nxcals.pyquery.builders import * from cern.nxcals.pyquery.builders import *
from pyspark import SparkConf from pyspark import SparkConf
...@@ -18,11 +19,11 @@ _dest_dir = '.' ...@@ -18,11 +19,11 @@ _dest_dir = '.'
# mysqlDB variables # mysqlDB variables
mydb = mysql.connector.connect( mydb = mysql.connector.connect(
host='dbod-testdb-nxdblm.cern.ch', host=cfg.mysql['host'],
port='5501', port=cfg.mysql['port'],
user='pythonUser', user=cfg.mysql['user'],
passwd='pythonPusher', passwd=cfg.mysql['passwd'],
database='nxcals_blm_data' database=cfg.mysql['database']
) )
# id of the sql data's row for this filling # id of the sql data's row for this filling
...@@ -66,12 +67,12 @@ def pull_histogram(_start_time, _end_time, _device): ...@@ -66,12 +67,12 @@ def pull_histogram(_start_time, _end_time, _device):
data = {} data = {}
df = KeyValuesQuery.builder(spark).system("CMW") \ df = KeyValuesQuery.builder(spark).system("CMW") \
.startTime(_start_time) \ .startTime(_start_time) \
.endTime(_end_time) \ .endTime(_end_time) \
.entity() \ .entity() \
.keyValue("device", _device) \ .keyValue("device", _device) \
.keyValue("property", _property) \ .keyValue("property", _property) \
.buildDataset() .buildDataset()
df.printSchema() df.printSchema()
......
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