python -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
prefect server start
prefect backend server
prefect create project repro
prefect agent docker start -l docker -e AZURE_STORAGE_CONNECTION_STRING=$AZURE_STORAGE_CONNECTION_STRING
-
AZURE_STORAGE_CONNECTION_STRING
not available at registration-
AZURE_STORAGE_CONNECTION_STRING
not available at runtime- Nothing serialized to flow storage.
- Error at runtime:
ValueError('Azure connection string not provided. Set either directly with connection_string or via Prefect Secret using connection_string_secret parameter.')
-
AZURE_STORAGE_CONNECTION_STRING
available at runtime- Nothing serialized to flow storage.
- Error at runtime: `ValueError('Azure connection string not provided. Set either directly with connection_string or via Prefect Secret using connection_string_secret
- The serialized
connection_string
value ofNone
is used instead of loading at runtime
-
-
AZURE_STORAGE_CONNECTION_STRING
available at registration (. ./set-bad-conn-str.sh
used to export)-
AZURE_STORAGE_CONNECTION_STRING
not available at runtimeAZURE_STORAGE_CONNECTION_STRING
environment variable that was set at registration is serialized to flow- Serialized
connection_string
is used at runtime
-
AZURE_STORAGE_CONNECTION_STRING
available at runtimeAZURE_STORAGE_CONNECTION_STRING
environment variable that was set at registration is serialized to flow- Serialized
connection_string
is used at runtime
-
prefect register --project repro -p azure_result_flow.py -l docker
For azure_result_flow.py
docker run -it azure-result-flow:<tag from build output> /bin/bash
python
- Paste code snippet to observe Flow's result
import cloudpickle
from prefect.utilities import storage
with open("/opt/prefect/flows/azure-result-flow.prefect", "r") as flow_file:
flow_bytes = flow_file.read().encode("utf-8")
flow = storage.flow_from_bytes_pickle(flow_bytes)
print(flow.result.connection_string)
- Output:
>>> print(flow.result.connection_string)
DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=mystoragekey
For azure_result_task.py
docker run -it azure-result-task:<tag from build output> /bin/bash
python
- Paste code snippet to observe Flow's result
import cloudpickle
from prefect.utilities import storage
with open("/opt/prefect/flows/azure-result-task.prefect", "r") as flow_file:
flow_bytes = flow_file.read().encode("utf-8")
flow = storage.flow_from_bytes_pickle(flow_bytes)
get_word_task = next(t for t in flow.tasks if t.name == "get_word")
print(get_word_task.result.connection_string)
- Output:
>>> get_word_task = next(t for t in flow.tasks if t.name == "get_word")
>>> print(get_word_task.result.connection_string)
DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=mystoragekey
This example I have a bad connection string at registration and good connection string set for agent.
Results, bad connection string is used:
Unexpected error: ClientAuthenticationError("Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.