Michael Holvey
10/10/2022, 8:46 PMFlow could not be retrieved from deployment.
Traceback (most recent call last):
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\36350admin\AppData\Local\Temp\2\tmp6kmb0zxkprefect\dbt_flow.py", line 35, in <module>
run_dbt()
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\flows.py", line 388, in __call__
return enter_flow_run_engine_from_flow_call(
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\engine.py", line 159, in enter_flow_run_engine_from_flow_call
return anyio.run(begin_run)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\anyio\_core\_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "C:\Python\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Python\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "C:\Users\36350admin\prefect\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 287, in wrapper
return await func(*args)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\client\orion.py", line 82, in with_injected_client
return await fn(*args, **kwargs)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\engine.py", line 232, in create_then_begin_flow_run
state = await begin_flow_run(
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\engine.py", line 365, in begin_flow_run
await result_filesystem._save(is_anonymous=True)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\client\orion.py", line 82, in with_injected_client
return await fn(*args, **kwargs)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\blocks\core.py", line 760, in _save
await self.register_type_and_schema(client=client)
TypeError: object NoneType can't be used in 'await' expression
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\engine.py", line 257, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\client\orion.py", line 82, in with_injected_client
return await fn(*args, **kwargs)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\deployments.py", line 70, in load_flow_from_flow_run
flow = await run_sync_in_worker_thread(import_object, str(import_path))
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\utilities\asyncutils.py", line 57, in run_sync_in_worker_thread
return await anyio.to_thread.run_sync(call, cancellable=True)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\36350admin\prefect\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\36350admin\prefect\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\utilities\importtools.py", line 193, in import_object
module = load_script_as_module(script_path)
File "C:\Users\36350admin\prefect\venv\lib\site-packages\prefect\utilities\importtools.py", line 156, in load_script_as_module
raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'dbt_flow.py' encountered an exception
Mason Menges
10/10/2022, 9:07 PMMichael Holvey
10/10/2022, 9:09 PM###
### A complete description of a Prefect Deployment for flow 'dbt'
###
name: initial_deployment
description: null
version: e2c09f459901dd313abe537ca9d26786
# The work queue that will handle this deployment's runs
work_queue_name: test_queue
tags: []
parameters: {}
schedule: null
infra_overrides: {}
infrastructure:
type: process
env: {}
labels: {}
name: null
command: null
stream_output: true
block_type_slug: process
_block_type_slug: process
###
### DO NOT EDIT BELOW THIS LINE
###
flow_name: dbt
manifest_path: null
storage: null
path: C:\Users\36350admin\prefect
entrypoint: dbt_flow.py:run_dbt
parameter_openapi_schema:
title: Parameters
type: object
properties: {}
required: null
definitions: null
Mason Menges
10/10/2022, 9:25 PMMichael Holvey
10/10/2022, 9:42 PMMason Menges
10/10/2022, 9:46 PMMichael Holvey
10/10/2022, 9:49 PMfrom prefect import flow
from prefect_dbt.cli import DbtCliProfile
from prefect_dbt.cli.configs import GlobalConfigs, TargetConfigs
from prefect_dbt.cli.commands import trigger_dbt_cli_command
import asyncio
@flow
async def run_dbt():
target_configs_extras = dict(
server="SERVER_IP",
user="USER_ACCT",
password="USER_PASS",
port=1433,
database="ANALYTICS",
)
target_configs = TargetConfigs(
type="sqlserver",
schema="dbt",
threads=4,
extras=target_configs_extras
)
dbt_cli_profile = DbtCliProfile(
name="PROFILE_NAME",
target="dev",
target_configs=target_configs,
)
profile = dbt_cli_profile
result = await trigger_dbt_cli_command(command="dbt run",
project_dir="/dbt_project"
)
return result
asyncio.run(run_dbt())
Mason Menges
10/10/2022, 9:56 PMMichael Holvey
10/10/2022, 10:06 PMMason Menges
10/10/2022, 10:10 PMJenny
10/11/2022, 1:38 AM