bmSearch  0.0.4
Public Member Functions | Public Attributes | List of all members
bmDate.bmDate Class Reference

Public Member Functions

def __init__ (self)
 
def getCyrusUpdatePoolDates (self)
 
def getDates (self)
 

Public Attributes

 dates
 

Constructor & Destructor Documentation

def bmDate.bmDate.__init__ (   self)
__init__ : 
        generate a dict containing dates formated as described under : 
        
dates[yesterdayPostfixLiteral] = %Y-%m-%d, where yesterdayPostfixLiteral = "%b %_d", ie dates['Jul 07'] = "2017-07-07'
dates[todayPostfixLiteral] = %Y-%m-%d, where todayPostfixLiteral = "%b %_d", ie dates['Jul 07'] = "2017-07-07'
dates['yesterdayNumELK'] = %Y.%m.%d, ie dates['yesterdayNumELK'] = '2017.07.07'
dates['todayNumELK'] = %Y.%m.%d, ie dates['yesterdayNumELK'] = '2017.07.07'
19  def __init__(self):
20  """
21  __init__ :
22  generate a dict containing dates formated as described under :
23 
24  dates[yesterdayPostfixLiteral] = %Y-%m-%d, where yesterdayPostfixLiteral = "%b %_d", ie dates['Jul 07'] = "2017-07-07'
25  dates[todayPostfixLiteral] = %Y-%m-%d, where todayPostfixLiteral = "%b %_d", ie dates['Jul 07'] = "2017-07-07'
26  dates['yesterdayNumELK'] = %Y.%m.%d, ie dates['yesterdayNumELK'] = '2017.07.07'
27  dates['todayNumELK'] = %Y.%m.%d, ie dates['yesterdayNumELK'] = '2017.07.07'
28  """
29 
30  self.dates={}
31 
32  today = date.today()
33  todayNum = today.strftime("%Y-%m-%d")
34  todayNumELK = today.strftime("%Y.%m.%d")
35  todayPostfixLiteral = today.strftime("%b %_d")
36 
37  yesterday = today - timedelta(days=1)
38  yesterdayNum = yesterday.strftime("%Y-%m-%d")
39  yesterdayNumELK = yesterday.strftime("%Y.%m.%d")
40  yesterdayPostfixLiteral = yesterday.strftime("%b %_d")
41 
42 
43  self.dates[yesterdayPostfixLiteral] = yesterdayNum
44  self.dates[todayPostfixLiteral] = todayNum
45  self.dates['yesterdayNumELK'] = yesterdayNumELK
46  self.dates['todayNumELK'] = todayNumELK
47 
48 
49 

Member Function Documentation

def bmDate.bmDate.getCyrusUpdatePoolDates (   self)
getCyrusUpdatePoolDates:
    return a list of pre-formated date as "%b %_d %H:%M"
    The number of dates are hard-coded as n=5 for 5 minutes
59  def getCyrusUpdatePoolDates(self):
60  """
61  getCyrusUpdatePoolDates:
62  return a list of pre-formated date as "%b %_d %H:%M"
63  The number of dates are hard-coded as n=5 for 5 minutes
64 
65  """
66  now = datetime.today()
67  """
68  n : number of minutes. Must be the same as set in "/etc/cron.d/bmSearch" (cf updateCyrusInfo.py)
69  """
70  n=5
71  dateList = []
72  while n > 0 :
73  before = now - timedelta(minutes=n)
74  dateList.append(before.strftime("%b %_d %H:%M"))
75  n -=1
76 
77 
78  return dateList
79 
80 
81 
82 
83 
84 
85 
def bmDate.bmDate.getDates (   self)
getDates :
        Return dates dict
50  def getDates(self):
51  """
52  getDates :
53  Return dates dict
54  """
55  return self.dates
56 
57 
58 

Member Data Documentation

bmDate.bmDate.dates

The documentation for this class was generated from the following file: