Respect returned synapse (and its status code)#1822
Conversation
|
Thanks @mjurbanski-reef ! we will take a look |
d2a36ea to
bb6228f
Compare
|
@gus-opentensor I have rebased to current staging. IMO it would be good to include in v7.0 since it is a substantial change, also it hangs here for 2 weeks already and it would be a shame to let it waste away ;) Since I had some time to play with it, I additionally, fixed the exception handling, so now if SynapseException is risen from forward_fn it will respect its value as well, but perhaps more importantly, it no longer will return exception as "raw" to the client. if triggered under forward_fn would happily return to the remote client the |
|
Seems on dendrite side the error message was ignored as well, so fixed that as well and added some more tests |
|
another cool application possible after these changes is using BackgroundTasks from fastapi https://fastapi.tiangolo.com/tutorial/background-tasks/ in forward_fn |
|
@gus-opentensor so this PR is 3 weeks old, any hope for it to be included in v7? |
|
@gus-opentensor thank you! |
This continues from #1803 by adding fix for bittensor ignoring synapse objects returned by
forward_fn. Most painful effect of that was that while user may have been convincedsynapse.axon.status_codewill be propagated to the client, it in fact, was not.I have noticed that @ifrit98 was also hit by this bug at some point:
https://github.com/ifrit98/storage-subnet/blob/b92052e0c33aea0d3d04ce707e183964e442c1b5/neurons/miner.py#L776-L780
Fixes&improvements
forward_fnreturn synapse is no longer ignored - before, if we for example didsynapse = synapse.copy()at the beginning of that function and modified only a copy, you could spent hours no end without seeing why your axon doesn't actually return that to the client (dendrite); don't ask me how I know :)synapse.axon.processing_timeis now also sent to the end client (before it was only visible on the server)Overall this should improve debugging experience a lot. It sure did for me.