Skip to main content

Leanda Command Line Interface

Project description

Leanda-CLI

Leanda Command Line Interface (CLI) is intended for installation on users computers and will serve as another "client" for Leanda platform.

Requirements

Docker 19.x

Python 3.x (for development)

Quickstart

git clone https://github.com/ArqiSoft/leanda-cli
cd leanda-cli

docker build -t leanda/cli:latest .
docker-compose up -d
docker exec -it leanda-cli /bin/bash

Run help command

python leanda.py -h

Run livesync command

python leanda.py login -u my_name -p my_password
python leanda.py livesync -l ./leanda-sync

./leanda-sync is a mounted folder. You can change it in the docker-compose.yml file volume section. Other parameters like WEB_API_URL are located in the environment section.

Stop docker-compose

exit
docker-compose down

Commands Summary

Command Usage
leanda.py login Allows to login and store the update session information for an Leanda user.
leanda.py whoami Check authorization and explore session data.
leanda.py logout Do logout. Session data is removed.
leanda.py pwd Identify current Leanda working directory.
leanda.py cd Change Leanda's current working directory.
leanda.py ls Browse remote Leanda folder.
leanda.py rm Allows to remove file or folder.
leanda.py upload Allows uploading a local file into the BLOB (raw file) store.
leanda.py download Allows to download an Leanda file.
leanda.py livesync Two-way synchronization of local folder with the Leanda user's folder.
leanda.py items Allows to list all items from Leanda using queries.
leanda.py models Allows to list models from Leanda using queries.
leanda.py recordsets Allows to list recordsets from Leanda using queries.
leanda.py train Allows to run Machine Learning command train.
leanda.py predict Allows to run Machine Learning command predict.
leanda.py categories Allows to initialize category tree with basic structure.

login

Allows to login and reset session information for an Leanda user.

Parameters for login

-u, --username   your leanda username.
-p, --password   your leanda password
-v, --verbosity  set verbosity level.

Examples:

leanda.py login -u<user-name> -p<password>
leanda.py login --verbosity -u<user-name> -p<password>
leanda.py login -v -u<user-name> -p<password>
leanda.py login -vv -u<user-name> -p<password>
leanda.py login -u<user-name> -p
Password:

whoami

Check authorization and explore session data.

Parameters for whoami

-v, --verbosity  set verbosity level.

Examples:

leanda.py whoami --verbosity
leanda.py whoami -vv
leanda.py whoami -vvv

logout

Do logout. Session data is removed.

Parameters for logout

No parameters

Examples:

leanda.py logout

pwd

Identify current Leanda working directory.

Parameters for pwd

-v, --verbosity  set verbosity level.

Examples:

leanda.py pwd
leanda.py pwd --verbosity
leanda.py pwd -vv
leanda.py pwd -vvv

ls

Browse remote Leanda folder.

Parameters for ls

container - Remote Leanda user's folder or none for current working folder.
            Leanda user's folder can be choosed by its full id system wide
            or by substring for subfolders in current folder.
            Substring compared to folder name starting from the beggining
            or to folder id ending.
-s, --size - Report page length (default value 10)
-p, --page - Report page number (default value 1)

Examples:

leanda.py ls c1cc0000-5d8b-0015-e9e3-08d56a8a2e01
leanda.py ls 2e01
leanda.py ls -p10
leanda.py ls -s20 -2

cd

Change Leanda's current working directory.

Parameters for cd

container - Remote Leanda user's folder, none for home  folder or '..' for
            parent folder. Leanda user's folder can be choosed by its full id
            system wide or by substring for subfolders in current folder.
            Substring compared to folder name starting from the beggining
            or to folder id ending.

Examples:

leanda.py ls
File
    33.mol               Records(  1) Processed  c1cc0000-5d8b-0015-e9e3-08d56a8a2e01
    combined lysomotroph Records( 55) Processed  00160000-ac12-0242-c20e-08d56e29a481

leanda.py cd 33
leanda.py cd a481
leanda.py cd
leanda.py cd ..
leanda.py cd c1cc0000-5d8b-0015-e9e3-08d56a8a2e01

rm

Allows to remove file or folder

Parameters for rm

container - Remote Leanda user's folder. Leanda user's folder can be choosed by
            its full id  system wide or by substring for subfolders in current
            folder. Substring compared to folder name starting from the beggining
            or to folder id ending.

Examples:

leanda.py rm a481
leanda.py rm abc
leanda.py rm c1cc0000-5d8b-0015-e9e3-08d56a8a2e01

upload

Allows uploading a local file into the BLOB (raw file) store.

Parameters for upload

container - Remote Leanda user's folder, none for working folder.
            Leanda user's folder can be choosed by its full id system wide
            or by substring for subfolders in current folder.
            Substring compared to folder name starting from the beggining
            or to folder id ending.
-p, --path - path to local file
-n, --name - name for file
-m, --meta - path to model description in json or yaml formats
-v, --verbosity  set verbosity level.

Examples:

leanda.py upload -p path-to-file
leanda.py upload -p path-to-file1 -p path-to-file2 -p path-to-file3
leanda.py upload -p path-to-file -n new-name to file 'filename'
leanda.py upload -p path-to-file -m path-to-model.json
leanda.py upload -p path-to-file -m path-to-model.yaml

