Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

The ModelOp Center command line (CLI) is where you run ModelOp Center commands, also known as moc commands. You use moc commands to interact with the ModelOp Center service. You can execute these commands from an SSH session or from the system console.

Table of Contents

Table of Contents

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:

Code Block
Usage:
  moc [flags]
  moc [command]

Available Commands:
  asset       Manage assets for models
  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

Flags:
  -h, --help      help for moc
  -v, --version   Print version information

Use "moc [command] --help" for more information about a command.

5. 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

  • init

  • job

  • model

Command details

moc

Synopsis

Code Block
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

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

asset

Synopsis

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

Description

Manage assets for models. Use add command to add an asset to an existing model.

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

Options

e, --external

Use if file is larger than 10 MB, or needs to be stored in an 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 external resource.

f, --force

Stores file in model-manage if 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

Specify the model name, and the path to where the assets are stored.

Examples

Code Block
moc asset add <model_name> attachment.zip

moc asset add 00000000-0000-0000-0000-000000000000 attachment.zip

moc asset add 00000000-0000-0000-0000-000000000000 attachment.zip --name=testModelAttachment.zip

moc asset add 00000000-0000-0000-0000-000000000000 [http/s3/S3n/S3a]://accessKey:secretKey@Domain/PATH/file.txt --region=us-east-1

moc asset add 00000000-0000-0000-0000-000000000000 http://$ACCESS_KEY:$SECRET_KEY@Domain/PATH/file.txt --region=us-east-1

init

Synopsis

Code Block
moc init [--help] 
moc init url [--retry int] [--verbose]

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

n, --retry int

Number of retries (1s intervals) to connect to the URL provided

V --verbose

Be verbose

Arguments

URL of the ModelOp Center is required.

Examples

Code Block
moc init http://abc.xyz
moc init https://abc.xyz
moc init http://abc.xyz --retry=10 --verbose
moc init http://abc.xyz -n=10 -V

job

Synopsis

Code Block
moc job <command> [options]
moc job create <batchjob | testjob | trainingjob> [options]
moc job ls [--help]
moc job status <job ID>
moc job result <job id>

Description

Manage jobs in ModelOp Center.

Options

-engine string

Specify target engine name where the job should run

e, --external

Store the file as an external file asset

f, --force    

In case file is large to be stored as 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

job ID

Use with status 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 — ?

  • 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 results of a batch job. Requires a job ID Use moc job ls to see job ID

status     

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

Examples

Code Block
moc job create <batchjob | testjob | trainingjob> [options]
moc job create [batchjob | testjob | trainingjob] <model_name> input.json output.json
moc job create [batchjob | testjob | trainingjob] 00000000-0000-0000-0000-000000000000 input.json output.json
moc job create [batchjob | testjob | trainingjob] 00000000-0000-0000-0000-000000000000 input.json output.json --force
moc job create [batchjob | testjob | trainingjob] 00000000-0000-0000-0000-000000000000 input.json output.json --external
moc job create [batchjob | testjob | trainingjob] 00000000-0000-0000-0000-000000000000 input.json output.json --input-schema-check --output-schema-check

model

Synopsis

Code Block
moc model <command> [options]
moc model add <model name> <file> [options]
moc model ls [model name]

Description

Manage models in the ModelOp Center.

Add a model to 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

Arguments

add        

Add model to ModelOp Center

ls         

Get list of all models or with given name

Examples

Code Block
moc model add sample_model /path/to/model/model.py
moc model add sample_model /path/to/model/model.py --schema-in=inputSchema.avsc --schema-out=outputSchema.avsc -V
moc model add sample_model /path/to/model/model.py --schema-in=inputSchema.avsc --schema-out=outputSchema.avsc --schema-check-off

moc model ls
moc model ls sample_model