glaciation.cdu package

Submodules

glaciation.cdu.api module

class glaciation.cdu.api.CduAPIWrapper(jsonFile)[source]

Bases: object

Wrapper to call CduApi using Json files.  It will start syncronizations or monitorizations with remote cdu in new threads.

Parameters:

jsonFile (string) – Path of a json file

connections

A formatted dictionary obtained from a json file and containing all the info for multiple vardbs

Type:

object

runAll(vardb=None, retries=10)[source]

Starts all synchronization and monitorization in parallel

startSync(vardb=None, retries=5)[source]

Starts a syncronization with a remote CDU for later read or write variables using vardb variables using vardbvar.py library

startMon(vardb=None, retries=5)[source]

Starts a monitorization with a remote CDU and creates a csv file with the period frecuency defined in the json

isSincronized(vardb=None)[source]

Check if vardb is syncronized

isMonitoring(vardb=None)[source]

Check if vardb is monitoring

stopSync(vardb = None))[source]

Stop synchronization

stopMon(vardb = None))[source]

Stop monitorization

writeVar(vardb, container, variableList, valueList, quality=True, force=True)[source]

Write a variable in same way as Timon does it

disconnect(vardb = None):

Kill started CDU sync and mon

disconnect(vardb=None)[source]

Kill all started CDU sync and mon.  If not vardb given it will kill all

Parameters:

vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

static disconnectAll()[source]

Kill all started CDU sync and mon in any CduAPIWrapper instance.

isMonitoring(vardb=None)[source]

Check if vardb is monitoring.  If not vardb given check in all vardbs.  return false if any mon is down.

Parameters:

vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

Returns:

  • Bool – True if all connection/s are monitoring

  • ErrorList – List of Not connected vardbs

isSincronized(vardb=None)[source]

Check if vardb is syncronized with remote CDU.  If not vardb given check in all vardbs.  return false if any sync is down

Parameters:

vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

Returns:

  • Bool – True if connection/s are synchronizes

  • ErrorList – List of Not connected vardbs

isWriting(vardb, container, variableList)[source]

Check if cdu is writing a variable.  If not vardb given it will check all writing processes.  return false if any writting is down.

Parameters:
  • vardb (string) – vardb name given to the connection

  • container (string) – name of the container

  • variableList (string/list) –

Returns:

True if all writing/s are OK

Return type:

Bool

runAll(vardb=None, retries=10, runSync=True, runMon=True)[source]

Launch CDU syncronization and monitorization.  If not vardb given it will try to connect to all vardbs in the json

Parameters:
  • vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

  • retries (int) – Retries in case the sync fails (default is 5)

  • runSync (bool) – True to run syncronization. False to not run sync. (defaul is True)

  • runMon (bool) – True to run monitorization. False to not run mon. (defaul is True)

Raises:

Exception – Could not be syncronized/monitorize

startMon(vardb=None, retries=5)[source]

Start CDU monitorization and create binary/csv file.  If not vardb given it will try to connect to all vardbs in the json.

Parameters:
  • vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

  • retries (int) – Retries in case the sync fails (default is 5)

startSync(vardb=None, retries=5)[source]

Starts a syncronization with a remote CDU for later read or write variables using vardb.  If not vardb given it will try to connect to all vardbs in the json.

Parameters:
  • vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

  • retries (int) – Retries in case the sync fails (default is 5)

stopMon(vardb=None)[source]

Stop CDU monitorization.  If not vardb given it will stop all monitoring processes.

Parameters:

vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

stopSync(vardb=None)[source]

Stop CDU synchronization.  If not vardb given it will stop all sync processes.

Parameters:

vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

stopWriteVar(vardb, container, variableList)[source]

Stop CDU writing var

Parameters:
  • vardb (string) – vardb name given to the connection

  • container (string) – name of the container

  • variableList (string/list) – list of variable names to stop writing. Can be only a one variable (a String)

writeVar(vardb, container, variableList, valueList, quality=True, force=True)[source]

Solicitar la escritura puntual e independiente de una variable mediante CDU api.  Write/Force a variable in the same way as timon does.

Parameters:
  • vardb (string) – vardb name given to the connection

  • container (string) – name of the container

  • variableList (string/list) – list of variable names to be written. Can be only a one variable (a String)

  • valueList (int/list) – list of value(s) to assign to variable(s). Can be only a one variable (a int)

  • quality (bool) – True/false quality to assign to variable

  • quality – True to force, False to unforce

glaciation.cdu.vardb module

class glaciation.cdu.vardb.VardbVarWrapper(jsonFile)[source]

Bases: object

Wrapper to use vardbvar and VarDbAccess libraries using Json files for the initial configuration. It will give an easy interface to read and force variables in diferent vardbs and containers.  To be able to connect to vars it is necessary to previously syncronize with the remote CDU server …

Parameters:

jsonFile (string) – Path of a json file

self.json
Type:

json File

self.VARDB_LIST
Type:

List of vardbs

self.VARDB
Type:

Object containing variable connections from VarDbAccess

self.VARS
Type:

List of variables

loadVars(vardbName=None)[source]

Init a connection to all variables in vardb !!!Indispensable to call it before reading or forcing vars!!! If not vardbName given it will try to connect to all vardbs in the json

readVar(vdb, vname)

Read a variable for vardb

forceVar(vdb, vname, value)

Force a variable in vardb

readVarQOk(vdb, vname)

Same as readVar(vdb, vname) but raising Exception in case of Q=0

readQuality(vdb, vname)

Read quality of a variable

unforceVar(vdb, vname)

Unforce a variable in vardb

\*\* Functions readVar, forceVar, readVarQOk, readQuality, and unforceVar accept alias instead of vdb, vname **
Raises:

Exception – An exception occurred in loadVars

forceVar

Dispatch methods based on type signature

See also

Dispatcher

loadVars(vardbName=None)[source]

Creates a connection to all variables in vardb using VarDbAccess.  Indispensable to call it before reading or forcing them.  If not vardbName given it will try to connect to all vardbs in the json

Parameters:

vardb (string) – vardb name given to the connection (default is None, which implies all conexions defined in json file)

readQuality

Dispatch methods based on type signature

See also

Dispatcher

readVar

Dispatch methods based on type signature

See also

Dispatcher

readVarQOk

Dispatch methods based on type signature

See also

Dispatcher

setSilence(boolValue)[source]

Activate/deactivate print in Vardbclass

Parameters:

boolValue (bool) – If True it will not print when reading/writting

unforceVar

Dispatch methods based on type signature

See also

Dispatcher

writeVar

Dispatch methods based on type signature

See also

Dispatcher

Module contents