Shuchita Tripathi
03/31/2022, 1:58 PMrequests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=4200): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002A9EA91E100>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
My prefect server is not at localhost.
if I am doing client.register(flow, project_name), the error says ->
raise ValueError("This flow has no storage to build")
ValueError: This flow has no storage to build
What is the best way to run POST calls which can create a new flow?Kevin Kho
03/31/2022, 2:00 PMPREFECT__SERVER__ENDPOINT=<your-endpoint>
or in the config.toml[server]
endpoint=...
Shuchita Tripathi
03/31/2022, 2:00 PMKevin Kho
03/31/2022, 2:03 PMflow.register()
is doing so it’s not recommended to do it yourself.flow.register()
or the CLI is recommendedShuchita Tripathi
03/31/2022, 2:04 PMKevin Kho
03/31/2022, 2:04 PMflow.register()
will use that endpoint you configuredShuchita Tripathi
03/31/2022, 2:05 PMKevin Kho
03/31/2022, 2:06 PMconfig.toml
on the same machine you are calling the register from?Shuchita Tripathi
03/31/2022, 2:07 PMKevin Kho
03/31/2022, 2:07 PMserver
Shuchita Tripathi
03/31/2022, 2:08 PMKevin Kho
03/31/2022, 2:09 PMprefect backend server
Shuchita Tripathi
03/31/2022, 2:15 PMKevin Kho
03/31/2022, 2:18 PMprefect agent local start
?Shuchita Tripathi
03/31/2022, 2:19 PMKevin Kho
03/31/2022, 2:23 PMShuchita Tripathi
03/31/2022, 2:28 PMINFO: 127.0.0.1:53927 - "POST /workflow/vmproject/tf1 HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 373, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 75, in __call__
return await <http://self.app|self.app>(scope, receive, send)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\fastapi\applications.py", line 208, in __call__
await super().__call__(scope, receive, send)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\starlette\applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\starlette\middleware\errors.py", line 181, in __call__
raise exc from None
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\starlette\middleware\errors.py", line 159, in __call__
await <http://self.app|self.app>(scope, receive, _send)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\starlette\exceptions.py", line 82, in __call__
raise exc from None
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\starlette\exceptions.py", line 71, in __call__
await <http://self.app|self.app>(scope, receive, sender)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\starlette\routing.py", line 580, in __call__
await route.handle(scope, receive, send)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\starlette\routing.py", line 241, in handle
await <http://self.app|self.app>(scope, receive, send)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\starlette\routing.py", line 52, in app
response = await func(request)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\fastapi\routing.py", line 159, in run_endpoint_function
return await dependant.call(**values)
File "C:\Users\dummyvalue\dummyvalue1\Documents\composr\orchestratr-api\.\app\workflow\wf_router.py", line 30, in prefect_run_flow
test = temp_prefect_run(project_name, flow_name)
File "C:\Users\dummyvalue\dummyvalue1\Documents\composr\orchestratr-api\.\app\tempdelete\prefectterraform.py", line 21, in temp_prefect_run
f.register(project_name=project_name)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\prefect\core\flow.py", line 1708, in register
registered_flow = client.register(
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\prefect\client\client.py", line 839, in register
project = self.graphql(query_project).data.project # type: ignore
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\prefect\client\client.py", line 452, in graphql
result = <http://self.post|self.post>(
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\prefect\client\client.py", line 407, in post
response = self._request(
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\prefect\client\client.py", line 641, in _request
response = self._send_request(
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\prefect\client\client.py", line 506, in _send_request
response = <http://session.post|session.post>(
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\requests\sessions.py", line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\dummyvalue\AppData\Local\pypoetry\Cache\virtualenvs\automation-servicr-YfkC5kYT-py3.9\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=4200): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001DDFB8917F0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
Kevin Kho
03/31/2022, 2:30 PMShuchita Tripathi
03/31/2022, 2:42 PMKevin Kho
03/31/2022, 2:46 PMShuchita Tripathi
03/31/2022, 2:57 PMKevin Kho
03/31/2022, 3:04 PMPREFECT__SERVER__ENDPOINT="YOUR_MACHINES_PUBLIC_IP:4200/graphql"
what do you mean by it works? You can register a Flow? I don’t think the return does anything in the Flow block?Shuchita Tripathi
03/31/2022, 3:06 PMKevin Kho
03/31/2022, 3:07 PM@task
def abc():
return "hello"
with Flow(flow_name) as flow:
abc()
flow.register(project_name)
and see if it worksShuchita Tripathi
03/31/2022, 3:10 PMKevin Kho
03/31/2022, 3:11 PMShuchita Tripathi
03/31/2022, 3:13 PMpython <filename.py>
Kevin Kho
03/31/2022, 3:15 PMAnna Geller
03/31/2022, 3:15 PMShuchita Tripathi
03/31/2022, 3:17 PMKevin Kho
03/31/2022, 3:19 PMflow.register()
and prefect register …
CLI, because these commands do a lot of formatting and handle a lot of logic for youAnna Geller
03/31/2022, 3:19 PMprefect run --name yourflowname --project yourproject --watch
if this command works, we could move to triggering the same flow via an API callShuchita Tripathi
03/31/2022, 3:19 PMKevin Kho
03/31/2022, 3:22 PMShuchita Tripathi
03/31/2022, 3:23 PMKevin Kho
03/31/2022, 3:25 PMShuchita Tripathi
03/31/2022, 3:26 PMKevin Kho
03/31/2022, 3:29 PMflow.register()
and prefect register
commandsShuchita Tripathi
03/31/2022, 3:31 PMprefect run --name "terraform flow" --project vmproject --watch
Kevin Kho
03/31/2022, 5:42 PMShuchita Tripathi
03/31/2022, 5:45 PMKevin Kho
03/31/2022, 5:48 PMcreate_flow_run
postShuchita Tripathi
03/31/2022, 5:49 PMKevin Kho
03/31/2022, 5:53 PMShuchita Tripathi
03/31/2022, 5:55 PMKevin Kho
03/31/2022, 5:58 PMShuchita Tripathi
03/31/2022, 5:59 PM