1- # import os
2- # from prefect import flow
3- # from prefect_kubernetes.jobs import KubernetesJob
4- # from taxi_data_flow import NY_Taxi_Data_Flow
5-
6- # # Set environment variable for deployment creation
7- # os.environ["PREFECT_API_URL"] = "http://prefect-server:4200/api"
8-
9- # # Create deployment
10- # deployment = NY_Taxi_Data_Flow.to_deployment(
11- # name="taxi-data-flow",
12- # work_pool_name="k8s-pool",
13- # work_queue_name="default"
14- # )
15-
16- # if __name__ == "__main__":
17- # print("Registering flow deployment with Prefect server...")
18- # deployment.apply() # Just register and exit
19- # print("Flow deployment registered successfully!")
20- import os
211from prefect import serve
22- from prefect_kubernetes . jobs import KubernetesJob
2+ from prefect . deployments import Deployment
233from taxi_data_flow import NY_Taxi_Data_Flow
244
25- # Set environment variable for deployment creation
26- os .environ ["PREFECT_API_URL" ] = "http://prefect-server:4200/api"
27-
28- # Create deployment with job configuration
29- deployment = NY_Taxi_Data_Flow .to_deployment (
5+ # Create deployment
6+ deployment = Deployment .build_from_flow (
7+ flow = NY_Taxi_Data_Flow ,
308 name = "taxi-data-flow" ,
319 work_pool_name = "k8s-pool" ,
3210 work_queue_name = "default"
3311)
3412
3513if __name__ == "__main__" :
36- serve (deployment )
14+ deployment .apply ()
15+ print ("Deployment registered successfully!" )
0 commit comments