def __init__(self, request, printout=True): self.today = dateLib.getTodayFormatted() self.yesterday = dateLib.getYesterdayFormatted() #self.today = '20060523' #self.yesterday = '20060522' self.printout = printout self.request = request # Request before being parsed self.requestType = None # 1 for fully qualified header, 2 for type + station(s) # Ex. of a fully qualified header request: FPCN11 CWTO self.ttaaii = None # First word of a fully qualified header self.tt = None # Type extract from ttaaii self.center = None # Second word of a fully qualified header self.header = None # Fully qualified header (ex: "FPCN11 CWTO") self.country = None # Country is obtained from the center (Only used for CA and US) # Ex. of a type + station(s) request: SA YUL YQB YZV self.type = None # Must be in TYPES self.stations = [] # Between 1 and 5 stations self.stationParser = None # Used to map a station to a fully qualified header self.debug = False self._parseRequest() # Will determine the request's type #self.printInfos() self.results = self._search() # Find what we search
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.
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.
""" A cron call this to create etc/stations_TAF.conf """ import os, sys import PXPaths, dateLib from StationFileCreator import StationFileCreator # root1 = '/apps/px/db/20060522/FC/' # root2 = '/apps/px/db/20060522/FT/' # root3 = '/apps/px/db/20060523/FC/' # root4 = '/apps/px/db/20060523/FT/' PXPaths.normalPaths() root1 = PXPaths.DB + "%s/FC/" % dateLib.getYesterdayFormatted() root2 = PXPaths.DB + "%s/FT/" % dateLib.getYesterdayFormatted() root3 = PXPaths.DB + "%s/FC/" % dateLib.getTodayFormatted() root4 = PXPaths.DB + "%s/FT/" % dateLib.getTodayFormatted() try: receivers1 = os.listdir(root1) except OSError: receivers1 = [] try: receivers2 = os.listdir(root2) except OSError: receivers2 = [] try:
""" A cron call this to create /apps/px/etc/stations_SA.conf """ import os, sys import PXPaths, dateLib from StationFileCreator import StationFileCreator excludedSources = ['collecteur'] #root1 = '/apps/px/db/20060522/SA/' #root2 = '/apps/px/db/20060523/SA/' PXPaths.normalPaths() root1 = PXPaths.DB + '%s/SA/' % dateLib.getYesterdayFormatted() root2 = PXPaths.DB + '%s/SA/' % dateLib.getTodayFormatted() try: receivers1 = os.listdir(root1) except OSError: receivers1 = [] for source in excludedSources: if source in receivers1: receivers1.remove(source) try: receivers2 = os.listdir(root2) except OSError: receivers2 = []
if __name__ == '__main__': """ A cron call this to create etc/stations_FD.conf """ import os, sys import PXPaths, dateLib from StationFileCreator import StationFileCreator #root1 = '/apps/px/db/20060522/FD/' #root2 = '/apps/px/db/20060523/FD/' PXPaths.normalPaths() root1 = PXPaths.DB + '%s/FD/' % dateLib.getYesterdayFormatted() root2 = PXPaths.DB + '%s/FD/' % dateLib.getTodayFormatted() try: receivers1 = os.listdir(root1) except OSError: receivers1 = [] try: receivers2 = os.listdir(root2) except OSError: receivers2 = [] #print receivers1 #print receivers2
""" A cron call this to create etc/stations_TAF.conf """ import os, sys import PXPaths, dateLib from StationFileCreator import StationFileCreator #root1 = '/apps/px/db/20060522/FC/' #root2 = '/apps/px/db/20060522/FT/' #root3 = '/apps/px/db/20060523/FC/' #root4 = '/apps/px/db/20060523/FT/' PXPaths.normalPaths() root1 = PXPaths.DB + '%s/FC/' % dateLib.getYesterdayFormatted() root2 = PXPaths.DB + '%s/FT/' % dateLib.getYesterdayFormatted() root3 = PXPaths.DB + '%s/FC/' % dateLib.getTodayFormatted() root4 = PXPaths.DB + '%s/FT/' % dateLib.getTodayFormatted() try: receivers1 = os.listdir(root1) except OSError: receivers1 = [] try: receivers2 = os.listdir(root2) except OSError: receivers2 = [] try: