The set_cannot_be_distributed v4 API method disables distributions at the UDF level, even if the distribution criteria are met at the library level.
void set_cannot_be_distributed( a_v4_extfn_proc_context *cntxt)
In the default behavior, if the library is distributable, then the UDF is distributable. Use set_cannot_be_distributed in the UDF to push the decision to disable distribution to the server.