William Jamir
03/12/2024, 4:46 PMFile "/usr/local/lib/python3.11/site-packages/prefect/runner/submit.py", line 162, in submit_to_runner
raise RuntimeError(
RuntimeError: Failed to connect to the `Runner` webserver. Ensure that the server is running and reachable. You can run the webserver either by starting your `serve` process with `webserver=True`, or by setting `PREFECT_RUNNER_SERVER_ENABLE=True`.
William Jamir
03/12/2024, 4:51 PMworker:
image:
pullPolicy: Always
debug: true
apiConfig: server
config:
workPool: k8s-local
serverApiConfig:
apiUrl: https://<my_self_hosted_prefect_server>/api
extraEnvVars:
- name: PREFECT_RUNNER_SERVER_ENABLE
value: "true"
- name: PREFECT_EXPERIMENTAL_ENABLE_EXTRA_RUNNER_ENDPOINTS
value: "true"
This is my flow code:
@flow
def subflow(value):
logger = get_run_logger()
logger.info(f"Subflow: {value}.")
logger.info(f"Network: {platform.node()}.")
logger.info(f"Instance: {platform.platform()}.")
@flow
def hello(name: str = "Marvin"):
logger = get_run_logger()
logger.info(os.environ)
logger.info(f"Network: {platform.node()}.")
logger.info(f"Instance: {platform.platform()}.")
subflow("First")
submit_to_runner(subflow, [{"value": f"submitted_subflow {i}"} for i in range(10)])
if __name__ == "__main__":
with tags("local"):
hello.serve("simulate-work", webserver=True, limit=10)
Flow results
Finished in state Failed(message='Flow run encountered an exception. RuntimeError: Failed to connect to the `Runner` webserver. Ensure that the server is running and reachable. You can run the webserver either by starting your `serve` process with `webserver=True`, or by setting `PREFECT_RUNNER_SERVER_ENABLE=True`.', type=FAILED, result=UnpersistedResult(type='unpersisted', artifact_type='result', artifact_description='Unpersisted result of type `RuntimeError`'))
Nate
03/12/2024, 7:47 PMhost
and port
of your runner webserver, are those defaults going to work for your k8s setup?
here's a working example (docker compose) if its a useful referenceWilliam Jamir
03/13/2024, 9:02 AMapiUrl
? or the PREFECT_RUNNER_SERVER_HOST
?
Btw I just added
- name: PREFECT_RUNNER_SERVER_HOST
value: "127.0.0.1"
But didn't worked as well =/