download

Allows downloading a remote file to local host.

Parameters for download

container - Remote Leanda user's folder, none for working folder.
            Leanda user's folder can be choosed by its full id system wide
            or by substring for subfolders in current folder.
            Substring compared to folder name starting from the beggining
            or to folder id ending.
-o, --output - Path to file or directory to save.
-f, --force - Force overwrite if file exists.

Examples:

leanda.py upload abc -o path-to-file
leanda.py upload a481 -f -o path-to-file1
leanda.py upload c1cc0000-5d8b-0015-e9e3-08d56a8a2e01 -o path-to-file

livesync

Two-way synchronization of local folder with the Leanda user's folder. Comparision between folders based on file names. For more precise comparision see -ul and -ur keys.

 -l, --local-folder - Path to local folder or none for current working directory
 -r, --remote-folder - Remote Leanda user's folder or none for current working folder.
                       Leanda user's folder can be choosed by its full id system wide
                       or by substring for subfolders in current folder. Substring
                       compared to folder name starting from the begining or to
                       folder id ending.
 -ul, --update-local - Compare by name and Leanda file's version
 -ur, --update-remote - Compare by name and last modification time.

Examples:

leanda.py livesync -l abc -r c1cc0000-5d8b-0015-e9e3-08d56a8a2e01
leanda.py livesync -l /path/to/folder -f -r 2e01 -ul
leanda.py livesync -ur

items

Allows to list all items from Leanda using queries.

  -q, --query - Filter models by subquery
  -n, --name  - Filter models by substring
  -s, --short-notation
              - Path to yaml file with list of short notations
                Example - p.radius:MachineLearningModelInfo.Fingerprints.Radius
  -v,--verbosity = 0 
              - Set verbosity level. 
                -v - display query string,
                -vv - display records,
   -f, --format = (json|yaml)
              - Set model verbosity output format

Examples:

leanda.py items
leanda.py items -v
leanda.py items -vv
leanda.py items -n png
leanda.py items -q "SubType eq 'Model' and MachineLearningModelInfo.Method eq 'Naive Bayes'"  -vv -f json
leanda.py items -q "type=Model,prop.chem=MOST_ABUNDANT_MASS,prop.fields=logs"  -s sample_files/short_notations.yaml
leanda.py items -q "SubType eq 'Model' and MachineLearningModelInfo.Fingerprints.Size gt 200"  -vv -f yaml

models

Allows to list models from Leanda using queries. Same as items, but add preset filter SubType eq 'Model'

Examples:

leanda.py models
leanda.py models -v
leanda.py models -vv
leanda.py items -n ada
leanda.py models -q "MachineLearningModelInfo.Method eq 'Naive Bayes'"  -vv -f json
leanda.py models -q "type=Model,prop.chem=MOST_ABUNDANT_MASS,prop.fields=logs"  -s sample_files/short_notations.yaml
leanda.py models -q "MachineLearningModelInfo.Fingerprints.Size gt 200"  -vv -f yaml

recordsets

Allows to list recordsets from Leanda using queries. Same as items, but add preset filter SubType eq 'Records'

Examples:

leanda.py recordsets
leanda.py recordsets -v
leanda.py recordsets -vv
leanda.py recordsets -n combined
leanda.py recordsets -q "MachineLearningModelInfo.Method eq 'Naive Bayes'"  -vv -f json
leanda.py recordsets -q "type=Model,prop.chem=MOST_ABUNDANT_MASS,prop.fields=logs"  -s sample_files/short_notations.yaml
leanda.py recordsets -q "MachineLearningModelInfo.Fingerprints.Size gt 200"  -vv -f yaml

train

Allows to run Machine Learning command train.

  container - Remote Leanda user's folder, none for working folder.
              Leanda user's folder can be choosed by its full id system wide
              or by substring for subfolders in current folder.
              Substring compared to folder name starting from the beggining
              or to folder id ending.
  -m, --meta - Model metadata in json or yaml formats
  -f, --folder-name - Output folder name

Examples:

leanda.py train 00130000-ac12-0242-0f11-08d58dbc7b8b  -f test1.model -m sample_files/train_sdf_model.yaml 
leanda.py train 08d58dbc7b8b  -f test2.model -m sample_files/train_sdf_model.yaml 
leanda.py train b data_solubility.sdf -f test3.model -m sample_files/train_sdf_model.yaml 
leanda.py train data_solubility.sdf -f test4.model -m sample_files/train_sdf_model.yaml 
leanda.py train data_solu -f test5.model -m sample_files/train_sdf_model.yaml 

predict

Allows to run Machine Learning command predict.

 -f - --folder-name - Output folder name
 -m - --model - Leanda model's file id.
 -r - --recordset - Leanda recordsets's file id.

Examples:

leanda.py predict -f folder.predict -m 7ceef61a-cf7d-41d9-a1f0-19874a2b31e9 -r 000e0000-ac12-0242-36bb-08d585329c5a

categories

Allows to initialize category tree with basic structure.

Examples:

leanda.py categories

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

leanda-0.0.1.tar.gz (23.7 kB view hashes)

Uploaded Source

Built Distribution

leanda-0.0.1-py3-none-any.whl (42.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page