コード例 #1
0
 def __init__( self ):
     redis_startup    = redis.StrictRedis( host = "127.0.0.1", port=6379, db = 1 ) 
     username         = redis_startup.hget("AI_rabbitmq","username" )
     password         = redis_startup.hget("AI_rabbitmq","password" )
     server           = redis_startup.hget("AI_rabbitmq","server"   )
     port             = int(redis_startup.hget("AI_rabbitmq","port"     ) )   
     qc               = Query_Configuration()
     objects          = qc.match_labels( "CONTROLLER" )
     self.station_control       = Status_Alert_Cmds( )
     self.connections = {}
     for i in objects:
         temp = {}
         vhost                     = i.properties["vhost"]
         queue                     = i.properties["rpc_queue"]
         temp["vhost"]             = vhost
         temp["rpc_queue"]         = queue
         temp["workspace_name"]    = i.properties["workspace_name"]
         remote_interface          = RabbitMq_Client(server,port,username,password,vhost,queue)
         station_control           = Status_Alert_Cmds()
         station_control.set_rpc( remote_interface , 10 ) 
         temp["station_control"] = station_control
         self.connections[vhost] = temp
コード例 #2
0
 def __init__(self):
     redis_startup = redis.StrictRedis(host="127.0.0.1", port=6379, db=1)
     username = redis_startup.hget("AI_rabbitmq", "username")
     password = redis_startup.hget("AI_rabbitmq", "password")
     server = redis_startup.hget("AI_rabbitmq", "server")
     port = int(redis_startup.hget("AI_rabbitmq", "port"))
     qc = Query_Configuration()
     objects = qc.match_labels("CONTROLLER")
     self.station_control = Status_Alert_Cmds()
     self.connections = {}
     for i in objects:
         temp = {}
         vhost = i.properties["vhost"]
         queue = i.properties["rpc_queue"]
         temp["vhost"] = vhost
         temp["rpc_queue"] = queue
         temp["workspace_name"] = i.properties["workspace_name"]
         remote_interface = RabbitMq_Client(server, port, username,
                                            password, vhost, queue)
         station_control = Status_Alert_Cmds()
         station_control.set_rpc(remote_interface, 10)
         temp["station_control"] = station_control
         self.connections[vhost] = temp
コード例 #3
0
from pymongo import MongoClient
from mongodb_capped_collections import Capped_Collections
from update_irrigation_data import Update_Irrigation_Data
from update_irrigation_valve_current_draw import Update_Irrigation_Valve_Current_Draw
from update_irrigation_valve_current_draw import Analyize_Valve_Current_Data
from remote_statistics import Analyize_Controller_Parameters
from remote_statistics import Analyize_Remote_Connectivity

if __name__ == "__main__":

    client = MongoClient()
    mongodb_db = Mongodb_DataBase(client)
    mongodb_col = Mongodb_Collection(client)

    rc = Rabbitmq_Remote_Connections()
    qc = Query_Configuration()
    cc = Capped_Collections(mongodb_db,
                            mongodb_col,
                            db_name="Capped_Colections")
    idd = Update_Irrigation_Data(rc, qc, cc)
    cd = Update_Irrigation_Valve_Current_Draw(rc, qc, cc)
    aid = Analyize_Valve_Current_Data(qc)
    ac = Analyize_Controller_Parameters(rc, qc)
    ar = Analyize_Remote_Connectivity(rc, qc)

    cd.update_coil_current(1)
    idd.update_irrigation_data(1)
    aid.analyize_data()
    ac.update_controller_properties()
    ar.analyize_data()