def run(self, every=None, times=None, start_in=0): """ Start running the task. Returns a future object. """ every = get_seconds(every) start_in = get_seconds(start_in) every, times = self.__set_every_times_defaults(every, times) self.future = self.__executor.submit( _run_task, self.__fn, self.__id, every, times, start_in, self.__kwargs, self.__debug, self.__on_success_callback, self.__on_error_callback, self.__on_iter_callback, self.__on_finished_callback) return self.future
def test_float(self): assert get_seconds(1.2) == 1.2
def test_number(self): assert get_seconds(10) == 10
def test_none(self): assert get_seconds(None) is None
def test_days_string(self): assert get_seconds('10 days') == 864000
def test_hours_string(self): assert get_seconds('10 hours') == 36000
def test_minutes_string(self): assert get_seconds('10 minutes') == 600
def test_seconds_string(self): assert get_seconds('10 seconds') == 10