Orion Client Command Line Examples

Basics

The following sections provide some basic information on using the Orion Client Command Line Interface.

Authentication

Orion Client must be configured against an instance of Orion for it to be able to access resources.

$ ocli config profile

Note

This configures the default profile, setting the --profile flag allows for configuring multiple profiles.

The following command displays the configuration of a specific profile

$ ocli --profile=default config info

The following command lists the profiles that are configured.

$ ocli config list

Uploading Data

The following example is of using the Orion CLI to upload a file and run it through one of the ETL floes and get the output datasets. Please download drugs.sdf that will be used in the following examples.

Files

$ ocli files upload drugs.sdf

will generate the following output:

Uploaded file with id 1

To list the data files that have been uploaded:

$  ocli files list

will generate the following output:

created                        id  name            owner    project    size  state
---------------------------  ----  ------------  -------  ---------  ------  -------
2018-04-18T23:58:37.393553Z     1  drugs.sdf           1          1   14023  ready

See also

Orion CLI Files section

Datasets

$ ocli datasets upload drugs.sdf

will generate the following output:

Created dataset with Id 1

To list the datasets that have been uploaded:

$  ocli datasets list

will generate the following output:

   id    owner  name       count    created           deleted    description    dirty      project
-----  -------  ---------  -------  ----------------  ---------  -------------  -------  ---------
    1        1  drugs.sdf       42  2019-01-12 19:26                            True             1

See also

Orion CLI Datasets section

Costs

List all ledger cost entries:

$ ocli ledger list
   id  created             owner    project  comment             entry_type    amount      job
-----  ----------------  -------  ---------  ------------------  ------------  --------  -----
17047  2019-05-08 23:07      496       3433  Cost for Job 72074  job           $3.30     72074
17046  2019-05-08 22:59        2      17681  Cost for Job 72149  job           $0.01
17045  2019-05-08 22:59        2      17681  Cost for Job 72148  job           $0.01

List only job cost entries:

$ ocli ledger list entry_type=job
   id  created             owner    project  comment             entry_type    amount      job
-----  ----------------  -------  ---------  ------------------  ------------  --------  -----
17047  2019-05-08 23:07      496       3433  Cost for Job 72074  job           $3.30     72074
17046  2019-05-08 22:59        2      17681  Cost for Job 72149  job           $0.01
17045  2019-05-08 22:59        2      17681  Cost for Job 72148  job           $0.01

List only storage cost entries:

$ ocli ledger list entry_type=storage
   id  created             owner  comment                   entry_type    amount
-----  ----------------  -------  ------------------------  ------------  --------
16971  2019-05-08 21:08        2  Package Storage Costs     storage       $0.81
16970  2019-05-08 21:08        2  File Storage Costs        storage       $0.01
16969  2019-05-08 21:08        3  Package Storage Costs     storage       $0.02

List all costs for a project:

$ ocli ledger list project=3433
   id  created             owner    project  comment             entry_type    amount      job
-----  ----------------  -------  ---------  ------------------  ------------  --------  -----
17047  2019-05-08 23:07      496       3433  Cost for Job 72074  job           $3.30     72074
16920  2019-05-08 21:08      496       3433  Cost for Job 72072  job           $0.01     72072
16680  2019-05-07 16:56      496       3433  Cost for Job 71887  job           $0.01     71887

List all costs for a user:

$ ocli ledger list owner=67
   id  created             owner    project  comment                         entry_type    amount      job
-----  ----------------  -------  ---------  ------------------------------  ------------  --------  -----
16997  2019-05-08 22:31       67         67  Cost for Job 72100              job           $0.01     72100
16965  2019-05-08 21:08       67             Package Storage Costs           storage       $0.01
16758  2019-05-07 20:38       67             Package Storage Costs           storage       $0.01

List all costs starting at a timestamp:

$ ocli ledger list from=2019-05-07T00:00:00Z
   id  created             owner    project  comment             entry_type    amount      job
-----  ----------------  -------  ---------  ------------------  ------------  --------  -----
17047  2019-05-08 23:07      496       3433  Cost for Job 72074  job           $3.30     72074
17046  2019-05-08 22:59        2      17681  Cost for Job 72149  job           $0.01
17045  2019-05-08 22:59        2      17681  Cost for Job 72148  job           $0.01

List all costs within a time range:

$ ocli ledger list from=2019-05-07T00:00:00Z until=2019-05-08T00:00:00Z
   id  created             owner    project  comment             entry_type    amount      job
-----  ----------------  -------  ---------  ------------------  ------------  --------  -----
16799  2019-05-07 23:59        2      17505  Cost for Job 71957  job           $0.02
16798  2019-05-07 23:54        2      17505  Cost for Job 71956  job           $0.01
16797  2019-05-07 23:54        2      17505  Cost for Job 71955  job           $0.01

List all costs for a user, within a time range, ordered by cost (descending):

$ ocli ledger list from=2019-05-07T00:00:00Z until=2019-05-08T00:00:00Z order_by=-amount
   id  created             owner  comment                                                        entry_type    amount      project    job
-----  ----------------  -------  -------------------------------------------------------------  ------------  --------  ---------  -----
16733  2019-05-07 20:38      199  Collection Storage Costs                                       storage       $83.75
16610  2019-05-07 05:44      496  Cost for Job 71827                                             job           $25.20         3433  71827
16729  2019-05-07 20:38      397  Collection Storage Costs                                       storage       $6.53

Miscellaneous

Converting Uploaded File to Dataset Using ETL Floes

First identify the ETL workfloe that can convert a molecule file into a dataset.

$ ocli --json workfloes list tags=ETL

will generate the following output:

{
  "results": [
    {
      "id": 1,
      "name": "File to Dataset",
      "owner": 2,
      "package": 1,
      "specification": {},
      "state": "ready",
      "uuid": "8b968c6a-0373-4bc3-a974-abd3b701bbab",
      "version": "0.0.8a1"
    }
  ]
}

Pass the workfloe id and file id to the following command to start a job to convert the file to a dataset.

$ ocli --json jobs start <workfloe_id> 'ETL Floe' --wait --file=<file_id> --dataset="Output Dataset"
# Take the workfloe id from the last call
$ ocli --json jobs start <workfloe_id> 'ETL Floe' --wait --file=<file_id> --dataset="Output Dataset"

# Job id is from the output of the previous command
$ ocli --json datasets list tags='Job <job_id>'