Command lines

  1. Creates an falcon application and starts it through a wsgi application
  2. Creates an falcon application to store machine learned models
  3. Encrypts password
  4. Uploads a machine model

Creates an falcon application and starts it through a wsgi application

Creates an falcon application and starts it through a wsgi server.

start_mlrestapi –help

usage: start_mlrestapi [-h] [-n NAME] [-ho HOST] [-p PORT] [-no NOSTART]
                       [-w WSGI] [-o OPTIONS] [-s SECRET] [-c CCALL]
                       [-u USERS]

Creates an falcon application and runs it through a wsgi server. Only waitress
is implemented right now. Other alternative such as mod_wsgi with Apache.
uwsgi are not implemented.

optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  class name or filename which defines the application
                        (default: dummy)
  -ho HOST, --host HOST
                        host (default: 127.0.0.1)
  -p PORT, --port PORT  port (default: 8081)
  -no NOSTART, --nostart NOSTART
                        do not start the wsgi server (default: False)
  -w WSGI, --wsgi WSGI  wsgi framework which runs the falcon application
                        (default: waitress)
  -o OPTIONS, --options OPTIONS
                        additional options as a string (depends on the
                        application) (default: )
  -s SECRET, --secret SECRET
                        secret used to encrypt the logging, default is empty
                        which disables the encryption (default: )
  -c CCALL, --ccall CCALL
                        calling convention, 'single', 'multi' or 'both'
                        depending on the fact that the prediction function can
                        predict for only one observation, multiple ones or
                        both (default: single)
  -u USERS, --users USERS
                        registred users, file with two columns login,
                        encrypted password, and no header (default: )

(original entry : make_ml_app.py:docstring of lightmlrestapi.cli.make_ml_app._start_mlrestapi, line 6)

Creates an falcon application to store machine learned models

Creates an falcon application and starts it through a wsgi server. The appplication stores machine learned models and runs predictions assuming all the necessary packages were installed.

start_mlreststor –help

usage: start_mlreststor [-h] [-l LOCATION] [-ho HOST] [-p PORT] [-n NAME]
                        [-no NOSTART] [-w WSGI] [-s SECRET] [-u USERS]
                        [-a ALGO]

Creates an falcon application and runs it through a wsgi server. The
appplication stores machine learned models and runs predictions assuming all
the necessary packages were installed. Only waitress is implemented right now.
Other alternative such as mod_wsgi with Apache. uwsgi are not implemented.
Parameter *users* can be empty to disable authentification.

optional arguments:
  -h, --help            show this help message and exit
  -l LOCATION, --location LOCATION
                        location of the storage (default: .)
  -ho HOST, --host HOST
                        host (default: 127.0.0.1)
  -p PORT, --port PORT  port (default: 8081)
  -n NAME, --name NAME  only one option is implemented 'ml' (default: ml)
  -no NOSTART, --nostart NOSTART
                        do not start the wsgi server (for debug purpose)
                        (default: False)
  -w WSGI, --wsgi WSGI  wsgi framework which runs the falcon application
                        (default: waitress)
  -s SECRET, --secret SECRET
                        secret used to encrypt the logging, default is empty
                        which disables the encryption (default: )
  -u USERS, --users USERS
                        list of authorized users stored in a text file with
                        two columns: login and encrypted password (default: )
  -a ALGO, --algo ALGO  algorithm used to encrypt the passwords (default:
                        sha224)

(original entry : make_ml_store.py:docstring of lightmlrestapi.cli.make_ml_store._start_mlreststor, line 6)

Encrypts password

Encrypts passwords for a REST API created by lightmlrestapi.

encrypt_pwd –help

usage: encrypt_pwd [-h] [-i INPUT] [-o OUTPUT] [-a ALGO]

Encrypts passwords to setup a REST API with *lightmlrestapi*.

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        file containing two columns <login>,<clear password>
                        (comma separated values), no header, encoding is utf-8
                        (default: )
  -o OUTPUT, --output OUTPUT
                        file containing two columns <login>,<encrypted
                        password>, csv, encoding is utf-8 (default: )
  -a ALGO, --algo ALGO  algorithm used to hash the passwords (default: sha224)

(original entry : make_encrypt_pwd.py:docstring of lightmlrestapi.cli.make_encrypt_pwd._encrypt_pwd, line 7)

Uploads a machine model

Uploads a machine learned model to a REST API created with lightmlrestapi. The code of this command line is equivalent to:

from lightmlrestapi.netrest import submit_rest_request, json_upload_model
req = json_upload_model(name=name, pyfile=pyfile, data=data)
submit_rest_request(req, login=login, pwd=pwd, url=url)

upload_model –help

usage: upload_model [-h] [-l LOGIN] [--pwd PWD] [-n NAME] [-p PYFILE]
                    [-d DATA] [--url URL] [-t TIMEOUT]

Uplaods a machine learned models to a REST API defined by
:py:class:`MLStoragePost <lightmlrestapi.mlapp.mlstorage_rest.MLStoragePost>`.

optional arguments:
  -h, --help            show this help message and exit
  -l LOGIN, --login LOGIN
                        user login (default: )
  --pwd PWD             user pasword (default: )
  -n NAME, --name NAME  name of the model, should be unique and not already
                        used (default: )
  -p PYFILE, --pyfile PYFILE
                        python file which computes the prediction, the file
                        must follows the specification defined in l-template-
                        ml (default: )
  -d DATA, --data DATA  files to upload (default: )
  --url URL             url of the REST API (default: 127.0.0.1:8081)
  -t TIMEOUT, --timeout TIMEOUT
                        timeout (default: 15)

(original entry : make_ml_upload.py:docstring of lightmlrestapi.cli.make_ml_upload._upload_model, line 7)