OSDR Command Line Interface (CLI) is intended for installation on users computers and will serve as another "client" for OSDR platform.
You will need Python 2.7 to get started, so be sure to have an up-to-date Python 2.x installation. Osdr-cli and its dependencies support Python 3. You could start using Python 3, but there are a few things to be aware of. You need to use Python 3.6 or higher. Older versions are not supported. You’ll probably want to use virtualenv. You should define environment variables (or default values will be used):
WEB_API_URL = 'https://api.dev.dataledger.io/osdr/v1/api'
IDENTITY_SERVER_URL = 'https://id.your-company.com/auth/realms/OSDR'
git clone https://github.com/<this-repository>/osdr-cli.git
cd osdr-cli
pip install -r requirements.txt
python osdr.py --help
If you don't have pip installed try
python -m pip install -r requirements.txt
| Command | Usage |
|---|---|
osdr.py login |
Allows to login and store the update sesion information for an OSDR user. |
osdr.py whoami |
Check athorization and explore session data. |
osdr.py logout |
Do logout. Session data is removed. |
osdr.py pwd |
Identify current OSDR working directory. |
osdr.py cd |
Change OSDR's current working directory. |
osdr.py ls |
Browse remote OSDR folder. |
osdr.py rm |
Allows to remove file or folder. |
osdr.py upload |
Allows uploading a local file into the BLOB (raw file) store. |
osdr.py download |
Allows to download an OSDR file. |
osdr.py livesync |
Two-way synchronization of local folder with the OSDR user's folder. |
osdr.py items |
Allows to list all items from OSDR using queries. |
osdr.py models |
Allows to list models from OSDR using queries. |
osdr.py recordsets |
Allows to list recordsets from OSDR using queries. |
osdr.py train |
Allows to run Machine Learning command train. |
osdr.py predict |
Allows to run Machine Learning command predict. |
Allows to login and reset sesion information for an OSDR user.
-u, --username your osdr username.
-p, --password your osdr password
-v, --verbosity set verbosity level.
Examples:
$ osdr.py login -u<user-name> -p<password>
$ osdr.py login --verbosity -u<user-name> -p<password>
$ osdr.py login -v -u<user-name> -p<password>
$ osdr.py login -vv -u<user-name> -p<password>
$ osdr.py login -u<user-name> -p
Password:
Check athorization and explore session data.
-v, --verbosity set verbosity level.
Examples:
osdr.py whoami --verbosity
osdr.py whoami -vv
osdr.py whoami -vvv
Do logout. Session data is removed.
No parameters
Examples:
osdr.py logout
Identify current OSDR working directory.
-v, --verbosity set verbosity level.
Examples:
osdr.py pwd
osdr.py pwd --verbosity
osdr.py pwd -vv
osdr.py pwd -vvv
Browse remote OSDR folder.
container - Remote OSDR user's folder or none for current working folder.
OSDR 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:
osdr.py ls c1cc0000-5d8b-0015-e9e3-08d56a8a2e01
osdr.py ls 2e01
osdr.py ls -p10
osdr.py ls -s20 -2
Change OSDR's current working directory.
container - Remote OSDR user's folder, none for home folder or '..' for
parent folder. OSDR 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:
$ osdr.py ls
File
33.mol Records( 1) Processed c1cc0000-5d8b-0015-e9e3-08d56a8a2e01
combined lysomotroph Records( 55) Processed 00160000-ac12-0242-c20e-08d56e29a481
$ osdr.py cd 33
$ osdr.py cd a481
$ osdr.py cd
$ osdr.py cd ..
$ osdr.py cd c1cc0000-5d8b-0015-e9e3-08d56a8a2e01
Allows to remove file or folder
container - Remote OSDR user's folder. OSDR 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:
osdr.py rm a481
osdr.py rm abc
osdr.py rm c1cc0000-5d8b-0015-e9e3-08d56a8a2e01
Allows uploading a local file into the BLOB (raw file) store.
container - Remote OSDR user's folder, none for working folder.
OSDR 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:
osdr.py upload -p path-to-file
osdr.py upload -p path-to-file1 -p path-to-file2 -p path-to-file3
osdr.py upload -p path-to-file -n new-name to file 'filename'
osdr.py upload -p path-to-file -m path-to-model.json
osdr.py upload -p path-to-file -m path-to-model.yaml
Allows downloading a remote file to local host.
container - Remote OSDR user's folder, none for working folder.
OSDR 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:
osdr.py upload abc -o path-to-file
osdr.py upload a481 -f -o path-to-file1
osdr.py upload c1cc0000-5d8b-0015-e9e3-08d56a8a2e01 -o path-to-file
Two-way synchronization of local folder with the OSDR 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 OSDR user's folder or none for current working folder.
OSDR 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 OSDR file's version
-ur, --update-remote - Compare by name and last modification time.
Examples:
osdr.py livesync -l abc -r c1cc0000-5d8b-0015-e9e3-08d56a8a2e01
osdr.py livesync -l /path/to/folder -f -r 2e01 -ul
osdr.py livesync -ur
Allows to list all items from OSDR 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:
osdr.py items
osdr.py items -v
osdr.py items -vv
osdr.py items -n png
osdr.py items -q "SubType eq 'Model' and MachineLearningModelInfo.Method eq 'Naive Bayes'" -vv -f json
osdr.py items -q "type=Model,prop.chem=MOST_ABUNDANT_MASS,prop.fields=logs" -s sample_files/short_notations.yaml
osdr.py items -q "SubType eq 'Model' and MachineLearningModelInfo.Fingerprints.Size gt 200" -vv -f yaml
Allows to list models from OSDR using queries. Same as items, but add preset filter SubType eq 'Model'
Examples:
osdr.py models
osdr.py models -v
osdr.py models -vv
osdr.py items -n ada
osdr.py models -q "MachineLearningModelInfo.Method eq 'Naive Bayes'" -vv -f json
osdr.py models -q "type=Model,prop.chem=MOST_ABUNDANT_MASS,prop.fields=logs" -s sample_files/short_notations.yaml
osdr.py models -q "MachineLearningModelInfo.Fingerprints.Size gt 200" -vv -f yaml
Allows to list recordsets from OSDR using queries. Same as items, but add preset filter SubType eq 'Records'
Examples:
osdr.py recordsets
osdr.py recordsets -v
osdr.py recordsets -vv
osdr.py recordsets -n combined
osdr.py recordsets -q "MachineLearningModelInfo.Method eq 'Naive Bayes'" -vv -f json
osdr.py recordsets -q "type=Model,prop.chem=MOST_ABUNDANT_MASS,prop.fields=logs" -s sample_files/short_notations.yaml
osdr.py recordsets -q "MachineLearningModelInfo.Fingerprints.Size gt 200" -vv -f yaml
Allows to run Machine Learning command train.
container - Remote OSDR user's folder, none for working folder.
OSDR 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:
osdr.py train 00130000-ac12-0242-0f11-08d58dbc7b8b -f test1.model -m sample_files/train_sdf_model.yaml
osdr.py train 08d58dbc7b8b -f test2.model -m sample_files/train_sdf_model.yaml
osdr.py train b data_solubility.sdf -f test3.model -m sample_files/train_sdf_model.yaml
osdr.py train data_solubility.sdf -f test4.model -m sample_files/train_sdf_model.yaml
osdr.py train data_solu -f test5.model -m sample_files/train_sdf_model.yaml
Allows to run Machine Learning command predict.
-f - --folder-name - Output folder name
-m - --model - OSDR model's file id.
-r - --recordset - OSDR recordsets's file id.
Examples:
osdr.py predict -f folder.predict -m 7ceef61a-cf7d-41d9-a1f0-19874a2b31e9 -r 000e0000-ac12-0242-36bb-08d585329c5a