firebase_functions.scheduler_fn module

Cloud functions to handle Schedule triggers.

Classes

ScheduledEvent

classfirebase_functions.scheduler_fn.ScheduledEvent(job_name:str|None,schedule_time:datetime)

Bases:object

AScheduleEvent that is passed to the function handler.

job_name:str|None

The Cloud Scheduler job name.Populated via theX-CloudScheduler-JobName header.If invoked manually, this field isNone.

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 theX-CloudScheduler-ScheduleTime header.

If the schedule is manually triggered, this field isthe function execution time.

Functions

on_schedule

firebase_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 aCallableRequest.

Example:

fromfirebase_functionsimportscheduler_fn@scheduler_fn.on_schedule(schedule="* * * * *",timezone=scheduler_fn.Timezone("America/Los_Angeles"),)defexample(event:scheduler_fn.ScheduledEvent)->None:print(event.job_name)print(event.schedule_time)
Parameters:

**kwargs (asfirebase_functions.options.ScheduleOptions) --ScheduleOptions options.

Return type:

typing.Callable[ [firebase_functions.schedule_fn.ScheduledEvent ],None ]A function that takes aScheduledEvent and returns nothing.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-11-06 UTC.