Cloud functions to handle Schedule triggers.
Classes
ScheduledEventclass firebase_functions.scheduler_fn.ScheduledEvent(job_name: str | None, schedule_time: datetime) |
---|
Bases: object
A ScheduleEvent that is passed to the function handler.
-
job_name: str | None
The Cloud Scheduler job name.
Populated via the X-CloudScheduler-JobName header.
If invoked manually, this field is None.
-
schedule_time: datetime
For Cloud Scheduler jobs specified in the unix-cron format,
this is the job schedule time in RFC3339 UTC "Zulu" format.
Populated via the X-CloudScheduler-ScheduleTime header.
If the schedule is manually triggered, this field is
the function execution time.
|
Functions
on_schedulefirebase_functions.scheduler_fn.on_schedule(**kwargs) → Callable[[Callable[[ScheduledEvent], None]], Response] |
---|
Creates a handler for tasks sent to a Google Cloud Tasks queue.
Requires a function that takes a CallableRequest .
Example:
from firebase_functions import scheduler_fn
@scheduler_fn.on_schedule(
schedule="* * * * *",
timezone=scheduler_fn.Timezone("America/Los_Angeles"),
)
def example(event: scheduler_fn.ScheduledEvent) -> None:
print(event.job_name)
print(event.schedule_time)
- Parameters:
**kwargs (as firebase_functions.options.ScheduleOptions ) -- ScheduleOptions options.
- Return type:
typing.Callable
[ [ firebase_functions.schedule_fn.ScheduledEvent ], None ]
A function that takes a ScheduledEvent and returns nothing.
|