Running linod

In a development environment you might want to run linod when you are developing or testing one of your applications.

Usage for developers

Before running linod for the first time, you need to install the Python package schedule written by Daniel Bader:

$ . env/bin/activate
$ pip install schedule

Now you simply go to your project directory and invoke the admin command:

$ cd ~/projects/mysite
$ python manage.py linod

This process will run as long as you don't kill it, e.g. until you hit Ctrl-C.

What it does

The linod command is responsible for running the scheduled background jobs defined by your application. This includes for example:

You can see a list of these jobs by running:

$ cd ~/projects/mysite
$ python manage.py linod --list

Applications can register a job using the dd.api.schedule_often() or dd.api.schedule_daily() decorators. For example (taken from lino.modlib.checkdata):

@dd.schedule_daily()
def checkdata():
    """Run all data checkers."""
    check_data(fix=False)

Applications can also use the schedule API directly for registering the jobs. For example:

if settings.SITE.use_linod:
    def func():
        ...
    schedule.every(2).months.do(func)

The code for both examples above should be in one of your application's models.py modules.