ModelOp CLI Reference

The ModelOp Center command line (CLI) offers a terminal-based medium to allow you to interact with ModelOp Center via moc commands. You can execute these commands from an SSH session or from the system console.

Table of Contents

 

Introduction

The primary functions enabled through the CLI include the ability to register models with the ModelOp Center, upload additional attachments and artifacts to an existing model, and run Batch Jobs to make sure the code is right. From there, you may use the Command Center web UI to edit and update your models further.

Document conventions

This article uses the following conventions:

  • Angle brackets (<>) indicate that the enclosed element is mandatory. You are required to replace the text within the angle brackets with the appropriate information.

  • Square brackets ([]) indicate that the enclosed element is optional. You can choose one or more items or no items.

  • The pipe character (|) indicates that one of the bracketed statements can be specified.

This article contains the following sections for each command:

  • Synopsis

    • A description of the commands, options, and arguments available for the command.

  • Description

    • General information about the command.

  • Options

    • Options to control the behavior of a command. Options always begin with one or two dashes. Use one dash for the abbreviated term such as -v. Use two dashes for the full term such as --version. Square brackets mean that element of the command is optional.
      Not all commands have options.

  • Arguments

    • Some commands require arguments. Arguments are names of commands, files, host names, IP addresses, URLS and so on that you specify to control the behavior of the command. Not all commands have arguments. You do not precede arguments with dashes.
      Not all commands have arguments.

  • Examples

    • Usage samples with expected output. Not all commands have examples.

CLI Installation

You install the CLI in these steps:

  • Download the CLI files to your local machine.

  • Make them executable if necessary.

  • Set a PATH to the location where the files are stored.

  • Run the init command to connect to your ModelOp instance.

To install the CLI

  1. Click the file type you use to download the CLI file:

    1. Darwin

    2. Linux

    3. Windows

  2. Make the Mac (Darwin) or Linux files executable. Browse to the folder where you stored the CLI file. For Macs and Linux, this folder should be /usr/local/bin/

    1. For Darwin, type chmod 755 <filename>

    2. For Linux, type chmod +x <filename>

  3. Set a PATH to the CLI file.

  4. Confirm the installation. At the prompt, type moc help.
    Output:

Usage: moc [flags] moc [command] Available Commands: asset Manage assets for models credentials Manage credentials with CLI help Help about any command init Configure CLI to point to ModelOp Center. Requires an URL with http scheme. job Manage jobs in ModelOp Center model Manage models in ModelOp Center show Outputs init configuration. Flags: -h, --help help for moc -v, --version Print version information Use "moc [command] --help" for more information about a command.
  1. Configure the CLI to connect to your instance of ModelOp Center. Type

moc init <URL of ModelOp Center>

Overview of commands

The term “moc commands” refers to the list of available ModelOp Center CLI commands.

The help for the moc commands is presented in Linux man page format.

  • Type help to get general information about command-line man pages.

  • Type help <command> to get information about a specific command.

The following moc commands are available:

  • asset

  • credentials

  • init

  • job

  • model

  • show

Command details

moc

Synopsis

moc [--help | --version] moc <command>

Description

The ModelOp Center CLI base command which is the required prefix to execute moc commands.

Options

v, --version

Displays the version of the CLI

h, --help

Displays information about the specified command

moc command list

asset

Manage assets for models

credentials

Manage credentials with CLI. Use of this command is only required if the ModelOp Center is using Oauth2 for security

init

Configure CLI to point to a particular instance of ModelOp Center. Requires a URL to the specific ModelOp Center instance. This should be executed first before using other commands (besides help).

job

Manage jobs in the ModelOp Center

model

Manage models in the ModelOp Center

show

Outputs CLI configuration done by init command

asset

Synopsis

moc asset [--help] moc asset <command> moc asset add <model name or id> <path to file> [--name] [--external | --force] [--region] [--verbose] moc asset ls <model name or id>

Description

Manage assets for models. Use add command to add an asset to an existing model. Use ls command to list assets for a given model.

Use moc model ls to find the model ID and name.

Options

e, --external

Use if the file is larger than 10 MB, or needs to be stored in external storage configured with model-manage. Otherwise, by default, the file is stored internally in model-manage.

If the file already exists in external storage, provide a link to the asset in the following format: [protocol]://ResourceAccessKey: ResourceSecretKey@ResourceDomain/PATH TO FILE/FILENAME.EXTENTION

Supported protocols:

  • http

  • https

  • s3

  • s3n

  • s3a

You can use the environment variables to provide Accesskey and SecretKey credentials to enable access to the external resource.

f, --force

Stores file in model-manage if the file size is less than 10 MB, or in external storage otherwise.

h, --help

Help with asset command

--name string

Name by which asset is stored. Overrides current name

--region string  

