Austin Anderson
06/30/2022, 12:14 AMfrom prefect import flow, task
from prefect_dask.task_runners import DaskTaskRunner
@task
def say_hello(name):
print(f"hello {name}")
@flow(task_runner=DaskTaskRunner(address='tcp://[redacted]:8786'))
def greetings():
say_hello('test')
if __name__ == "__main__":
greetings()
Any ideas?Zanie
06/30/2022, 1:34 AMPREFECT_API_URL
set to? (prefect config view
) Is it contactable from the Dask cluster?Austin Anderson
06/30/2022, 4:06 PMZanie
07/01/2022, 6:12 PMPREFECT_API_URL
isn’t set on your worker at all.PREFECT_API_URL
set on the flow run?Austin Anderson
07/01/2022, 7:47 PMPREFECT_API_URL
for a flow run?
Here's what I've tried:
• Go to submitter machine (the machine where I run the originally posted code)
• Launch the Anaconda Prompt and activate an environment ("dask-demo") that has Dask and Prefect installed
• Run prefect orion start
in the Anaconda Prompt for the submitter machine
• Note the PREFECT_API_URL
that is printed after the Prefect logo in the console
• Go to the machine that will be the dask-scheduler
• Launch the Anaconda Prompt and activate "dask-demo"
• Run prefect config set PREFECT_API_URL=[the url]
where [the url] is the previously noted PREFECT_API_URL
• Run dask-scheduler
, note the TCP address
• Go to the machine that will be the dask-worker
• Launch the Anaconda Prompt and activate "dask-demo"
• Run prefect config set PREFECT_API_URL=[the url]
• Run dask-worker [the tcp address]
• Go to the submitter machine and launch another instance of the Anaconda Prompt and activate "dask-demo"
• Run python [full path to my test script]
to run the originally posted code
After following those steps I see "Crash detected!" and flow run "Finished in state Failed" in the prompt on the submitter machine. I also see prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url '<http://ephemeral-orion/api/task_runs/.../set_state>
Zanie
07/01/2022, 8:15 PMPREFECT_API_URL
on the submitter machine. We’ll automatically set it within each task run when they are run on the Dask worker. If this URL needs to be different for the flow run and task run then I think you’ll run into problems as I don’t think we support splitting this yet.prefect orion start
. You still see your runs show up because the ephemeral API is talking to the same database.Austin Anderson
07/01/2022, 8:38 PMPREFECT_API_URL
. One assumption I made was that the submitter machine would already know that URL path since that's the machine where the prefect orion start
was running. However, I now understand that since Prefect Orion and the python script were each running in separate conda prompt instances, that API URL was only known to the Prefect Orion conda prompt instance. I went ahead and removed the API URL info from all of the dask machines and confirmed that indeed all I need to do is run prefect config set PREFECT_API_URL=[the url]
and then run the python script from that same conda prompt instance. Thank you again so much for the help!Zanie
07/01/2022, 10:16 PM