wandb/weave

AWS Lambda

NaxAlpha opened this issue · 1 comments

Hi,

I have an API on AWS Lambda that calls OpenAI. I want to monitor calls to OpenAI using Wandb Weave. However; it seems I cannot set it up on AWS Lambda. I have setup a docker image for the API but when I execute the API; it givens me the following error:

START RequestId: b81f396b-1dcd-49c4-925d-640e069d2bfd Version: $LATEST
--
wandb: WARNING Path /var/task/wandb/ wasn't writable, using system temp directory.
wandb: WARNING Path /var/task/wandb/ wasn't writable, using system temp directory
wandb: WARNING Path /var/task/wandb/ wasn't writable, using system temp directory
wandb: Currently logged in as: <username> (<org>). Use `wandb login --relogin` to force relogin
wandb: Tracking run with wandb version 0.16.0
wandb: Run data is saved locally in /tmp/wandb/run-20231109_085849-cwbt0w4l
wandb: Run `wandb offline` to turn off syncing.
wandb: Syncing run comic-voice-23
wandb: ⭐️ View project at https://wandb.ai/<org>/<proj>
wandb: 🚀 View run at https://wandb.ai/<org>/<proj>/runs/<id>
[ERROR] LifespanFailure: Lifespan startup failure. Traceback (most recent call last):
File "/var/lang/lib/python3.11/site-packages/starlette/routing.py", line 677, in lifespan
async with self.lifespan_context(app) as maybe_state:
File "/var/lang/lib/python3.11/site-packages/starlette/routing.py", line 566, in __aenter__
await self._router.startup()
File "/var/lang/lib/python3.11/site-packages/starlette/routing.py", line 656, in startup
handler()
File "/var/task/main.py", line 42, in startup_event
init_monitor(f"{entity}/{project}/{stream}")
File "/var/lang/lib/python3.11/site-packages/weave/monitoring/monitor.py", line 322, in init_monitor
stream_table = _init_monitor_streamtable(stream_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/site-packages/weave/monitoring/monitor.py", line 291, in _init_monitor_streamtable
stream_table = StreamTable(
^^^^^^^^^^^^
File "/var/lang/lib/python3.11/site-packages/weave/wandb_interface/wandb_stream_table.py", line 247, in __init__
super().__init__(
File "/var/lang/lib/python3.11/site-packages/weave/wandb_interface/wandb_stream_table.py", line 161, in __init__
self._ensure_remote_initialized()
File "/var/lang/lib/python3.11/site-packages/weave/wandb_interface/wandb_stream_table.py", line 174, in _ensure_remote_initialized
self._weave_stream_table_ref = storage._direct_publish(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/site-packages/weave/storage.py", line 133, in _direct_publish
artifact = artifact_wandb.WandbArtifact(name, type=wb_artifact_type_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/site-packages/weave/artifact_wandb.py", line 410, in __init__
self.io_service = io_service.get_sync_client()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/site-packages/weave/io_service.py", line 647, in get_sync_client
return SyncClient(get_server(), filesystem.get_filesystem())
^^^^^^^^^^^^
File "/var/lang/lib/python3.11/site-packages/weave/io_service.py", line 413, in get_server
SERVER = Server(process=False)
^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/site-packages/weave/io_service.py", line 186, in __init__
self._shutting_down = multiprocessing.Event()
^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/multiprocessing/context.py", line 93, in Event
return Event(ctx=self.get_context())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/multiprocessing/synchronize.py", line 331, in __init__
self._cond = ctx.Condition(ctx.Lock())
^^^^^^^^^^
File "/var/lang/lib/python3.11/multiprocessing/context.py", line 68, in Lock
return Lock(ctx=self.get_context())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/multiprocessing/synchronize.py", line 169, in __init__
SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
File "/var/lang/lib/python3.11/multiprocessing/synchronize.py", line 57, in __init__
sl = self._semlock = _multiprocessing.SemLock(
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 38] Function not implemented
Traceback (most recent call last):  File "/var/lang/lib/python3.11/site-packages/mangum/adapter.py", line 80, in __call__    stack.enter_context(lifespan_cycle)  File "/var/lang/lib/python3.11/contextlib.py", line 505, in enter_context    result = _enter(cm)  File "/var/lang/lib/python3.11/site-packages/mangum/protocols/lifespan.py", line 69, in __enter__    self.loop.run_until_complete(self.startup())  File "/var/lang/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete    return future.result()  File "/var/lang/lib/python3.11/site-packages/mangum/protocols/lifespan.py", line 167, in startup    raise LifespanFailure(self.exception)
END RequestId: b81f396b-1dcd-49c4-925d-640e069d2bfd
REPORT RequestId: b81f396b-1dcd-49c4-925d-640e069d2bfd	Duration: 5255.93 ms	Billed Duration: 13811 ms	Memory Size: 512 MB	Max Memory Used: 504 MB	Init Duration: 8554.29 ms

Can someone help me to solve this?
Regards

Hello @NaxAlpha! Thank you for the issue. We have spent the last few months completely rewriting Weave and have a new monitoring tool available. Please check out wandb.me/weave for docs and tutorials. The underlying architecture has completely changed and I suspect your use case is supported now.