Ray is a contemporary open supply framework that lets you create distributed purposes in Python with ease. You’ll be able to create easy coaching pipelines, do hyperparameter tuning, knowledge processing and mannequin serving.
Ray lets you create on-line inference APIs with Ray Serve. You’ll be able to simply mix a number of ML fashions and customized enterprise logic in a single software. Ray Serve mechanically creates an HTTP interface to your deployments, taking good care of fault tolerance and replication.
However there may be one factor that Ray Serve misses for now. Many trendy distributed purposes talk by Kafka, however there is no such thing as a out-of-the-box option to join Ray Serve service to Kafka matter.
However don’t panic. It won’t take an excessive amount of effort to show Ray Serve to speak with Kafka. So, let’s start.
Initially we might want to put together our native atmosphere. We are going to use a docker-compose file with Kafka and Kafdrop UI docker containers to begin and discover our native Kafka occasion (so we assume that you’ve got Docker and Docker Compose put in). Additionally we might want to set up some Python necessities to get the work accomplished:
All necessities may be downloaded by this link.
Now we are going to create a ray-consumer.py file with Ray Deployment that will probably be served with Ray Serve. I cannot go into particulars about Ray Serve ideas, as you may examine that within the documentation. Principally it takes the same old Python class and converts it to a asynchronous service Ray Deployment with @serve.deployment decorator: