Mike Levenson
09/03/2023, 2:29 PMephemeral-client
url gets injected... what is going on/ what am I doing wrong?
I set the configs and env vars
17 raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__18prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url '<http://ephemeral-prefect/api/block_documents/782ccd86-fa13-40a6-8e89-278adb4aec24?include_secrets=true'19Response>: {'detail': 'Block document not found'}
Jake Kaplan
09/03/2023, 3:19 PMMike Levenson
09/03/2023, 3:50 PMKol
09/03/2023, 3:51 PM__init__
functionMike Levenson
09/03/2023, 3:53 PMclass MulticastPrefectOperator:
def __init__(self, settings: MulticastInfraSettings = MulticastInfraSettings()):
PREFECT_API_URL = "<https://dev.prefect.get-clarity.io/api>"
os.environ["PREFECT_API_URL"] = PREFECT_API_URL
os.system(f"prefect config set PREFECT_API_URL={PREFECT_API_URL}")
self.settings = settings
self.prefect_client: PrefectClient = PrefectClient(api="<https://dev.prefect.our-domain-foo.io/api>")
Jake Kaplan
09/03/2023, 4:23 PMprefect config set PREFECT_API_URL=...
or set as an env var on the machine so it gets picked up in the settings contextMichael Levenson
09/03/2023, 4:26 PMJake Kaplan
09/03/2023, 4:33 PMPREFECT_API_URL
in the two ways I mentioned above, so it will be set for the entire context at the start of the processfrom prefect import flow
from prefect.client.orchestration import get_client
@flow
async def my_flow():
async with get_client() as client:
await client.read_flow_runs(...)
safely