-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new implementation for multicontainer use case #67
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to get the docker compose running by submitting the system.json to the configure endpoint and then running.
I first tried submitting the multicontainer.json, and I was a bit surprised that didn't work. I got this error:
build-oedisi_broker-1 | ERROR: Exception in ASGI application
build-oedisi_broker-1 | Traceback (most recent call last):
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 198, in _new_conn
build-oedisi_broker-1 | sock = connection.create_connection(
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection
build-oedisi_broker-1 | raise err
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 73, in create_connection
build-oedisi_broker-1 | sock.connect(sa)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/gevent/_socketcommon.py", line 590, in connect
build-oedisi_broker-1 | self._internal_connect(address)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/gevent/_socketcommon.py", line 634, in _internal_connect
build-oedisi_broker-1 | raise _SocketError(err, strerror(err))
build-oedisi_broker-1 | ConnectionRefusedError: [Errno 111] Connection refused
build-oedisi_broker-1 |
build-oedisi_broker-1 | The above exception was the direct cause of the following exception:
build-oedisi_broker-1 |
build-oedisi_broker-1 | Traceback (most recent call last):
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 793, in urlopen
build-oedisi_broker-1 | response = self._make_request(
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 496, in _make_request
build-oedisi_broker-1 | conn.request(
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 400, in request
build-oedisi_broker-1 | self.endheaders()
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/http/client.py", line 1277, in endheaders
build-oedisi_broker-1 | self._send_output(message_body, encode_chunked=encode_chunked)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/http/client.py", line 1037, in _send_output
build-oedisi_broker-1 | self.send(msg)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/http/client.py", line 975, in send
build-oedisi_broker-1 | self.connect()
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 238, in connect
build-oedisi_broker-1 | self.sock = self._new_conn()
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 213, in _new_conn
build-oedisi_broker-1 | raise NewConnectionError(
build-oedisi_broker-1 | urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fbaca42d600>: Failed to establish a new connection: [Errno 111] Connection refused
build-oedisi_broker-1 |
build-oedisi_broker-1 | The above exception was the direct cause of the following exception:
build-oedisi_broker-1 |
build-oedisi_broker-1 | Traceback (most recent call last):
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
build-oedisi_broker-1 | resp = conn.urlopen(
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 847, in urlopen
build-oedisi_broker-1 | retries = retries.increment(
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 515, in increment
build-oedisi_broker-1 | raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
build-oedisi_broker-1 | urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='10.5.0.3', port=5678): Max retries exceeded with url: /configure/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbaca42d600>: Failed to establish a new connection: [Errno 111] Connection refused'))
build-oedisi_broker-1 |
build-oedisi_broker-1 | During handling of the above exception, another exception occurred:
build-oedisi_broker-1 |
build-oedisi_broker-1 | Traceback (most recent call last):
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 412, in run_asgi
build-oedisi_broker-1 | result = await app( # type: ignore[func-returns-value]
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
build-oedisi_broker-1 | return await self.app(scope, receive, send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
build-oedisi_broker-1 | await super().__call__(scope, receive, send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
build-oedisi_broker-1 | await self.middleware_stack(scope, receive, send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
build-oedisi_broker-1 | raise exc
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
build-oedisi_broker-1 | await self.app(scope, receive, _send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
build-oedisi_broker-1 | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
build-oedisi_broker-1 | raise exc
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
build-oedisi_broker-1 | await app(scope, receive, sender)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 758, in __call__
build-oedisi_broker-1 | await self.middleware_stack(scope, receive, send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 778, in app
build-oedisi_broker-1 | await route.handle(scope, receive, send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 299, in handle
build-oedisi_broker-1 | await self.app(scope, receive, send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 79, in app
build-oedisi_broker-1 | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
build-oedisi_broker-1 | raise exc
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
build-oedisi_broker-1 | await app(scope, receive, sender)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 74, in app
build-oedisi_broker-1 | response = await func(request)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
build-oedisi_broker-1 | raw_response = await run_endpoint_function(
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
build-oedisi_broker-1 | return await dependant.call(**values)
build-oedisi_broker-1 | File "/broker/server.py", line 222, in configure
build-oedisi_broker-1 | r = requests.post(url, json=component_model.dict())
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 115, in post
build-oedisi_broker-1 | return request("post", url, data=data, json=json, **kwargs)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
build-oedisi_broker-1 | return session.request(method=method, url=url, **kwargs)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
build-oedisi_broker-1 | resp = self.send(prep, **send_kwargs)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
build-oedisi_broker-1 | r = adapter.send(request, **kwargs)
build-oedisi_broker-1 | File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 519, in send
build-oedisi_broker-1 | raise ConnectionError(e, request=request)
build-oedisi_broker-1 | requests.exceptions.ConnectionError: HTTPConnectionPool(host='10.5.0.3', port=5678): Max retries exceeded with url: /configure/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbaca42d600>: Failed to establish a new connection: [Errno 111] Connection refused'))
I also tried to just hit run and got a bunch of errors like helics broker duplicate name or broker core has already initialized.
Eventually I remembered you added this other system.json. What's the difference? Was I supposed to use the scenarios/multicontainer.json to build the dockerfiles and then submit a different one.
Finally, I was unable to get the kubernetes one working at all, since there doesn't seem to be a broker.yaml when I build.
I've been running more tests in docker compose at least.
|
I also don't think logging is set to INFO in Python for most of the server.py |
@@ -49,7 +51,7 @@ def read_root(): | |||
return JSONResponse(response, 200) | |||
|
|||
|
|||
@app.get("/sensor/") | |||
@app.get("/sensor") | |||
async def sensor(): | |||
logging.info(os.getcwd()) | |||
sensor_path = os.path.join(base_path, "sensors", "sensors.json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unable to add a comment on the right section, but I noticed a couple problems caused by this function when trying to run with SMART-DS as well as deleting the existing sensors.json file
- We don't even use sensors.json
- This should almost certainly use asyncio.sleep(1) so that it doesn't block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will have to resolve this issue once we have sensors published on the helics interface
if not sensor_data: | ||
msg = "empty sensor list" | ||
raise HTTPException(404, msg) | ||
logging.info(sensor_data) | ||
with open("sensors.json", "w") as outfile: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we use smart-ds, we use the create_measurement_lists function to create voltage_ids.json, real_ids.json, and reactive_ids.json, but not a sensors.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will have to resolve this issue once we have sensors published on the helics interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the the problems in the oedisi cor part, the mysterious broker/docker-compose.yml file, and the sensor issue, everything seems to work fine.
Aren't the kubernetes files supposed to have a broker.yml? I just realized that the kubernetes side still has that problem. |
sensor file moved back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also remove the broker-config.yml file from the broker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also noticed these parentheses on hostname which cause failure for the less common endpoints
I got this to work logger = logging.getLogger('uvicorn.error') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to go ahead and approve this. I didn't test this last time as much since I think it's just the () that is different.
No description provided.