-
Notifications
You must be signed in to change notification settings - Fork 0
Schedule Manager
Xellu edited this page May 29, 2026
·
2 revisions
The scheduler lets you run functions at a later time, on a repeating interval, or at a specific timestamp.
from nautica import SchedulerUse Scheduler.RunIn() to run a function after a delay (in seconds):
Scheduler.RunIn(my_function, 5) # run in 5 seconds
Scheduler.RunIn(my_function, 0.5) # run in 500msUse Scheduler.RunAt() to run a function at a specific time:
import time
Scheduler.RunAt(my_function, time.time() + 60) # run in 60 secondsBoth accept additional arguments to pass to the function:
Scheduler.RunIn(send_email, 10, "myclient@example.com", subject="Pay Up")Both sync and async functions are supported.
Use Scheduler.SetInterval() to run a function repeatedly:
Scheduler.SetInterval(my_function, 10) # run every 10 secondsOr use the decorator syntax:
@Scheduler.Interval(10)
async def my_task():
Logger.info("Task ran!")The function runs immediately on startup, then repeats every N seconds.
The scheduler is global and can be used anywhere, but the recommended place
to register intervals is in onStart():
from nautica import Service, Scheduler, Logger
class MyService(Service):
def onStart(self, registry):
Scheduler.SetInterval(self.tick, 30)
def tick(self):
Logger.info("MyService tick")
Service.Export(MyService)- Home
- CLI Reference
- Service Registry
- Built-in Services
- Managers
- Requirement Validators