This tutorial will guide you through the basics of using the SchedulingInterface in our application. The SchedulingInterface allows you to schedule tasks to be executed at specific times or intervals. It is a powerful tool for automating repetitive tasks and managing time-based operations.

Prerequisites

Before diving into the tutorial, make sure you have the following prerequisites:

  • Basic knowledge of programming
  • Familiarity with our application's architecture
  • Access to the SchedulingInterface documentation

Getting Started

To use the SchedulingInterface, you first need to import it into your project:

from schedulinginterface import SchedulingInterface

Next, create an instance of the SchedulingInterface:

scheduler = SchedulingInterface()

Scheduling Tasks

To schedule a task, you need to define the function that will be executed and the time at which it should run. Here's an example:

def my_task():
    print("Task executed at:", datetime.now())

scheduler.schedule_at("2023-10-01 10:00", my_task)

In this example, the my_task function will be executed at 10:00 AM on October 1st, 2023.

Recurring Tasks

If you want to schedule a task to run at regular intervals, you can use the schedule_recurring method:

scheduler.schedule_recurring("0 0 * * *", my_task)  # Runs every hour

This will execute the my_task function every hour.

Cancellation

If you need to cancel a scheduled task, you can use the cancel method:

scheduler.cancel(my_task)

This will cancel the my_task function from being executed.

More Information

For more detailed information and advanced usage of the SchedulingInterface, please refer to our advanced scheduling documentation.

Scheduling Interface Example