зеркало из https://github.com/mozilla/bugbot.git
Родитель
e7f6abae00
Коммит
bf8950c878
|
@ -88,7 +88,15 @@ class BzCleaner(object):
|
|||
|
||||
def must_run(self, date):
|
||||
"""Check if the tool must run for this date"""
|
||||
return True
|
||||
days = self.get_config("must_run", None)
|
||||
if not days:
|
||||
return True
|
||||
weekday = date.weekday()
|
||||
week = utils.get_weekdays()
|
||||
for day in days:
|
||||
if week[day] == weekday:
|
||||
return True
|
||||
return False
|
||||
|
||||
def has_enough_data(self):
|
||||
"""Check if the tool has enough data to run"""
|
||||
|
|
|
@ -10,7 +10,6 @@ from auto_nag import logger, utils
|
|||
|
||||
RANGE_PAT = re.compile(r"\[([0-9]+)[ \t]*;[ \t]*([0-9]*|\+∞)\[", re.UNICODE)
|
||||
NPLUS_PAT = re.compile(r"n\+([0-9]+)")
|
||||
DAYS = {"Mon": 0, "Tue": 1, "Wed": 2, "Thu": 3, "Fri": 4, "Sat": 5, "Sun": 6}
|
||||
|
||||
|
||||
class Range(object):
|
||||
|
@ -105,7 +104,9 @@ class Step(object):
|
|||
return self.rang < other.rang
|
||||
|
||||
def __str__(self):
|
||||
alldays = [k for k, _ in sorted(DAYS.items(), key=lambda p: p[1])]
|
||||
alldays = [
|
||||
k for k, _ in sorted(utils.get_weekdays().items(), key=lambda p: p[1])
|
||||
]
|
||||
days = [alldays[x] for x in sorted(self.days)]
|
||||
return "{} => supervisor: {}, days: {}".format(self.rang, self.supervisor, days)
|
||||
|
||||
|
@ -149,12 +150,13 @@ class Escalation(object):
|
|||
if data is None
|
||||
else data.get(priority, {})
|
||||
)
|
||||
week = utils.get_weekdays()
|
||||
for r, sd in data.items():
|
||||
res.append(
|
||||
Step(
|
||||
Range.from_string(r),
|
||||
Supervisor(sd["supervisor"], people),
|
||||
{DAYS[d] for d in sd["days"]},
|
||||
{week[d] for d in sd["days"]},
|
||||
)
|
||||
)
|
||||
return sorted(res)
|
||||
|
|
|
@ -244,6 +244,8 @@
|
|||
"sledru@mozilla.com",
|
||||
"release-mgmt@mozilla.com"
|
||||
]
|
||||
,
|
||||
"must_run": ["Mon"]
|
||||
},
|
||||
"lot_of_votes":
|
||||
{
|
||||
|
@ -253,7 +255,8 @@
|
|||
[
|
||||
"sledru@mozilla.com",
|
||||
"release-mgmt@mozilla.com"
|
||||
]
|
||||
],
|
||||
"must_run": ["Mon"]
|
||||
},
|
||||
"lot_of_cc":
|
||||
{
|
||||
|
@ -263,7 +266,8 @@
|
|||
[
|
||||
"sledru@mozilla.com",
|
||||
"release-mgmt@mozilla.com"
|
||||
]
|
||||
],
|
||||
"must_run": ["Mon"]
|
||||
},
|
||||
"closed_dupeme":
|
||||
{
|
||||
|
|
|
@ -48,6 +48,10 @@ BUG_PAT = re.compile(r"^bug[s]?[ \t]*([0-9]+)", re.I)
|
|||
MAX_URL_LENGTH = 512
|
||||
|
||||
|
||||
def get_weekdays():
|
||||
return {"Mon": 0, "Tue": 1, "Wed": 2, "Thu": 3, "Fri": 4, "Sat": 5, "Sun": 6}
|
||||
|
||||
|
||||
def _get_config():
|
||||
global _CONFIG
|
||||
if _CONFIG is None:
|
||||
|
|
Загрузка…
Ссылка в новой задаче