CLI commands
Available CLI commands and their parameters are listed here. In these examples, the executable is named dhcli
.
If you need to install the CLI, refer to this section.
Run commands
Depending on the shell you are using, you may have to run the CLI with ./dhcli
.
register
register
takes the following parameters:
-e environment
Optional. Name of the environment to register.core_endpoint
Mandatory
dhcli register -e example http://localhost:8080
.dhcore.ini
file (if it doesn't already exist) in the user's home directory, or, if not possible, in the current one. A section will be appended, using the provided environment name (or, if missing, the one returned by the endpoint), containing the environment's configuration. This environment will be set as default, unless one is already set.
list-env
list-env
lists available environments. It takes no parameters.
dhcli list-env
use
use
takes the following parameters:
environment
Mandatory
dhcli use example
login
login
is to be used after registering an environment with the register
command. It takes the following parameters:
-e environment
Optional.
dhcli login -e example
refresh
refresh
is to be used after the login
command, to update access_token
and refresh_token
. It takes the following parameters:
-e environment
Optional
dhcli refresh example
remove
remove
takes the following parameters:
environment
Mandatory
dhcli remove example
init
init
is used to install the platform's Python packages; therefore, Python must be installed. It takes the following parameters:
-e environment
Optional
dhcli init example
create
create
will create an instance of the indicated resource on the platform. It takes the following parameters:
-e environment
Optional-p project
Optional (ignored) when creating projects, mandatory otherwise.-f yaml_file_path
Mandatory when creating resources other than projects, alternative toname
for projects.-n name
Optional (ignored) when creating resources other than projects, alternative toyaml_file_path
for projects.-reset-id
Optional. Boolean. If set, theid
specified in the file is ignored.resource
Mandatory
The type of resource to create is mandatory. The project flag -p
is only mandatory when creating resources other than projects (artifacts, models, etc.). For projects, you may omit the file path and just use the -n
flag to specify the name. The -reset-id
flag, when set, ensures the created object has a randomly-generated ID, ignoring the id
field if present in the input file (this is not relevant to projects).
Create a project:
dhcli create -f samples/project.yaml projects
Create an artifact, while resetting its ID:
dhcli create -p my-project -f samples/artifact.yaml -reset-id artifacts
list
list
returns a list of resources of the specified type. It takes the following parameters:
-e environment
Optional-o output_format
Optional. Acceptsshort
,json
,yaml
. Defaults toshort
.-p project
Optional (ignored) for projects, mandatory otherwise.-n name
Optional. If present, will return all versions of specified resource. If missing, will return the latest version of all matching resources.-k kind
Optional-s state
Optionalresource
Mandatory
output_format
determines how the output will be formatted. The default value, short
, is meant to be used to quickly check resources in the terminal, while json
and yaml
will format the output accordingly, making it ideal to write to file.
List all projects:
dhcli list projects
List all artifacts in a project:
dhcli list -p my-project artifacts
Note that you can easily write the results to file by redirecting standard output:
dhcli list -o yaml -p my-project artifacts > output.yaml
get
get
returns the details of a single resource. It takes the following parameters:
-e environment
Optional-o output_format
Optional. Acceptsshort
,json
,yaml
. Defaults toshort
.-p project
Optional (ignored) for projects, mandatory otherwise.-n name
Ignored ifid
is present, otherwise mandatory and will return the latest version of the specified resource.resource
Mandatoryid
Alternative to-n name
.
Similarly to the list
command, output_format
determines how the output will be formatted. The default value, short
, is meant to be used to quickly check resources in the terminal, while json
and yaml
will format the output accordingly, making it ideal to write to file.
Get project:
dhcli get projects my-project
Get artifact:
dhcli get -p my-project artifacts my-artifact-id
Get artifact and write to file:
dhcli get -o yaml -p my-project artifacts my-artifact-id > output.yaml
update
update
will update a resource with a new definition. It takes the following parameters:
-e environment
Optional-p project
Optional (ignored) for projects, mandatory otherwise.-f yaml_file_path
Mandatoryresource
Mandatoryid
Mandatory
Update a project:
dhcli update -f samples/project.yaml projects my-project
Update an artifact:
dhcli update -p my-project -f samples/artifact.yaml artifacts my-artifact-id
delete
delete
will delete a resource. It takes the following parameters:
-e environment
Optional-p project
Optional (ignored) for projects, mandatory otherwise.-n name
Alternative toid
, will delete all versions of a resource.-y
Optional. Boolean. If omitted, confirmation will be asked.-c
Optional. Boolean, only applies to projects. When set, all resource belonging to the project will also be deleted.resource
Mandatoryid
Alternative toname
, will delete a specific version. For projects, since versions do not apply, this is synonym withid
.
Delete a project and all of its resources:
dhcli delete -c projects my-project
Delete an artifact, skip confirmation:
dhcli delete -p my-project -y artifacts my-artifact-id
run
Creates a run of the specified function. It takes the following parameters:
-e environment
Optional-p project
Mandatory-n name_of_function
Ignored ifid
is specified, otherwise mandatory and will run the latest version of the function.-i id
Alternative to-n name_of_function
.-f yaml_file_path
Optional, can contain additional parameters for the run.task
Mandatory. Must contain a valid task, such aspython+build
.
Create a python+build
run of latest version of my-function
:
dhcli run -p my-project -n my-function python+build
log
Returns the logs of the specified resource. It takes the following parameters:
-e environment
Optional-p project
Mandatory-c container
Optional, ID of the container to read logs from. If not specified, the main container will be picked.-f
Optional, will update the printed logs periodically if set.resource
Mandatoryid
Mandatory
Retrieve and follow logs from the main container of a run:
dhcli log -p my-project run my-run-id
metrics
Returns metrics for the specified resource. It takes the following parameters:
-e environment
Optional-p project
Mandatory-c container
Optional, ID of the container to read metrics from. If not specified, the main container will be picked.resource
Mandatoryid
Mandatory
Retrieve metrics from the main container of a run:
dhcli metrics -p my-project run my-run-id
stop
Stops a resource. It takes the following parameters:
-e environment
Optional-p project
Mandatoryresource
Mandatoryid
Mandatory
Stop a run:
dhcli stop -p my-project run my-run-id
resume
Resumes a resource. It takes the following parameters:
-e environment
Optional-p project
Mandatoryresource
Mandatoryid
Mandatory
Resume a run:
dhcli resume -p my-project run my-run-id
download
Downloads a resource. It takes the following parameters:
-e environment
Optional-p project
Mandatory-n name
Alternative toid
, will download latest version.-o output_filename_or_dir
Optional, base directory for downloaded resources, will be created if missing.resource
Mandatoryid
Alternative to-n name
.
Download an artifact:
dhcli download -p my-project -o downloaded_artifacts artifact my-artifact-id
upload
Uploads a resource. takes the following parameters:
-e environment
Optional-p project
Mandatory-n name
Must be specified when creating a new artifact.-f input_filename_or_dir
Mandatory, path to input file or directory.resource
Mandatoryid
Must be omitted for new artifacts; used to update an existing artifact.
Upload an artifact:
dhcli upload -p my-project -f artifacts/artifact.csv artifact -n my-artifact