https://www.boundaryml.com logo
issue using baml functions in celery tasks
# help
z
hey team, i have some baml functions which all work fine when running in a standard python context. however, when i try to run the same code in a celery task, the task simply hangs at the point where the function is called and never completes. it seems to just disappear into the void. i get no error logs, my celery server doesn't crash, just nothing. has anyone observed behavior like this before??? any suggestions?
found this thread (https://github.com/BoundaryML/baml/issues/1821) and can confirm that the "-P threads" solution works. curious if there's any other, preferred workaround for this at this point or if this is our only option?
v
can you share what version of BAML you're using? this fixed the pickling issue quite a bit ago, but i wonder if there's something else thats happening here. https://github.com/BoundaryML/baml/pull/1990
z
yep, i'm on 0.205.0
v
oh got it hmm! we'll have to figure out where this is happening in that case. Let me know if -P threads ends up being an issue. i know quite a few folks use that as of now.
the other thing to note here is that celery doesn't actually have real async support. so you may need to use
from baml_client.sync_client import b
which may yield better results
z
thanks @Vaibhav (BAML 🐑) . using -P threads might become an issue for me at some point, but is fine for now. i am using the synchronous client, just fyi.