<commit_before>===========
django-cron
===========

Django-cron lets you run Django/Python code on a recurring basis proving basic plumbing to track and execute tasks. The 2 most common ways in which most people go about this is either writing custom python scripts or a management command per cron (leads to too many management commands!). Along with that some mechanism to track success, failure etc. is also usually necesary.

This app solves both issues to a reasonable extent. This is by no means a replacement for queues like Celery ( http://celeryproject.org/ ) etc.

New feature
-----------

You can run cron by passing RUN_EVERY_MINS or RUN_AT_TIMES params.

This will run job every hour::
	
	class MyCronJob(CronJobBase):
	    RUN_EVERY_MINS = 60 # every hours
		
	    schedule = Schedule(run_every_mins=RUN_EVERY_MINS)

This will run job at given hours::

	class MyCronJob(CronJobBase):
		RUN_AT_TIMES = ['11:30', '14:00', '23:15']

	    schedule = Schedule(run_at_times=RUN_AT_TIMES)

Hour format is HH:MM (24h clock)

You can also mix up both of these methods::
	
	class MyCronJob(CronJobBase):
		RUN_EVERY_MINS = 120 # every 2 hours
		RUN_AT_TIMES = ['6:30']

	    schedule = Schedule(run_every_mins=RUN_EVERY_MINS, run_at_times=RUN_AT_TIMES)

This will run job every 2h plus one run at 6:30.


Installation
------------

- Install django_cron (ideally in your virtualenv!) using pip or simply getting a copy of the code and putting it in a directory in your codebase.

- Add ``django_cron`` to your Django settings ``INSTALLED_APPS``::
	
	INSTALLED_APPS = [
        # ...
        "django_cron",
    ]

- If you're using South for schema migrations run ``python manage.py migrate django_cron`` or simply do a ``syncdb``.

- Write a cron class somewhere in your code, that extends the `CronJobBase` class. This class will look something like this::

	from django_cron import CronJobBase, Schedule
	class MyCronJob(CronJobBase):
	    RUN_EVERY_MINS = 120 # every 2 hours
		
	    schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
	    code = 'my_app.my_cron_job'	# a unique code<commit_msg>Updated README fix<commit_after>===========
django-cron
===========

Django-cron lets you run Django/Python code on a recurring basis proving basic plumbing to track and execute tasks. The 2 most common ways in which most people go about this is either writing custom python scripts or a management command per cron (leads to too many management commands!). Along with that some mechanism to track success, failure etc. is also usually necesary.

This app solves both issues to a reasonable extent. This is by no means a replacement for queues like Celery ( http://celeryproject.org/ ) etc.

New feature
-----------

You can run cron by passing RUN_EVERY_MINS or RUN_AT_TIMES params.

This will run job every hour::
	
	class MyCronJob(CronJobBase):
	    RUN_EVERY_MINS = 60 # every hours
		
	    schedule = Schedule(run_every_mins=RUN_EVERY_MINS)

This will run job at given hours::

	class MyCronJob(CronJobBase):
		RUN_AT_TIMES = ['11:30', '14:00', '23:15']
		
	    schedule = Schedule(run_at_times=RUN_AT_TIMES)

Hour format is HH:MM (24h clock)

You can also mix up both of these methods::
	
	class MyCronJob(CronJobBase):
		RUN_EVERY_MINS = 120 # every 2 hours
		RUN_AT_TIMES = ['6:30']
		
	    schedule = Schedule(run_every_mins=RUN_EVERY_MINS, run_at_times=RUN_AT_TIMES)

This will run job every 2h plus one run at 6:30.


Installation
------------

- Install django_cron (ideally in your virtualenv!) using pip or simply getting a copy of the code and putting it in a directory in your codebase.

- Add ``django_cron`` to your Django settings ``INSTALLED_APPS``::
	
	INSTALLED_APPS = [
        # ...
        "django_cron",
    ]

- If you're using South for schema migrations run ``python manage.py migrate django_cron`` or simply do a ``syncdb``.

- Write a cron class somewhere in your code, that extends the `CronJobBase` class. This class will look something like this::

	from django_cron import CronJobBase, Schedule
	class MyCronJob(CronJobBase):
	    RUN_EVERY_MINS = 120 # every 2 hours
		
	    schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
	    code = 'my_app.my_cron_job'	# a unique code
{'fraction_non_alphanumeric': 0.08877284595300261, 'fraction_numerical': 0.015191075243294565, 'mean_word_length': 3.8492520138089756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6733518', 'n_tokens_mistral': 1428, 'n_tokens_neox': 1283, 'n_words': 513}