Region for the asset if provided by a link

V, --verbose

Be verbose

Arguments

model name or id

Specify the model name or id. (Use moc model ls to find the model name or id)

path to file

Specify the path to the file that will be added as an asset to the model

Examples

credentials

Synopsis

Description

Manage credentials with the CLI which is required if the ModelOp Center is using OAuth2 for authentication and authorization. Add credentials using add, update using update and remove using rm. To view the current username stored with the CLI, use ls. The CLI will give appropriated prompts and will ask for the user input.

Options

h, --help

Help for the commands

--username

Enter a username to save the step of CLI asking for username

--password

Enter a password to save the step of CLI asking for username

--currentusername

Flag used with credentials update command to provide CLI with current username

--currentpassword

Flag used with credentials update command to provide CLI with current password

--newusername

Flag used with credentials update command to provide CLI with new username

--newpassword

Flag used with credentials update command to provide CLI with new password

Arguments

add

Add credentials

update

Update username and/or password

ls    

Lists the current username for the CLI

rm

Remove stored credentials (Needs existing username password confirmation)

username

This argument is only necessary for the rm. Provide the current username stored in order to delete the credentials. Password confirmation will be asked before removing it.

Examples

init

Synopsis

Description

Configure CLI to point to a particular instance of ModelOp Center. Requires a URL to the specific ModelOp Center instance.

Options

h, --help

Help for init

V --verbose

Be verbose

Arguments

url

URL of the ModelOp Center is required with the HTTP(http/https) scheme.

Examples

job

Synopsis

Description

Manage jobs in ModelOp Center.

Options

--engine string

Specify the target engine name where the job should run

e, --external

Store the file as an external file asset

f, --force    

In case the file is large to be stored as a local asset, store it as external asset

h, --help

Help for job command

--input-schema-check

Enable schema checking for the input

--output-schema-check

Enable schema checking for the output

--region string

Specify region for the asset to be added using external link

--schema-check     

Enable schema checking for input and output

V, --verbose

Be verbose

Arguments

create (or add)

Create batch jobs

<versioned(deplooyable)model ID/name>

Versioned Model’s ID for which the job should be created

<input_file>

Pah to input file for the job to be created

<output_file_name>

Output file name where the job’s result will be stored

job ID

Use with status, messaged and result arguments

ls

Standard Linux command to list all jobs. Displays the following details about a job:

  • ID — unique ID that is automatically assigned by ModelOp Center upon model add

  • OWNER — the user who created the job or SYSTEM

  • TYPE — the type of batch job (batch scoring, batch metrics/test, batch training)

  • JOB_STATUS — States are Created, Waiting, Running, Complete, Error

  • TOTAL_RUNNING_TIME — How long the model took the last time it ran  

  • LAST_MODIFIED_DATETIME — The last time the model was changed

  • LAST_MESSAGE — Date, time and result of last usage

result     

Get the results of a batch job. Requires a job ID Use moc job ls to see job ID

status

Get the status of a batch job. Requires a job ID. Use moc job ls to see job ID

messages

Get the messages of a job. Requires a job ID. Use moc job ls to see job ID

Examples

model

Synopsis

Description

Manage models in the ModelOp Center.

Add a model to ModelOp Center and list the models stored in ModelOp Center

Use --schema-in and --schema-out to include externalized input and output schemas with the model. When a schema file is provided to upload with a model, schema check is enabled by default.

Use --input-check-off, --output-check-off, -schema-check-off in order to disable schema checking for input and/or output.

Options

h, --help

Help for add

input-check-off

Enable schema checking for the input

i, --schema-in string   

Path for input schema

o, --schema-out string  

Path for output schema

output-check-off   

Enable schema checking for the output

schema-check-off   

Enable schema checking for input and output

V, --verbose 

Be verbose

--versioned

Option used with the model ls command to list all versioned models (deployableModel) associated with a given model

--deployed

Option used with the model ls command to list all deployedModel associated with a given model

--state

Option used with the model ls command to list all deployedModel associated with a given model with state provided

--recent

Option used with model ls to retrieve the most recent model. Also works with --versioned and --deployed

--id

Option is used to retrieve just id of a most recent model. Also works with --versioned and --deployed

Arguments

add

Add model to ModelOp Center

ls    

Get list of all models or with given name

deploy

Deploy a model to runtime added with ModelOp Center

model name

For add, this is the model name by which the provided model will be stored in ModelOp Center. For ls and deploy this model will be searched for to be listed on terminal or to be deployed.

file

Path to the model source code file.

Examples

show

Synopsis

Description

The command shows the configuration done using moc init command, i.e. the url to the ModelOp Center and if the credentials are necessary to communicate with the ModelOp Center. This command takes no arguments or options apart from -h or --help

Examples

 

 

Related Articles