本文整理汇总了Python中PXPaths类的典型用法代码示例。如果您正苦于以下问题:Python PXPaths类的具体用法?Python PXPaths怎么用?Python PXPaths使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PXPaths类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, logger=None, sourlient=None, reloadMode=False):
AFTNPaths.normalPaths(sourlient.name)
PXPaths.normalPaths()
self.logger = logger # Logger object
self.sourlient = sourlient # Sourlient object
self.name = sourlient.name # Transceiver's name
self.stationID = sourlient.stationID # Value read from config. file
self.otherStationID = sourlient.otherStationID # Provider (MHS) Station ID
self.address = sourlient.address # 8-letter group identifying the message originator (CYHQUSER)
self.otherAddress = sourlient.otherAddress # 8-letter group identifying the provider's address (CYHQMHSN)
self.routingTable = sourlient.routingTable # Routing table name
self.subscriber = sourlient.subscriber # Boolean indicating if this is a subscriber or a provider
self.bullManager = bulletinManager(PXPaths.RXQ + self.name,
self.logger,
PXPaths.RXQ + self.name,
9999,
'\n',
self.sourlient.extension,
self.routingTable,
None,
self.sourlient,
True)
self.drp = self.bullManager.drp
self.sp = StationParser(PXPaths.STATION_TABLE, logger)
self.sp.parse()
self.priorities = {'1':'FF', '2':'FF', '3':'GG', '4':'GG', '5':'GG'}
if not reloadMode:
self.afterInit()
示例2: __init__
def __init__(self, rootPath=""):
self.rootPath = rootPath
PXPaths.normalPaths(self.rootPath)
SystemManager.__init__(self)
self.LOG = PXPaths.LOG # Will be used by DirCopier
self.debug = 0
示例3: test_PXPaths
def test_PXPaths(self):
PXPaths.normalPaths('')
self.assertEqual((PXPaths.ROOT,PXPaths.LIB,PXPaths.LOG,PXPaths.ETC,PXPaths.FXQ,PXPaths.RXQ,PXPaths.TXQ,PXPaths.DB,
PXPaths.ROUTING_TABLE,PXPaths.STATION_TABLE,PXPaths.FX_CONF,PXPaths.RX_CONF,PXPaths.TX_CONF,PXPaths.TRX_CONF,
PXPaths.SCRIPTS,PXPaths.LAT,PXPaths.LAT_RESULTS,PXPaths.LAT_TMP,PXPaths.SHELL_PARSER,PXPaths.PX_DATA),
('./', './lib/', './log/', './etc/', './fxq/', './rxq/', './txq/', './db/', './etc/pxRouting.conf', './etc/stations.conf',
'./etc/fx/', './etc/rx/', './etc/tx/', './etc/trx/', './etc/scripts/', './latencies/', './latencies/results/', './latencies/tmp/',
'./lib/shellParser.py', './data/'))
示例4: __init__
def __init__(self, latencier, imageName=None):
PXPaths.normalPaths()
self.text = "" # Results in plain text
self.html = "" # Results in html
self.latencier = latencier # Latencier (PDS or PX)
self.imageName = imageName # Came from the plotter
self.date = self.latencier.date # Date in ISO Format
self.setTextResults()
self.saveResults(PXPaths.LAT_RESULTS)
示例5: __init__
def __init__(self, sourlient):
AFTNPaths.normalPaths(sourlient.name)
PXPaths.normalPaths()
self.sysman = SystemManager() # General system manager
self.sourlient = sourlient # Sourlient (Source/Client) object containing configuration infos.
self.logger = sourlient.logger # Logger object
self.subscriber = sourlient.subscriber # Determine if it will act like a subscriber or a provider(MHS)
self.host = sourlient.host # Remote host (name or ip)
self.portR = sourlient.portR # Receiving port
self.portS = sourlient.portS # Sending port
self.batch = sourlient.batch # Number of files we read in a pass (20)
self.timeout = sourlient.timeout # Timeout time in seconds (default = 10 seconds)
self.sleepBetweenConnect = int('10') # Time (in seconds) between connection trials
self.slow = sourlient.slow # Sleeps are added when we want to be able to decrypt log entries
self.igniter = None # Igniter object (link to pid)
self.writePath = AFTNPaths.RECEIVED # Where we write messages we receive
self.archivePath = AFTNPaths.SENT # Where we put sent messages
self.specialOrdersPath = AFTNPaths.SPECIAL_ORDERS # Where we put special orders
# Paths creation
self.sysman.createDir(PXPaths.TXQ + self.sourlient.name)
self.sysman.createDir(self.writePath)
self.sysman.createDir(self.archivePath)
self.sysman.createDir(self.specialOrdersPath)
self.mm = MessageManager(self.logger, self.sourlient) # AFTN Protocol is implemented in MessageManager Object
self.remoteAddress = None # Remote address (where we will connect())
self.socket = None # Socket object
self.dataFromFiles = [] # A list of tuples (content, filename) obtained from a DiskReader
self.reader = DiskReader(PXPaths.TXQ + self.sourlient.name, self.sourlient.batch,
self.sourlient.validation, self.sourlient.diskReaderPatternMatching,
self.sourlient.mtime, True, self.logger, eval(self.sourlient.sorter), self.sourlient)
self.debug = True # Debugging switch
self.justConnect = False # Boolean that indicates when a connexion just occur
self.totBytes = 0
#self.printInitInfos()
self.makeConnection()
示例6: __init__
def __init__(self, nopull=False, keep=False, date=None, xstats=False):
PXPaths.normalPaths()
self.manager = PXManager()
#self.logger = logger.getLogger()
# Date for which we want to obtain stats
if date == None:
self.date = dateLib.getYesterdayFormatted() # ISO Date
else:
self.date = date
self.dateDashed = dateLib.getISODateDashed(self.date)
self.machines = [] # Machines were the logs can be found
self.sources = [] # Sources for which we will check arrival time of the products
self.client = [] # Client for which we will check delivery time of the products (ONLY ONE ENTRY in the list)
self.messages = [] # FIXME: Special messages coming from weird results
self.nopull = nopull # Do not pull the necessary files (we suppose they are already downloaded)
self.keep = keep # Erase all the files present before downloading new files
self.xstats = xstats # Boolean that determine if we will use xferlog in making stats
self.goodRx = [] # Lines matching initial values
self.goodTx = [] # Lines matching initial values
self.goodXferlog = [] # Lines matching initial values
self.receivingInfos = {} # Dict. addressed by filename and containing a tuple of (formatted date, date in seconds, machine)
self.sendingInfos = {} # Dict. addressed by filename and containing a tuple of (formatted date, date in seconds, machine)
self.xferlogInfos = {} # Dict. addressed by filename and containing a tuple of (formatted date, date in seconds, machine)
self.stats = {} # Final stats
self.sortedStats = [] # Final sorted stats
self.max = 0 # Maximum latency time in seconds
self.min = sys.maxint # Minimum latency time in seconds
self.mean = 0 # Mean latency time in seconds
self.latencyThreshold = 15 # We don't want to go over this threshold (in seconds)
self.overThreshold = 0 # Number of files with latency over threshold
self.underThresholdP = 0 # Percentage of files for which the latency is equal or under threshold
self.meanWaiting = 0 # Mean waiting time before being noticed by the PDS
self.random = str(random.random())[2:] # Unique identificator permitting the program to be run in parallel
self.system = None # 'PDS' or 'PX'
self.rejected = 0 # Count of rejected files
self.maxInfos = ['NO FILE', ('00:00:00', 'No machine', 0)] # Informations about the max.
示例7: findClient
def findClient(self, clusters=None, ip="", name=""):
"""
clusters: a list of clusters (ex: ['pds', 'px', 'pxatx'])
ip: IP address (ex: '192.168.1.1')
name: hostname (ex: 'metmgr')
Only one argument in (ip, name) must be non null
"""
import socket
clusters = clusters or self.clusters
cliClust = []
if ip:
try:
# get the first part of the fully qualified domain name
name = socket.gethostbyaddr(ip)[0].split('.')[0]
except:
pass
elif name:
try:
ip = socket.gethostbyname(name)
except:
pass
for cluster in clusters:
clusterRoot = self.rootPath + cluster
PXPaths.normalPaths(clusterRoot)
if ip and name:
command = "grep -l -E '%s|%s' %s" % (ip, name, PXPaths.TX_CONF + "*.conf")
elif ip:
command = "grep -l -E '%s' %s" % (ip, PXPaths.TX_CONF + "*.conf")
elif name:
command = "grep -l -E '%s' %s" % (name, PXPaths.TX_CONF + "*.conf")
#print "%s" % cluster.upper()
output = commands.getoutput(command)
clients = [ (os.path.basename(cli)[:-5], cluster) for cli in output.split()]
cliClust.extend(clients)
PXPaths.normalPaths() # Reset PXPaths variables
return cliClust
示例8: __init__
def __init__(self):
PXPaths.normalPaths()
self.debug = 0
self.lang = pxRetransLanguage.french
# masterConfPath is a directory where configuration files for all clusters can be found.
# With 2 cluster named cluster1 and cluster2, the config. files will be under:
# "masterConfPath"/cluster1/etc/
# "masterConfPath"/cluster2/etc/
# When we have in fact no cluster (a single machine), the cluster name will be "." and we
# we thus have "masterConfPath"/./etc/
# This "scheme" works well when px is installled under a root directory (ex: /apps/px/)
# It works less well under a Debian installation (where the all the config. files are under
# /etc/px (not /etc/px/etc).
# When installed with a debian package, a symbolic link will be created:
# ln -s /etc/px $HOME/etc ($HOME of the px user)
try:
self.masterConfPath = pwd.getpwnam('px')[5] # Master Configuration root path (1 machine, debian way)
except:
self.masterConfPath = '/apps/px'
self.clusters = ['.'] # 1 machine only (no "real" clusters)
#self.clusters = ['px', 'pxatx', 'pds']
self.feEnvVar = 'PX_FRONTEND'
self.sfeEnvVar = 'PX_SIMILI_FRONTEND'
# Use to execute command (pxRetrans, .localRetrans) on the backend
# via ssh command run on the frontend
self.fePrivKey = '' # Use to connect as beUser from fe to be
self.beUser = 'px' # Use to ssh from the frontend to the backend
# Use to scp results from the backend to the frontend
self.bePrivKey = ''
self.feUser = 'px' # On the backend, results (listing) will be sent to this frontend user
self.feTempDir = '/tmp' # On the backend, results (listing) will be sent to this directory
self.waitTimeForLogEntry = 2 # Time we wait in seconds for obtaining the log line indicating a successful transfert
self.readConfig(PXPaths.ETC + "px.conf")
示例9: normalPaths
def normalPaths(name, rootPath=""):
PXPaths.normalPaths(rootPath)
global ROOT, LIB, TO_SEND, RECEIVED, SENT, SPECIAL_ORDERS, STATE
if rootPath:
if rootPath[-1] != '/': rootPath += '/'
envVar = rootPath
else:
try:
envVar = os.path.normpath(os.environ['PXROOT']) + '/'
except KeyError:
envVar = '/apps/px/'
ROOT = envVar
LIB = ROOT + 'lib/%s/' % name
RECEIVED = PXPaths.TXQ + name + '/.receivedAFTN/'
SENT = PXPaths.TXQ + name + '/.sentAFTN/'
SPECIAL_ORDERS = PXPaths.TXQ + name + '/.specialOrders/'
STATE = PXPaths.TXQ + name + '/.state.obj'
示例10: __init__
def __init__(self, type='impulses', interval=1, imageName=None):
PXPaths.normalPaths()
self.manager = PXManager()
#self.logger = logger
#self.manager.setLogger(self.logger)
self.latenciers = [] # Infos about a particular "latencier"
self.type = type # Type of graph must be in: ['linespoint', 'lines', 'boxes', 'impulses']
self.interval = interval * dateLib.MINUTE # Number of seconds between each point on the x-axis
self.imageName = imageName # Name of the image file
self.color = None
self.width = dateLib.DAY # Width of the x-axis in seconds
# With witdh=DAY and interval=MINUTE => len([60, 120, 180, ..., 86400]) = 1440
self.separators = dateLib.getSeparators(self.width, self.interval)
# '"0" 0, "1" 60, "2" 120, "3" 180, "4" 240, ... , "22" 1320, "23" 1380, "24" 1440'
self.xtics = self.getXTics(len(self.separators), self.interval)
self.graph = Gnuplot.Gnuplot()
示例11: senderWmo
#############################################################################################
"""
import sys, os.path, time, string
import gateway
import socketManagerWmo
import bulletinManagerWmo
import bulletinWmo
from MultiKeysStringSorter import MultiKeysStringSorter
from DiskReader import DiskReader
from CacheManager import CacheManager
import PXPaths
from TextSplitter import TextSplitter
PXPaths.normalPaths()
class senderWmo(gateway.gateway):
def __init__(self,path,client,logger):
gateway.gateway.__init__(self, path, client, logger)
self.client = client
self.establishConnection()
self.reader = DiskReader(PXPaths.TXQ + self.client.name,
self.client.batch, # Number of files we read each time
self.client.validation, # name validation
self.client.patternMatching, # pattern matching
self.client.mtime, # we don't check modification time
True, # priority tree
self.logger,
示例12: _reload
def _reload(self, sig, stack):
"""
Do the real work here. Depends of type of sender/receiver
"""
if self.gateway is None:
# Because we don't have a gateway object, it means that we can only reread the configuration
# file of the source/client, not particular files like Circuit and Stations, because
# they haven't been read at this time anyway.
# If we are there, it is because we don't have a gateway object, if means that we are
# waiting for a connection, the easiest way to reread the configuration file of
# the sources/clients AND the value of the variables in the configuration file of this
# particular source/client is by restarting it!
#self.logger.info("ppid=%s, pid=%s, pgid=%s, sid=%s, cterm=%s" % (os.getppid(), os.getpid(), os.getpgrp(), os.getsid(os.getpid()), os.ctermid()))
#output = commands.getoutput('ls -alrt /proc/%s/fd' % os.getpid())
#self.logger.info(output)
if os.fork() == 0:
for fd in range(3,10):
try:
os.close(fd)
except OSError:
pass
import PXPaths
PXPaths.normalPaths()
appName = 'px' + self.direction.capitalize()
os.execl(PXPaths.BIN + appName, appName, self.flowName, 'restart')
else:
pass
else:
#print self.gateway
if self.direction == 'sender':
self.reloadMode = True
elif self.direction == 'filter':
self.reloadMode = True
elif self.direction == 'receiver':
if self.type == 'am':
# FIXME: Should be put in amReceiver code
# We assign the defaults, reread configuration file for the source
# and reread all configuration file for the clients (all this in __init__)
self.flow.__init__(self.flow.name, self.flow.logger)
self.gateway.unBulletinManager.extension = self.flow.extension
self.gateway.unBulletinManager.addSMHeader = self.flow.addSMHeader
#print self.flow
#print "ext: %s" % (self.flow.extension)
#print "addSM: %s" % (self.flow.addSMHeader)
# Reset all the clients + sourlients names to which px can link (independantly of the routing table)
self.gateway.unBulletinManager.drp.pxLinkables = self.flow.ingestor.allNames
# Reparse the ROUTING_TABLE
self.gateway.unBulletinManager.drp.reparse()
self.gateway.unBulletinManager.reloadMapEntetes(self.gateway.pathFichierStations)
self.logger.info("%s has been reloaded" % self.direction.capitalize())
if self.type == 'wmo':
# FIXME: Should be put in wmoReceiver code
# We assign the defaults, reread configuration file for the source
# and reread all configuration file for the clients (all this in __init__)
self.flow.__init__(self.flow.name, self.flow.logger)
self.gateway.unBulletinManager.extension = self.flow.extension
# Reset all the clients + sourlients names to which px can link (independantly of the routing table)
self.gateway.unBulletinManager.drp.pxLinkables = self.flow.ingestor.allNames
# Reparse the ROUTING_TABLE
self.gateway.unBulletinManager.drp.reparse()
self.logger.info("%s has been reloaded" % self.direction.capitalize())
if self.type == 'collector' :
self.reloadMode = True
if self.type == 'single-file' or self.type == 'bulletin-file':
self.reloadMode = True
if self.type == 'pull-bulletin' or self.type == 'pull-file':
self.reloadMode = True
elif self.direction == 'transceiver':
if self.type == 'aftn':
#if os.fork() == 0:
# self.restart()
# self.logger.info("%s %s has been reloaded by restarting it" % (self.direction.capitalize(), self.flow.name))
#else:
# pass
# FIXME: Should be put in TransceiverAFTN code
# We assign the defaults, reread configuration file for the sourlient
# and reread all configuration file for the clients (all this in __init__)
self.flow.__init__(self.flow.name, self.flow.logger)
self.gateway.mm.reloadMode = True
self.gateway.mm.__init__(self.flow.logger, self.flow, True)
#self.gateway.mm.bullManager.extension = self.flow.extension
# Reset all the clients + sourlients names to which px can link (independantly of the routing table)
#self.gateway.mm.bullManager.drp.pxLinkables = self.flow.ingestor.allNames
#self.gateway.mm.drp = self.gateway.mm.bullManager.drp
# Reparse the ROUTING_TABLE
#.........这里部分代码省略.........
示例13: setBasicPaths
def setBasicPaths(self):
"""
@summary : Sets basic paths which are not influenced by language.
Use full for finding ot what language to use and to call
self.setPaths( language ) later on.
@note : SETS THE FOLLOWING PATHS :
STATSROOT , STATSBIN
STATSETC, STATSLIB
STATSDEV, STATSLANG
Ans the paths under them.
@note:
"""
# Protected StatsPaths
# Paths without _() are protexted paths.
# THEY, and the paths under them, MUST NOT BE TRANSLATED !
self.STATSROOT = self.__getPXStatsRoot()
self.STATSBIN = self.STATSROOT + 'bin/' # Protected to ensure imports work !
self.STATSDEV = self.STATSROOT + 'dev/' # Protected to make sure dependencies work.
self.STATSETC = self.STATSROOT + 'etc/' # Protected as to always fin the config files.
self.STATSLANG = self.STATSROOT + 'lang/' # Protected as to always be able to access languages files.
self.STATSLIB = self.STATSROOT + 'lib/' # Protected to ensure imports work !
# Paths under pxStats/bin/
self.STATSTOOLS = self.STATSBIN + 'tools/'
self.STATSDEBUGTOOLS = self.STATSBIN + 'debugTools/'
self.STATSWEBPAGESGENERATORS = self.STATSBIN + "webPages/"
# Paths under pxStats/etc/
self.STATSPXCONFIGS = self.STATSETC + 'pxConfigFiles/'
self.STATSPXRXCONFIGS = self.STATSPXCONFIGS + 'rx/'
self.STATSPXTXCONFIGS = self.STATSPXCONFIGS + 'tx/'
self.STATSPXTRXCONFIGS = self.STATSPXCONFIGS + 'trx/'
#Paths under pxStats/dev/
self.STATSDEVDEPENDENCIES = self.STATSDEV + 'fileDependencies/'
self.STATSDEVDEPENDENCIESBIN = self.STATSDEVDEPENDENCIES + 'bin/'
self.STATSDEVDEPENDENCIESBINTOOLS = self.STATSDEVDEPENDENCIESBIN + 'tools/'
self.STATSDEVDEPENDENCIESBINDEBUGTOOLS= self.STATSDEVDEPENDENCIESBIN + 'debugTools/'
self.STATSDEVDEPENDENCIESBINWEBPAGES = self.STATSDEVDEPENDENCIESBIN + 'webPages/'
self.STATSDEVDEPENDENCIESLIB = self.STATSDEVDEPENDENCIES + 'lib/'
#Paths under pxStats/lang/ (French paths )
self.STATSLANGFR = self.STATSLANG + 'fr/'
self.STATSLANGFRBIN = self.STATSLANGFR + 'bin/'
self.STATSLANGFRBINTOOLS = self.STATSLANGFRBIN + 'tools/'
self.STATSLANGFRBINDEBUGTOOLS = self.STATSLANGFRBIN + 'debugTools/'
self.STATSLANGFRBINWEBPAGES = self.STATSLANGFRBIN + 'webPages/'
self.STATSLANGFRLIB = self.STATSLANGFR + 'lib/'
#Paths under pxStats/lang/ (English paths )
self.STATSLANGEN = self.STATSLANG + 'en/'
self.STATSLANGENBIN = self.STATSLANGEN + 'bin/'
self.STATSLANGENBINTOOLS = self.STATSLANGENBIN + 'tools/'
self.STATSLANGENBINDEBUGTOOLS = self.STATSLANGENBIN + 'debugTools/'
self.STATSLANGENBINWEBPAGES = self.STATSLANGENBIN + 'webPages/'
self.STATSLANGENLIB = self.STATSLANGEN + 'lib/'
sys.path.append( PXPATHS.getPXLIBPath() )
#print PXPATHS.getPXLIBPath()
import PXPaths
self.COLROOT = COLPATHS.getColumbosRootPath()
"""
PDS' columbo related paths
"""
self.PXPATHSPDSCOLGRAPHS = self.COLROOT + '/ColumboShow/graphs/'
self.PDSCOLLOGS = self.COLROOT + '/ColumboShow/log/'
self.PDSCOLETC = self.COLROOT + '/etc/'
"""
MetPX related paths
"""
PXPaths.normalPaths( str(PXPATHS.getPXLIBPath()).replace("lib/", "") )
self.PXROOT = PXPaths.ROOT
self.PXLIB = PXPaths.LIB
self.PXLOG = PXPaths.LOG
self.PXETC = PXPaths.ETC
self.PXETCRX = PXPaths.RX_CONF
self.PXETCTX = PXPaths.TX_CONF
self.PXETCTRX = PXPaths.TRX_CONF
示例14: CollectionManager
#
#############################################################################################
"""
import bulletin
import os,string,sys,time
import PXPaths
import CollectionBuilder
import CollectionEntry
import CollectionState
import StationParser
from CacheManager import CacheManager
PXPaths.normalPaths() # Access to PX paths
# CollectionManager
class CollectionManager(object):
"""
The collectionManager reads RXQ dir, classifies the bulletins:
If they have to be ingested do it, if they have to be collected than collect and ingest.
Unrelated files are removed. Files that are not ready to be collected stay in the RXQ dir.
"""
def __init__(self, ingestor, bullManager, reader ):
# General Attributes
self.bullManager = bullManager
示例15: __init__
def __init__(self, logger ):
self.logger = logger
self.wmo_ids = []
PXPaths.normalPaths()
self.path = PXPaths.ETC + 'wmo_id.conf'