CharField ( max_length = 200 ) arguments = models. PositiveSmallIntegerField ( default = 0, editable = False ) function = models. PositiveSmallIntegerField ( default = 0, null = True ) times_run = models. CharField ( max_length = 5, choices = TIME_SCALES, null = True, blank = True ) period = models. DateTimeField ( _ ( "stop" ), null = True, blank = True ) time_scale = models. now (), null = True, blank = True ) stop = models. DateTimeField ( _ ( "start" ), default = datetime. BooleanField ( _ ( "active" ), default = True ) start = models. CharField ( _ ( "name" ), max_length = 200, default = "", blank = True ) active = models. expert: Allows direct manipulation of the crontab entry (only the time/date part please!) """ name = models. argument: A single string argument to be given to the function. (zero is for no repetitions) times_run: How many times this has already been executed function: The full path to the python function to be executed (with periods). period: How often the repetitions will take place. time_scale: The type of repetition that will take place. stop: A date and time after which repetitions should not take place. start: A date and time when this task should be run. active: Allows the task to be temporarily switched off. name: A name is good for the user to remember this, but is not necessary. This interface is not intended to be comprehensive, rather, it is intended to be pointed to a python function that is specially prepared to carry out the intended function and only needs to be told when. When the time comes, a simple python function is called with a single text argument. Model ): """ Add a task to be entered into this user's crontab. """ _all_ = ( 'Task', 'update_crontab' ) import os import tempfile from django.db import models from datetime import datetime, timedelta import calendar from import ugettext as _ TIME_SCALES = ( ( "hour", _ ( "hour" )), ( "day", _ ( "day" )), ( "week", _ ( "week" )), ( "month", _ ( "month" )), ( "year", _ ( "year" )), ) class Task ( models. The database is used to update the local crontab. ![]() A more beginner-friendly interface is offered, and entries are stored in a database. # FILE: models.py #!/usr/bin/env python # -*- coding: UTF-8 -*- """ Title: Scheduler models Author: Will Hardy () Date: December 2007 Test suite: manage.py test scheduler $Revision: $ Description: Integrates Python and the native crontab.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |