After creating some asset definitions, you may want to automate their materialization.
In this guide, we'll show you one method of accomplishing this by using schedules. To do this for ops, refer to the Automating ops using schedules guide.
By the end of this guide, you'll be able to:
Create a schedule that directly targets some assets
Add the new schedule to your project's Definitions object
Next, we'll update our project's Definitions object to include the new assets and schedule. This ensures the job and schedule are available to Dagster processes, such as the Dagster UI.
We also could have passed our asset definitions directly as the `target` of the schedule, and they would be automatically included as assets in the `Definitions` object. Since we targeted them here using `AssetSelection.groups`, we needed to include them separately in `assets`.
At this point, your code should look like the following:
Schedules must be turned on before they can be used. In our case, we already turned the schedule on by using the default_status parameter in its ScheduleDefinition, but there are a few other ways to do this:
Heads up! Starting or stopping a schedule in the UI will override any default status set in code.
To turn on a schedule in the Dagster UI, navigate to Overview > Schedules:
To start and stop schedules via the dagster CLI, use the following commands:
dagster schedule start
dagster schedule stop
Heads up! Starting or stopping a schedule in the UI will override any default status set in code.
You can set the schedule's default status using DefaultScheduleStatus.RUNNING in the schedule's ScheduleDefinition:
After the schedule is started, it will begin executing immediately if the dagster-daemon process is running. This process starts automatically when dagster dev is run.