43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
from dagster import (
|
|
Definitions,
|
|
load_assets_from_modules,
|
|
EnvVar,
|
|
DefaultSensorStatus,
|
|
AutomationConditionSensorDefinition
|
|
)
|
|
from dagster_duckdb import DuckDBResource
|
|
|
|
# Import asset modules
|
|
from assets import config, gtfs_static, gtfs_realtime
|
|
|
|
# Import sensor modules
|
|
from sensors import gtfs_static as gtfs_static_sensors
|
|
from sensors import gtfs_realtime as gtfs_rt_sensors
|
|
|
|
from resources import MobilityDatabaseAPI
|
|
|
|
# Load all assets from the modules
|
|
all_assets = load_assets_from_modules([config, gtfs_static, gtfs_realtime])
|
|
|
|
defs = Definitions(
|
|
assets=all_assets,
|
|
sensors=[
|
|
AutomationConditionSensorDefinition(
|
|
"asset_automation_sensor",
|
|
target="*",
|
|
default_status=DefaultSensorStatus.RUNNING,
|
|
),
|
|
gtfs_static_sensors.gtfs_static_hourly_sensor,
|
|
gtfs_static_sensors.gtfs_static_partition_update_sensor,
|
|
gtfs_rt_sensors.gtfs_rt_vehicles_sensor,
|
|
],
|
|
resources={
|
|
"duckdb": DuckDBResource(
|
|
database="data/duckdb/gtfs.duckdb"
|
|
),
|
|
"mobility_db": MobilityDatabaseAPI(
|
|
refresh_token=EnvVar("MOBILITY_DB_REFRESH_TOKEN"),
|
|
rate_limit_delay=0.5
|
|
)
|
|
}
|
|
)
|