def __init__(self, conf, session): CronJob.__init__(self) self.interval = self.parse(conf.string('detach', 'interval', 'seconds=5')) self.span = self.parse(conf.string('detach', 'span', 'hours=1')) self.timeout = conf.float('orbit', 'timeout', 120) self._sess = session self.conf = conf
def __init__(self, conf, session): CronJob.__init__(self) self.interval = self.parse( conf.string('detach', 'interval', 'seconds=5')) self.span = self.parse(conf.string('detach', 'span', 'hours=1')) self.timeout = conf.float('orbit', 'timeout', 120) self._sess = session self.conf = conf
def test_parser_fail(self): job = CronJob() self.assertRaises(CronError, job.parse, "hours 1") self.assertRaises(CronError, job.parse, "") self.assertRaises(CronError, job.parse, "hour=1")
def test_parser(self): job = CronJob() self.assertEquals(job.parse("hours=1"), timedelta(0, 3600)) self.assertEquals(job.parse("hours = 1"), timedelta(0, 3600)) self.assertEquals(job.parse("hours= 1"), timedelta(0, 3600)) self.assertEquals(job.parse("hours=1, days=1"), timedelta(1, 3600))
def __init__(self, conf): CronJob.__init__(self) self.span = conf.string('suspects', 'span', 'hours=1') self.interval = conf.string('suspects', 'interval', 'seconds=5') self.timeout = conf.float('orbit', 'timeout', 120)