beamlit 0.0.29rc32__py3-none-any.whl → 0.0.30rc33__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/common/__init__.py +4 -1
- beamlit/common/error.py +9 -0
- beamlit/run.py +3 -1
- beamlit/serve/app.py +12 -8
- {beamlit-0.0.29rc32.dist-info → beamlit-0.0.30rc33.dist-info}/METADATA +1 -1
- {beamlit-0.0.29rc32.dist-info → beamlit-0.0.30rc33.dist-info}/RECORD +7 -6
- {beamlit-0.0.29rc32.dist-info → beamlit-0.0.30rc33.dist-info}/WHEEL +0 -0
beamlit/common/__init__.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
from .error import HTTPError
|
1
2
|
from .logger import init as init_logger
|
2
3
|
from .secrets import Secret
|
3
|
-
from .settings import Settings, get_settings, init_agent
|
4
|
+
from .settings import Settings, get_settings, init, init_agent
|
4
5
|
from .utils import copy_folder
|
5
6
|
|
6
7
|
__all__ = [
|
@@ -8,6 +9,8 @@ __all__ = [
|
|
8
9
|
"Settings",
|
9
10
|
"get_settings",
|
10
11
|
"init_agent",
|
12
|
+
"init",
|
11
13
|
"copy_folder",
|
12
14
|
"init_logger",
|
15
|
+
"HTTPError",
|
13
16
|
]
|
beamlit/common/error.py
ADDED
beamlit/run.py
CHANGED
@@ -3,7 +3,7 @@ from typing import Any
|
|
3
3
|
|
4
4
|
import requests
|
5
5
|
from beamlit.client import AuthenticatedClient
|
6
|
-
from beamlit.common
|
6
|
+
from beamlit.common import HTTPError, get_settings
|
7
7
|
|
8
8
|
|
9
9
|
class RunClient:
|
@@ -45,4 +45,6 @@ class RunClient:
|
|
45
45
|
kwargs["json"] = json
|
46
46
|
|
47
47
|
response = client.request(method, url, **kwargs)
|
48
|
+
if response.status_code >= 400:
|
49
|
+
raise HTTPError(response.status_code, response.text)
|
48
50
|
return response
|
beamlit/serve/app.py
CHANGED
@@ -7,13 +7,10 @@ from logging import getLogger
|
|
7
7
|
from uuid import uuid4
|
8
8
|
|
9
9
|
from asgi_correlation_id import CorrelationIdMiddleware
|
10
|
-
from beamlit.common
|
11
|
-
from beamlit.common.instrumentation import (
|
12
|
-
|
13
|
-
|
14
|
-
get_span_exporter,
|
15
|
-
instrument_app,
|
16
|
-
)
|
10
|
+
from beamlit.common import HTTPError, get_settings, init
|
11
|
+
from beamlit.common.instrumentation import (get_metrics_exporter,
|
12
|
+
get_resource_attributes,
|
13
|
+
get_span_exporter, instrument_app)
|
17
14
|
from fastapi import FastAPI, Request, Response
|
18
15
|
from fastapi.responses import JSONResponse
|
19
16
|
from traceloop.sdk import Traceloop
|
@@ -90,10 +87,17 @@ async def root(request: Request):
|
|
90
87
|
content = {"error": str(e)}
|
91
88
|
if settings.environment == "development":
|
92
89
|
content["traceback"] = str(traceback.format_exc())
|
93
|
-
logger.error(
|
90
|
+
logger.error(str(traceback.format_exc()))
|
94
91
|
return JSONResponse(status_code=400, content=content)
|
92
|
+
except HTTPError as e:
|
93
|
+
content = {"error": e.message, "status_code": e.status_code}
|
94
|
+
if settings.environment == "development":
|
95
|
+
content["traceback"] = str(traceback.format_exc())
|
96
|
+
logger.error(f"{e.status_code} {str(traceback.format_exc())}")
|
97
|
+
return JSONResponse(status_code=e.status_code, content=content)
|
95
98
|
except Exception as e:
|
96
99
|
content = {"error": f"Internal server error, {e}"}
|
97
100
|
if settings.environment == "development":
|
98
101
|
content["traceback"] = str(traceback.format_exc())
|
102
|
+
logger.error(str(traceback.format_exc()))
|
99
103
|
return JSONResponse(status_code=500, content=content)
|
@@ -2,7 +2,7 @@ beamlit/__init__.py,sha256=545gFC-wLLwUktWcOAjUWe_Glha40tBetRTOYSfHnbI,164
|
|
2
2
|
beamlit/client.py,sha256=PnR6ybZk5dLIJPnDKAf2epHOeQC_7yL0fG4muvphHjA,12695
|
3
3
|
beamlit/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
|
4
4
|
beamlit/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
|
5
|
-
beamlit/run.py,sha256=
|
5
|
+
beamlit/run.py,sha256=BCVQXdtIzJedxqGSWttYlJphO5ru7VNDYrUAQmCNq_c,1445
|
6
6
|
beamlit/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
|
7
7
|
beamlit/agents/__init__.py,sha256=nf1iwQwGtCG6nDqyVhxfWoqR6dv6X3bvSpCeqkTCFaM,101
|
8
8
|
beamlit/agents/chain.py,sha256=HzBs3nI4xaH86I_r-M-HGGp6roXsJxMx-qXl_GrJaY0,2831
|
@@ -128,7 +128,8 @@ beamlit/authentication/authentication.py,sha256=8R-3WdQSykNjCbebAW2p8Glvw5nlAmSE
|
|
128
128
|
beamlit/authentication/clientcredentials.py,sha256=cxZPPu--CgizwqX0pdfFQ91gJt1EFKwyy-aBB_dXX7I,3990
|
129
129
|
beamlit/authentication/credentials.py,sha256=p_1xenabCbQuRz7BiFk7oTK4uCxAt_zoyku5o-jcKGE,5343
|
130
130
|
beamlit/authentication/device_mode.py,sha256=tmr22gllKOZwBRub_QjF5pYa425x-nE8tQNpZ_EGR6g,3644
|
131
|
-
beamlit/common/__init__.py,sha256=
|
131
|
+
beamlit/common/__init__.py,sha256=vj4_boIBVitMsaQR8BqBqE2eupOIh6MWBAYlYyCCH98,341
|
132
|
+
beamlit/common/error.py,sha256=f9oJDFxhoHK-vpjxBgEp0NwWIk0N_THPemUI7uQxVzU,270
|
132
133
|
beamlit/common/generate.py,sha256=LtdCju_QayRS4lZrrb_0VHqWWvTcv4Mbf-iV1TB_Qko,7522
|
133
134
|
beamlit/common/instrumentation.py,sha256=MsBDfFcMYqGDiHHj4j5hLHE4EWxZExkhmCeFS3SKzJY,3181
|
134
135
|
beamlit/common/logger.py,sha256=VFRbaZh93n8ZGugeeYKe88IP2nI3g2JNa7XN4j8wVJE,1116
|
@@ -251,10 +252,10 @@ beamlit/models/websocket_channel.py,sha256=jg3vN7yS_oOIwGtndtIUr1LsyEA58RXLXahqS
|
|
251
252
|
beamlit/models/workspace.py,sha256=l__bIpbA4oJvxXo7UbEoCcqkvu9MiNt5aXXpZ3bgwHg,4309
|
252
253
|
beamlit/models/workspace_labels.py,sha256=WbnUY6eCTkUNdY7hhhSF-KQCl8fWFfkCf7hzCTiNp4A,1246
|
253
254
|
beamlit/models/workspace_user.py,sha256=70CcifQWYbeWG7TDui4pblTzUe5sVK0AS19vNCzKE8g,3423
|
254
|
-
beamlit/serve/app.py,sha256=
|
255
|
+
beamlit/serve/app.py,sha256=k9THiOqcPs4lcQQhZaucLcboXCR_5AKP9AFCMNRbdPI,3559
|
255
256
|
beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
|
256
257
|
beamlit/serve/middlewares/accesslog.py,sha256=Mu4T4_9OvHybjA0ApzZFpgi2C8f3X1NbUk-76v634XM,631
|
257
258
|
beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
|
258
|
-
beamlit-0.0.
|
259
|
-
beamlit-0.0.
|
260
|
-
beamlit-0.0.
|
259
|
+
beamlit-0.0.30rc33.dist-info/METADATA,sha256=NQdt4gFJboZxWip3Z_i19Tkn759fbWvjZgi0ffzBYrQ,2405
|
260
|
+
beamlit-0.0.30rc33.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
261
|
+
beamlit-0.0.30rc33.dist-info/RECORD,,
|
File without changes
|