update deployment id
Browse files- prefect_utils.py +8 -2
prefect_utils.py
CHANGED
|
@@ -12,11 +12,17 @@ def start_prefect_worker(work_pool_name: str = "ot2-pool"):
|
|
| 12 |
worker_thread.start()
|
| 13 |
print("Prefect Worker started in background thread.")
|
| 14 |
|
|
|
|
| 15 |
from prefect.client import get_client
|
| 16 |
|
| 17 |
async def trigger_maintenance_request(maintenance_type: str):
|
| 18 |
async with get_client() as client:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
await client.create_flow_run_from_deployment(
|
| 20 |
-
|
| 21 |
parameters={"maintenance_type": maintenance_type}
|
| 22 |
-
)
|
|
|
|
| 12 |
worker_thread.start()
|
| 13 |
print("Prefect Worker started in background thread.")
|
| 14 |
|
| 15 |
+
|
| 16 |
from prefect.client import get_client
|
| 17 |
|
| 18 |
async def trigger_maintenance_request(maintenance_type: str):
|
| 19 |
async with get_client() as client:
|
| 20 |
+
# find deployment id
|
| 21 |
+
deployment = await client.read_deployment_by_name(
|
| 22 |
+
name="request-wells-maintenance/wells-maintenance"
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
await client.create_flow_run_from_deployment(
|
| 26 |
+
deployment_id=deployment.id,
|
| 27 |
parameters={"maintenance_type": maintenance_type}
|
| 28 |
+
)
|