Matt Alhonte
10/11/2021, 9:11 PMKevin Kho
Matt Alhonte
10/11/2021, 9:15 PMKevin Kho
Matt Alhonte
10/11/2021, 10:09 PMrun_notebook
- I'd like for the code running in there to executed by Dask directly.Kevin Kho
client.submit()
on the notebook side right?Matt Alhonte
10/11/2021, 11:36 PMget_client()
and worker_client()
but neither worked.Kevin Kho
Matt Alhonte
10/12/2021, 8:57 PMValueError: No global client found and no address provided
ValueError: No workers found
Kevin Kho
Matt Alhonte
10/12/2021, 9:18 PMKevin Kho
with Flow(..., state_handlers=[...]):
...
and then create a new state handler with signature (Flow, old_state, new_state)
Matt Alhonte
10/12/2021, 9:22 PMdef print_flow_object(flow, old_state, new_state):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(f"Kwargs are {flow.environment.executor_kwargs['address']}")
def pass_cluster_address(flow, old_state, new_state):
prefect.context.parameters = {
"address": flow.environment.executor_kwargs["address"]
}
Kevin Kho
Matt Alhonte
10/13/2021, 4:54 PMclient
object connected, but the Papermill task itself blocked execution of the tasks I submitted from within it. There's probably a way to do it, buuut in the meantime, I found defining a little Prefect flow within the Notebook and telling it to execute on the Cluster wound up working!
So like having a cell in the notebook with:
executor = DaskExecutor(address, client_kwargs={"security":sec})
Kevin Kho