@classmethod<EOL><INDENT>def run_iterations(cls, the_callable, iterations=<NUM_LIT:1>, label=None, schedule='<STR_LIT>', userdata = None, run_immediately=False, delay_until=None):<DEDENT>
task = task_with_callable(the_callable, label=label, schedule=schedule, userdata=userdata)<EOL>task.iterations = iterations<EOL>if delay_until is not None:<EOL><INDENT>if isinstance(delay_until, datetime):<EOL><INDENT>if delay_until > timezone.now():<EOL><INDENT>task.start_running = delay_until<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>if run_immediately:<EOL><INDENT>task.next_run = timezone.now()<EOL><DEDENT>else:<EOL><INDENT>task.calc_next_run()<EOL><DEDENT>task.save()<EOL>
Class method to run a callable with a specified number of iterations