diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..db08384a02fc7f82f2e64190fe0b22def6ca7206 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +pyconf.py \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0e95fc8961c590b2295e9f6afe84856536519a94 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# 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 + diff --git a/property-pull.py b/property-pull.py index 91854113af73bd5ca1c5875a0d893e1a4880647d..c4eb892aa5f5712ccf399a958a61c61a20168797 100644 --- a/property-pull.py +++ b/property-pull.py @@ -2,6 +2,7 @@ import json import sys import mysql.connector +import pyconf as cfg from cern.nxcals.pyquery.builders import * from pyspark import SparkConf @@ -18,11 +19,11 @@ _dest_dir = '.' # mysqlDB variables mydb = mysql.connector.connect( - host='dbod-testdb-nxdblm.cern.ch', - port='5501', - user='pythonUser', - passwd='pythonPusher', - database='nxcals_blm_data' + host=cfg.mysql['host'], + port=cfg.mysql['port'], + user=cfg.mysql['user'], + passwd=cfg.mysql['passwd'], + database=cfg.mysql['database'] ) # id of the sql data's row for this filling @@ -66,12 +67,12 @@ def pull_histogram(_start_time, _end_time, _device): data = {} df = KeyValuesQuery.builder(spark).system("CMW") \ - .startTime(_start_time) \ - .endTime(_end_time) \ - .entity() \ - .keyValue("device", _device) \ - .keyValue("property", _property) \ - .buildDataset() + .startTime(_start_time) \ + .endTime(_end_time) \ + .entity() \ + .keyValue("device", _device) \ + .keyValue("property", _property) \ + .buildDataset() df.printSchema()