Configuration¶
-
class
ngamsLib.ngamsConfig.ngamsConfig(filename='', dbObj=None)¶ Class to handle the information in the NG/AMS Configuration.
-
addAuthUser(user, password)¶ Add a user in the object.
user: User name (string).
password: Encrypted password (string).
Returns: Reference to object itself.
-
addAuthUserCommands(user, commands)¶ Add a user in the object.
user: User name (string).
- commands: comma separated commands (string). e.g. RETRIEVE,STATUS,QARCHIVE
- a “*” means all commands
Returns: Reference to object itself.
-
addMimeTypeMap(mimeType, extension)¶ Add a mime-type map to the object.
mimeType: Mime-type (string).
extension: Extension corresponding to mime-type (string).
Returns: Reference to object itself.
-
addMirroringSrcObj(mirSrcObj)¶ Add a new Mirroring Source Object in the internal list.
mirSrcObj: Mirroring Source Object (ngamsMirroringSource).
Returns: Reference to object itself.
-
addStorageSetObj(storageSetObj)¶ Add a Storage Set object to the configuration.
storageSetObj: Instance of Storage Set class (ngamsStorageSet).
Returns: Reference to object itself.
-
addStreamObj(streamObj)¶ Add an ngamsStream object.
streamObj: Stream object (ngamsStream).
Returns: Reference to object itself.
-
clear()¶ Clear the object.
Returns: Reference to object itself.
-
dumpXmlDic()¶ Dump the contents of the XML Dictionary in a buffer in the format:
<Key> = <Value> <Key> = <Value> …- Returns: Reference to string buffer with the XML Dictionary dump
- (string).
-
genXml(hideCritInfo=1)¶ Generate an XML DOM Node object from the contents of the ngamsConfig object.
Returns: XML DOM Node (Node).
-
genXmlDoc(hideCritInfo=1)¶ Generate an XML Document from the contents loaded in a string buffer and return this.
hideCritInfo: Hide critical information (integer/0|1).
Returns: XML document (string).
-
getAlertNotifList()¶ Get reference to tuple with recipients of Alert Notification Events.
Returns: Tuple with recipients (tuple).
-
getAllowArchiveReq()¶ Get the Allow Archive Request Flag.
Returns: Allow Archive Request Flag (integer).
-
getAllowProcessingReq()¶ Get the Allow Processing Request Flag.
Returns: Allow Processing Request Flag (integer).
-
getAllowRemoveReq()¶ Get the Allow Remove Request Flag.
Returns: Allow Remove Request Flag (integer).
-
getAllowRetrieveReq()¶ Get the Allow Retrieve Request Flag.
Returns: Allow Retrieve Request Flag (integer).
-
getArchiveName()¶ Get name of the archive.
Returns: Name of archive (string).
-
getArchiveRotatedLogfiles()¶ Whether rotated logfiles are automatically archived locally or not
-
getArchiveUnits()¶ Get Archive Units.
Returns: Archive Units (string).
-
getAssocSlotId(slotId)¶ Get the Slot ID of the disk associated to the disk with the given Slot ID.
slotId: Slot ID (string).
Returns: Slot ID of associated disk - “” if not found (string).
-
getAuthExcludeCommandList()¶ Return the list of commands excluded from authorization
- Returns: comma separated commands (string).
- e.g. ARCHIVE,CHECKFILE,RETRIEVE,STATUS A “*” is a wildcard for all commands
-
getAuthHttpHdrVal(user)¶ Generate the value to be sent with the HTTP Autorization Header. If no specific user is given, an arbitrary user is chosen.
user: Name of registered user (string|None).
Returns: Authorization HTTP Header value (string).
-
getAuthUserCommands(user)¶ Returns the info (password) for a user.
user: User name (string).
Returns: Password or None (string).
-
getAuthUserInfo(user)¶ Returns the info (password) for a user.
user: User name (string).
Returns: Password or None (string).
-
getAuthorize()¶ Return the authorization flag.
Returns: 1 = authorization on (integer/0|1).
-
getAutoUnsubscribe()¶ Return the Auto-Unsubscribe Flag.
Returns: Auto Un-Subscribe Flag (integer/0|1).
-
getBackLogBufferDirectory()¶ Get the Back Log Buffer Directory.
Returns: Back Log Buffer Directory (string).
-
getBackLogBuffering()¶ Get the enable/disable Back Log Buffering Flag.
Returns: Back Log Buffering on/off (0/1) (integer).
-
getBackLogDir()¶ Return the exact (complete) name of the Back-Log Buffer Directory.
Returns: Name of Back-Log Buffer Directory (string).
-
getBackLogExpTime()¶ Return the expiration time for directories and files in the Subscription Back-Log Area.
Returns: Expiration time (string/ISO 8601).
-
getBlockSize()¶ Get HTTP data read/write block size.
Returns: HTTP data read/write block size (integer).
-
getCRCVariant()¶ Defines the CRC Variant to use.
Returns: - -1: Don’t perform any CRC calculation at all
- 0:
crc32(using python’s binascii implementation w/o masking) - 1:
crc32c(using Intel’s SSE 4.2 implementation via thecrc32cmodule) - 2:
crc32z(using python’s binascii implementation w/ masking)
-
getCachingEnabled()¶ Whether the server is configured to operate in caching mode (default: False)
-
getCachingPeriod()¶ Return the period for checking the cache holding.
Returns: Value of caching period (integer).
-
getCfg()¶ Get the name of the configuration file loaded into the object.
Returns: Name of configuration file (string).
-
getDataCheckActive()¶ Return the Data Check Service enable/disable flag.
Returns: Data Check Service enabled/disabled (integer).
-
getDataCheckForceNotif()¶ Return the Force Data Check Notification Flag.
Returns: Force notification = 1 (integer/0|1).
-
getDataCheckMaxProcs()¶ Return the maximum number of parallel Data Check sub-processes.
Returns: Maximum number of sub-processes (integer).
-
getDataCheckMinCycle()¶ Return the Data Check Service Minimum Cycle Time.
Returns: Data Check Minimum Cycle Time (string).
-
getDataCheckNotifList()¶ Get reference to tuple with recipients of Data Check Notification Messages.
Returns: Tuple with recipients (tuple).
-
getDataCheckScan()¶ Return the Data Check Scan Flag.
Returns: Data Check Scan Flag (integer/0|1).
-
getDataMoverHostIds()¶
-
getDataMoverSuspenstionTime()¶ Return the Data Mover (Subscription) Thread Suspension Time.
Returns: Suspension time (string/ISO 8601).
-
getDbInterface()¶ Get the name of the NG/AMS DB Interface Plug-In in use.
Returns: DB Interface Plug-In (string).
-
getDbMaxPoolCons()¶ Max number of DB Pool Connections.
NOTICE: 7 connections was chosen as a default to allow for all the NGAS background services to have a long running db connection while allowing user requests to be serviced. Anything less than 7 with all the services enabled might cause user requests to block waiting for a db connection to be placed back in the pool from a long running service.
Returns: Max number of DB Pool Connections.
-
getDbParameters()¶ Return DB connection parameters.
Returns: DB connection parameters (string).
-
getDbSessionSql()¶ SQL commands to run whenever a connection is established
-
getDbSnapshot()¶ Return the DB Snapshot Feature on/off.
Returns: DB Snapshot Feature state (integer/0|1).
-
getDbUseFileIgnore()¶ Indicates whether to use “file_ignore” as the column name on the “ngas_files” table as opposed to “ignore”. For historical reasons the same column has been referenced using two different names.
-
getDiskChangeNotifList()¶ Get reference to tuple with recipients of Disk Change Notification Events.
Returns: Tuple with recipients (tuple).
-
getDiskSpaceNotifList()¶ Get reference to tuple with recipients of Disk Space Notification Events.
Returns: Tuple with recipients (tuple).
-
getDiskSyncPlugIn()¶ Get name of the Disk Sync Plug-In.
Returns: Name of Disk Sync Plug-In (string).
-
getErrorNotifList()¶ Get reference to tuple with recipients of Error Notification Events.
Returns: Tuple with recipients (tuple).
-
getExtFromMimeType(mimeType)¶ Get the file extension corresponding to the given mime-type.
mimeType: Mime-type (string).
Returns: Extension corresponding to mime-type (string).
-
getFileStagingEnable()¶ Return if the file staging flag is set to Enabled / Disable
Returns: 1 = enabled, 0 = disabled (integer/0|1)
-
getFileStagingPlugIn()¶ Return the name of the FileStagingPlugIn, which takes file online if it is offline.
The plugin must contain these two functions:
- def isFileOffline(filename)
- PAR: filename: string RETURN: 1 - yes, 0 - no, Exception - error
- def stageFiles(filenameList)
- PAR: filenameList: List of file names (string) RETURN: the number of files staged. Exception, if any errors
-
getFreeSpaceDiskChangeMb()¶ Get the limit for the minimum free disk space before changing disk.
Returns: MB limit for changing disk (integer).
-
getIdleSuspension()¶ Return the NGAS Idle Suspension Flag.
Returns: Idle Suspension Flag (integer/0|1).
-
getIdleSuspensionTime()¶ Return the Idle Suspension Time.
Returns: Idle Suspension Time in seconds (integer).
-
getIpAddress()¶ Get socket port number.
Returns: Reference to object itself.
-
getJanitorPlugins()¶ Get the list of Janitor Plug-in names.
Returns: Janitor Service Suspension Time (string).
-
getJanitorSuspensionTime()¶ Get Janitor Service Suspension Time.
Returns: Janitor Service Suspension Time (string).
-
getLabelPrinterPlugIn()¶ Get name of Label Printer Plug-In.
Returns: Name of Printer Plug-In (string).
-
getLabelPrinterPlugInPars()¶ Get input parameters for Label Printer Plug-In.
Returns: Input parameters for Label Printer Plug-In (string).
-
getLocalLogFile()¶ Return the Local Log File.
Returns: Name of Local Log File (string).
-
getLocalLogLevel()¶ Return the Local Log Level.
Returns: Local Log Level (integer).
-
getLogRotateCache()¶ Return the size of the internal log rotation cache.
Returns: Size of internal log buffer (integer).
-
getLogRotateInt()¶ Return the Log Rotation Interval given as an ISO 8601 timestamp.
Returns: Log Rotation Interval as ISO 8601 format (string).
-
getMaxRetentionSize()¶ Get the Maximum Retention Size, which is the maximum number of Email Notification Messages, which is kept before sending these out.
Returns: Maximum retention buffer size (integer).
-
getMaxRetentionTime()¶ Return the Maximum Retention Time, which is the maximum time an Email Notification Message should be retained before it is send out.
Returns: Maximum Retention Time as ISO 8601 format (string).
-
getMaxSimReqs()¶ Get the maximum number of simultaneous requests.
Returns: Maximum number of simultaneous requests (integer).
-
getMimeTypeMappings()¶ Return list containing sub-lists, one for each mime-type/extension mapping. The format is: [[mime-type, ext], [mime-type, ext], …].
Returns: List with mime-type mappings ([[mt, ext], [mt, ext], …]).
-
getMinFreeSpaceWarningMb()¶ Get the limit for the minimum free space available, before a warning is issued to change the disk.
Returns: Minimum free space before issuing warning (integer).
-
getMinSpaceSysDirMb()¶ Get the minimum amount of free disk space required on the NG/AMS System Directories.
Returns: Minimum space (integer).
-
getMirroringActive()¶ Return the flag indicating if the Mirroring Service is activated.
Returns: Value of mirroring activated flag (integer).
-
getMirroringErrorRetryPeriod()¶ Return the period for retrying to mirroring failing requests.
Returns: Error retry timeout (integer).
-
getMirroringErrorRetryTimeOut()¶ Return the timeout for retrying to mirror a failing request.
Returns: Error retry timeout (integer).
-
getMirroringReportRecipients()¶ Return the report recipients list.
Returns: The list of report recipients.
-
getMirroringSrcList()¶ Get reference to list with Mirroring Source Objects.
- Returns: List with Mirroring Source Objects
- ([ngamsMirroringSource, …]).
-
getMirroringSrcObj(id)¶ Find the Mirroring Source Object with the given ID.
id: ID associated to the Mirroring Source Object (string).
- Returns: Reference to Mirroring Source Object in question
- (ngamsMirroringSource).
-
getMirroringSrcObjFromSrvList(srvList)¶ Return the Mirroring Source Object associated to the given Server List.
srvList: Server list, common separated list of
‘<Node>:<Port,…’ (string).- Returns: Reference to Mirroring Source Object associated to the
- given server list (ngamsMirroringSource).
-
getMirroringThreads()¶ Return the number of mirroring threads to use.
Returns: Number of mirroring threads (integer).
-
getNGASJobMANHost()¶
-
getNoDiskSpaceNotifList()¶ Get reference to tuple with recipients of No Free Disks Notification Events.
Returns: Tuple with recipients (tuple).
-
getNotifActive()¶ Return the Email Notification Active Flag.
Returns: Notification Active Flag (integer)
-
getNotifSmtpHost()¶ Return the SMTP Host for sending Notification e-mails.
Returns: SMTP Host (string).
-
getNotifSmtpPort()¶ Return the SMTP port for sending Notification e-mails.
Returns: SMTP Port (int).
-
getOfflinePlugIn()¶ Get name of Offline Plug-In.
Returns: Name of Offline Plug-In (string).
-
getOfflinePlugInPars()¶ Get input parameters for Offline Plug-In.
Returns: Input parameters for Offline Plug-In (string).
-
getOnlinePlugIn()¶ Get name of Online Plug-In.
Returns: Name of Online Plug-In (string).
-
getOnlinePlugInPars()¶ Get input parameters for Online Plug-In.
Returns: Input parameters for Online Plug-In (string).
-
getPathPrefix()¶ Return Path Prefix.
Returns: Path Prefix (string).
-
getPluginsPath()¶ Get the directory where plug-ins are placed.
-
getPortNo()¶ Get socket port number.
Returns: Reference to object itself.
-
getProcessingDirectory()¶ Get NG/AMS Processing Directory.
Returns: Processing directory (string).
-
getProxyCRC()¶ If the proxy archive server check CRC as well
By default, 0 (do not check CRC)
-
getProxyMode()¶ Get Proxy Mode Flag.
Returns: Proxy Mode Flag (integer).
-
getReplication()¶ Return File Replication on/off flag.
Returns: File Replication on/off flag (integer).
-
getRequestDbBackend()¶ Returns whether the server should keep a request database or not.
-
getRootDirectory()¶ Get NGAS Root Directory.
NOTE: THE NGAMS_PREFIX environment variable overrides the one in the Config-file.
Returns: NGAS Root Directory (string).
-
getSender()¶ Return the senders email address. This is important in cases where the smtp server is setup to allow emails only from known domains and the NGAS server sits on a private network.
Returns: email address for the ‘from’ field (string).
-
getSlotIdDefined(slotId)¶ Returns 1 if the Slot ID indicated is used in one of the Storage Sets defined, otherwise 0 is returned.
slotId: Slot ID (string).
Returns: 1 if Slot ID is defined, otherwise 0 (integer/0|1).
-
getSlotIds()¶ Return tuple with Slot IDs. The format is:
[<Main Slot ID 1>,[ <Rep. Slot ID 1>,] <Main Slot ID 2>, …]Returns: Tuple with Slot IDs (tuple).
-
getStorageSetFromId(storageSetId)¶ Return a Storage Set object from a given Storage Set ID.
storageSetId: Storage Set ID (string).
- Returns: Instance of ngamsStorageSet or
- None (ngamsStorageSet | None).
-
getStorageSetFromSlotId(slotId)¶ Get a Storage Set object from a given Slot ID.
slotId: Slot ID (string).
- Returns: Instance of ngamsStorageSet or
- None (ngamsStorageSet | None).
-
getStorageSetList()¶ Get reference to list with Storage Set objects.
Returns: List with storage set objects ([ngamsStorageSet, …]).
-
getStreamFromMimeType(mimeType)¶ Get an ngamsStream object from its mime-type.
mimeType: Mime-type for Stream (string).
Returns: Stream object or None (ngamsStream|None).
-
getStreamList()¶ Get list containing the Stream objects
Returns: List containing Stream objects ([ngamsStream, …]).
-
getSubscrEnable()¶ Return the Susbcription Enable/Disable Flag to switch on/off the subscription for data from data providers.
Returns: 1 = enabled, 0 = disabled (integer/0|1).
-
getSubscrSuspTime()¶ Return the Subscription Thread Suspension Time.
Returns: Suspension time (string/ISO 8601).
-
getSubscriptionsDic()¶ Get reference to list with Subscriptions Objects.
Returns: Subscriber List (list/ngamsSubscriber).
-
getSuspensionPlugIn()¶ Return the name of the Suspension Plug-In.
Returns: Name of plug-in (string).
-
getSuspensionPlugInPars()¶ Return the Suspension Plug-In parameters.
Returns: Plug-in parameters (string).
-
getSysLog()¶ Return the syslog on/off flag.
Returns: Syslog on/off flag (integer).
-
getSysLogAddress()¶ Return the address where syslog is listening for incoming messages. If no address is given, a platform-dependent default is used
Returns: Syslog address (string).
-
getSysLogPrefix()¶ Return the syslog prefix.
Returns: Syslog prefix (string).
-
getTimeOut()¶ Gets the timeout that applies to HTTP requests.
-
getVal(parName)¶ Return the value of a parameter.
- parName: Name of the parameter in the ‘Simplified XPath Syntax’,
e.g.:
NgamsCfg.Server[1].ArchiveName (string).
Returns: Value of parameter or None (<Value>|None).
-
getVolumeDirectory()¶ Return value of the Volume Directory attribute in the Server Element.
Returns: Value of VolumeDirectory (string).
-
getWakeUpCallTimeOut()¶ Return the Wake-Up Call Time-Out for waiting for an NGAS host being woken up to be up and running.
Returns: Time-out in seconds (integer).
-
getWakeUpPlugIn()¶ Return the name of the Wake-Up Plug-In.
Returns: Name of plug-in (string).
-
getWakeUpPlugInPars()¶ Return the parameters to the Wake-Up Plug-In.
Returns: Plug-in parameters (string).
-
getWakeUpServerHost()¶ Return the Wake-Up Server host name.
Returns: Name of Wake-up Server Host (string).
-
hasAuthUser(user)¶ Check if a user with the given ID is defined.
user: User name (string).
Returns: 1 = user defined (integer/0|1).
-
load(filename, check=0)¶ Load an NG/AMS Configuration File into the object.
filename: Name of configuration file (string).
- check: If set to 1 the semantics is checked after loading
- (integer/0|1).
Returns: Reference to object itself.
-
loadFromDb(name, dbObj=None)¶ Load a configuration from the DB via the given ID.
name: Name of the configuration in the DB (string).
dbObj: DB connection object (ngamsDb).
Returns: Reference to object itself.
-
save(targetFilename, hideCritInfo=1)¶ Save the configuration in the object into a XML document with the given name.
targetFilename: Name of target file (string).
- hideCritInfo: If set to 1 passwords and other ‘confidential’
- information appearing in the log file, will be hidden (integer/0|1).
Returns: Reference to object itself.
-
setDbObj(dbObj)¶ Set the DB connection object of this instance.
dbObj: DB connection object (ngamsDb).
Returns: Reference to object itself.
-
setDiskChangeNotifList(subscriberList)¶ Set the list of Disk Change Notification Subscribers.
- subscriberList: List of subscribers of the Disk Change
- Notification (list).
Returns: Reference to object itself.
-
setDiskSpaceNotifList(subscriberList)¶ Set the list of Disk Space Notification Subscribers.
- subscriberList: List of subscribers of the Disk Change
- Notification (list).
Returns: Reference to object itself.
-
storeVal(parName, value, dbCfgGroupId=None)¶ Set the value of the given parameter.
parName: Name of parameter e.g.:
NgamsCfg.Server[1].RootDirectory (string).value: Value of the parameter (string).
dbCfgGroupId: DB configuration group ID (string|None).
Returns: Reference to object itself.
-
writeToDb(dbObj=None)¶ Write the configuration loaded into the DB.
dbObj: DB connection object (ngamsDb).
Returns: Reference to object itself.
-