nuclio

How do I deploy a Nuclio function with MLRun?


I need an example of deploying a Nuclio function using MLRun.


Solution

  • You should follow these steps:

    1. Call to code_to_function as in this example:
    fn = code_to_function(name='data-generator', handler='main', kind='job', filename='functions/code.py')
    
    1. Invoke with_http on the function:
    fn.with_http(host='URL_path', port=port_number)
    
    1. Deploy the function:
    fn.deploy()