src/sisy/models.py
def run_iterations(cls, the_callable, iterations=1, label=None, schedule='* * * * * *', userdata = None, run_immediately=False, delay_until=None):
        """Class method to run a callable with a specified number of iterations"""
        task = task_with_callable(the_callable, label=label, schedule=schedule, userdata=userdata)
        task.iterations = iterations
        if delay_until is not None:
            if isinstance(delay_until, datetime):
                if delay_until > timezone.now():
                    task.start_running = delay_until
                else:
                    raise ValueError("Task cannot start running in the past")
            else:
                raise ValueError("delay_until must be a datetime.datetime instance")
        if run_immediately:
            task.next_run = timezone.now()
        else:
            task.calc_next_run()
        task.save()
def run_iterations(cls, the_callable, iterations=1, label=None, schedule='* * * * * *', userdata = None, run_immediately=False, delay_until=None):
        """Class method to run a callable with a specified number of iterations"""
        task = task_with_callable(the_callable, label=label, schedule=schedule, userdata=userdata)
        task.iterations = iterations
        if delay_until is not None:
            if isinstance(delay_until, datetime):
                if delay_until > timezone.now():
                    task.start_running = delay_until
                else:
                    raise ValueError("Task cannot start running in the past")
            else:
                raise ValueError("delay_until must be a datetime.datetime instance")
        if run_immediately:
            task.next_run = timezone.now()
        else:
            task.calc_next_run()
        task.save()
def run_iterations ( cls , the_callable , iterations = 1 , label = None , schedule = '* * * * * *' , userdata = None , run_immediately = False , delay_until = None ) : task = task_with_callable ( the_callable , label = label , schedule = schedule , userdata = userdata ) task . iterations = iterations if delay_until is not None : if isinstance ( delay_until , datetime ) : if delay_until > timezone . now ( ) : task . start_running = delay_until else : raise ValueError ( "Task cannot start running in the past" ) else : raise ValueError ( "delay_until must be a datetime.datetime instance" ) if run_immediately : task . next_run = timezone . now ( ) else : task . calc_next_run ( ) task . save ( )
Class method to run a callable with a specified number of iterations
Class method to run a callable with a specified number of iterations