Moe
02/10/2025, 7:38 PMMarvin
02/10/2025, 7:38 PMprefect.yaml
file simultaneously, you can use the prefect deploy
command. This command is designed to deploy all the flows defined in the prefect.yaml
file, which allows for customization in terms of push and pull steps.
Here's a basic example of how you might structure your prefect.yaml
file to define multiple deployments:
yaml
flows:
- name: flow_one
entrypoint: path/to/flow_one.py:flow_function_name
- name: flow_two
entrypoint: path/to/flow_two.py:flow_function_name
Once your prefect.yaml
is configured, you can run:
bash
prefect deploy
This command will deploy all the flows defined in the file. You can refer to the Prefect deployment documentation for more details.Moe
02/10/2025, 7:39 PMMarvin
02/10/2025, 7:39 PMprefect.yaml
file using a single command, you can use the prefect deploy
command without specifying individual flow names. This command automatically reads the prefect.yaml
file and deploys all the flows defined within it.
Simply navigate to the directory containing your prefect.yaml
file and execute:
bash
prefect deploy
This will trigger the deployment process for all flows specified in the YAML file. If you need more information, you can check the Prefect deployment documentation.Moe
02/10/2025, 7:40 PMMarvin
02/10/2025, 7:40 PMprefect.yaml
file without being prompted to select each one individually, you can use the --all
flag with the prefect deploy
command. This flag tells Prefect to deploy all deployments defined in the YAML file in one go.
Here's the command you should run:
bash
prefect deploy --all
This will automatically deploy every flow listed in your prefect.yaml
file. For more details, you can refer to the Prefect deployment documentation.Nate
02/10/2025, 7:43 PMprefect --no-prompt deploy --all
Nate
02/10/2025, 7:43 PMMoe
02/10/2025, 7:57 PMserver = mssql_auth.value["server"]
, I have it in all my flows and have no issues deploying the rest. Any thoughts?
Traceback (most recent call last):
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "C:\Users\maung\Desktop\DevOps\AppScripts\PMS\Dentitek\dentitek_carriers_flow.py", line 7, in <module>
from dentitek_carriermapping_subflow import dentitek_carriermapping_subflow
File "C:\Users\maung\Desktop\DevOps\AppScripts\PMS\Dentitek\dentitek_carriermapping_subflow.py", line 35, in <module>
server = mssql_auth.value["server"]
^^^^^^^^^^^^^^^^
AttributeError: 'coroutine' object has no attribute 'value'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\flows.py", line 1742, in load_flow_from_entrypoint
flow = import_object(entrypoint)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\utilities\importtools.py", line 205, in import_object
module = load_script_as_module(script_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\utilities\importtools.py", line 168, in load_script_as_module
raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'AppScripts\\PMS\\Dentitek\\dentitek_carriers_flow.py' encountered an exception: AttributeError("'coroutine' object has no attribute 'value'")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\cli\_utilities.py", line 42, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\cli\_types.py", line 153, in sync_fn
return asyncio.run(async_fn(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\cli\deploy.py", line 451, in deploy
await _run_single_deploy(
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\client\utilities.py", line 103, in with_injected_client
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\cli\deploy.py", line 501, in _run_single_deploy
flow = load_flow_from_entrypoint(deploy_config["entrypoint"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\flows.py", line 1751, in load_flow_from_entrypoint
flow = safe_load_flow_from_entrypoint(entrypoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\flows.py", line 2005, in safe_load_flow_from_entrypoint
namespace = safe_load_namespace(source_code, filepath=path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\site-packages\prefect\utilities\importtools.py", line 446, in safe_load_namespace
module = importlib.import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
File "C:\Users\maung\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "C:\Users\maung\Desktop\DevOps\AppScripts\PMS\Dentitek\dentitek_carriermapping_subflow.py", line 35, in <module>
server = mssql_auth.value["server"]
^^^^^^^^^^^^^^^^
AttributeError: 'coroutine' object has no attribute 'value'
An exception occurred.
sys:1: RuntimeWarning: coroutine 'sync_compatible.<locals>.coroutine_wrapper.<locals>.ctx_call' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Nate
02/10/2025, 8:00 PMserver = mssql_auth.value["server"]
^^^^^^^^^^^^^^^^
AttributeError: 'coroutine' object has no attribute 'value'
Nate
02/10/2025, 8:01 PMmssql_auth
to be a JSON block, or secret or something, but its a coroutine
that you need to await
before accessing the value
attributeNate
02/10/2025, 8:01 PMMoe
02/10/2025, 8:02 PM# Configure SQL Server
sql_driver = config['APP']['PREFECTBLOCKS']['SQLSERVER']['DRIVER']
database = config['APP']['PREFECTBLOCKS']['SQLSERVER']['DBNAME']
mssql_block = config['APP']['PREFECTBLOCKS']['SQLSERVER'][env]
mssql_auth = JSON.load(mssql_block)
server = mssql_auth.value["server"]
port = mssql_auth.value["port"]
Nate
02/10/2025, 8:03 PMmssql_auth = JSON.load(mssql_block, _sync=True)
Nate
02/10/2025, 8:03 PMMoe
02/10/2025, 8:07 PMMoe
02/10/2025, 8:08 PMNate
02/10/2025, 8:11 PMAll of them are asynchmm its surprising that you're not encountering this in all of your flows then. are you calling .load within each of these async flows?
Moe
02/10/2025, 8:12 PMNate
02/10/2025, 8:12 PMMoe
02/10/2025, 8:17 PMNate
02/10/2025, 8:20 PMaload
that you would await like this
mssql_auth = JSON.aload(mssql_block)
but in your case I'd say you should either use
mssql_auth = await JSON.load(mssql_block)
which infers load
should be async based on the context (a pattern we're moving away from, outlined in the linked issue)
or
mssql_auth = JSON.load(mssql_block, _sync=True)
which will force the load
method to behave sync