Skip to main content

Lyve Cloud Documentation

Using Nuclio

Nuclio is an open-source and managed serverless platform used to minimize development and maintenance overhead and automate the deployment of data-science-based applications. The framework focused on data, I/O, and compute-intensive workloads. It is well integrated with popular data science tools, such as Jupyter and Kubeflow, supports a variety of data and streaming sources, and supports execution over CPUs and GPUs.

You can use Nuclio through a fully managed application service, the Lyve cloud analytics platform. MLRun serving utilizes serverless Nuclio functions to create multi-stage real-time pipelines.

Nuclio addresses the desired capabilities of a serverless framework:

  • Real-time processing with minimal CPU/GPU and I/O overhead and maximum parallelism

  • Native integration with a large variety of data sources, triggers, processing models, and ML frameworks

  • Stateful functions with data-path acceleration

Procedure. Following is the sample code snippet about trigger rabbit-mq from mlrun
  1. exchangeName: The exchange that contains the queue

  2. topics and queueName: They are mutually exclusive. The trigger can either create an existing queue specified by queueName or create its queue, subscribing it to topics.

  3. topics: If you Specify the trigger, create a queue with a unique name and subscribe it to these topics.

  4. url: It is the actual host URL and port details where queue address details are available.

    import mlrun
    import json
    class Echo:
        def __init__(self, context, name=None, **kw):
            self.context = context
   = name
   = kw
        def do(self,x):
            y = type(x)
            print("Echo:", "done consuming", y)
            return x
    function = mlrun.code_to_function("rabbit2",kind="serving", 
          "maxWorkers": 1,
          "url": "amqp://",
            "exchangeName": "athena.spr.topic.inference",
            "queueName": "athena-spr-sampling-shadow-validate",
            "topic": "#.sampling.#"},
    graph = function.set_topology("flow", engine="async")"Echo", name="testingRabbit")