Workflow automation
Workflow Automation with CLI
This section of the documentation will help you understand how to use CLI tool to effectively communicate with instance. The commands in this module will allow you to manage projects, upload files, etc.
Commands
General Information
If there are no credentials in the environment variables or no supervisely.env
file, then the login command will be initiated whenever the any command in this section is initialized. The entered data will only be used to execute the current command. To avoid entering this data each time, use the login
command first.
To correctly pass arguments for options in commands that can take several values you need to do follow:
Use
|
as separator for argumentsUsing double quotes (recommend)
Escaping special characters
where the escape character
\
must be placed in front of what is being escaped
Log in
Authorize on a Supervisely instance to access the API to execute commands. Overwrite existing .env
file and override environment variables. A backup file will be created for the .env
file. Backup files will be stored for the last 5 authorizations.
Command options:
-s
/--server-address
- Server address.-l
/--login
- User login.-p
/--password
- User password.
Usage examples
1. Full interactive mode from scratch
2. Check authorization
In case you have already been authorized and have valid data, information about which user on which server is authorized will be shown.
3. Overwrite data / one-command authorization
If you want to change users and keep that authorization, or just want to authorize non-interactively, then use all options at once.
Upload entity files
Upload entity files from a specified directory into a new or existing project or dataset.
$entity_type
- command group name
Possible entity types:
images
videos
volumes
point-clouds
point-cloud-episodes
Command options:
-p
/--paths
- Path to the local directories with files.required
,multiple
-tid
/--team-id
- Team ID.-wid
/--workspace-id
- Workspace ID.-pid
/--project-id
- ID of an existing project.-did
/--dataset-id
- ID of an existing dataset.-pn
/--project-name
- Name of the project to be created.-dn
/--dataset-name
- Name of the dataset to be created.-ep
/--existing-project
- This option is only used in interactive mode, where you choose which of the available projects to upload files to. It is not possible to use with '--project-id', because by using '--project-id' you are already indicating that you are going to upload data into a specific existing project.-ed
/--existing-dataset
- This option is only used in interactive mode, where you choose which of the available datasets to upload files to. It is not possible to use with '--dataset-id', because by using '--dataset-id' you are already indicating that you are going to upload data into a specific existing dataset.
Usage examples
1. Upload via Interactive mode
The team and workspace selection wizard will be initialized. Use the up and down arrow keys on the keyboard to make a selection, and the Enter key to confirm the selection.
The next steps will prompt you to enter the name of the project and the dataset. It is necessary to enter the name of the project, in turn it is not necessary to enter the name of the dataset, in this case the name of the dataset will be the name of the first directory listed.
After the files are successfully uploaded, information with a link to the project will be displayed.
2. Upload via Semi-predefined mode
You can specify any of the IDs to skip some wizard steps.
For example, if you specify only the workspace ID, you will go straight to the step of entering the project name.
If you specify a workspace ID and a dataset name, you will only go through the step of entering the project name.
In case you upload something into an existing project and want to select the project interactively - you need to specify option -ep
And if you add the -pn
parameter to the command above, then the results will be filtered and only projects with the -pn
argument matches in name will be displayed.
In the above example, if no matches are found, you will see a list of all existing projects in the current workspace.
3. Upload via One-command mode
If you are going to automate some processes with scripts that will use CLI tool, it is possible to set all parameters for successful uploading.
In this case, be sure to initiate the login command before calling commands that communicate with the instance.
Upload projects in Supervisely format
Upload projects from a specified directory to instance. Project must have Supervisely format.
$entity_type
- command group name
Command options:
-p
/--paths
- Paths to the local directory or .tar archive with project in Supervisely format. To upload multiple projects, specify multiple paths, e.g. '-p "path/to/project1 | /path/to/project2"'.required
,multiple
-n
/--project-names
- Names of the projects to be created. To upload multiple projects, specify multiple names, e.g. '-n "project1 | project2"'.-tid
/--team-id
- Team ID.-wid
/--workspace-id
- Workspace ID.
Usage examples
1. Upload via Interactive mode
The team and workspace selection wizard will be initialized. Use the up and down arrow keys on the keyboard to make a selection, and the Enter key to confirm the selection.
If you do not specify project names, then they will automatically be named with their folder names.
After the project is successfully uploaded, information with a link to the project will be displayed.
2. Upload via One-command mode
In this case, be sure to initiate the login command before calling commands that communicate with the instance.
Download projects in Supervisely format
Download projects from instance to specified local directory.
$entity_type
- command group name
Command options:
-p
/--save-path
- Path to the local directory where the project(s) will be saved.required
-pid
/--project-ids
- ID of the project(s) to be downloaded. If not specified, you will be able to choose one within wizard.multiple
-did
/--dataset-ids
- ID of the dataset(s) to be downloaded according to the project(s). If not specified, all datasets will be downloaded.multiple
-a
/--archived
- If specified, the project(s) will be downloaded and saved in .tar archive(s).
Usage examples
1. Download via Interactive mode
The team, workspace, and project selection wizard will be initialized. Use the up and down arrow keys on the keyboard to make a selection, and the Enter key to confirm the selection.
Selected project with all datasets will be downloaded. Someday we'll add multiple dataset selection via wizard.
After the project is successfully downloaded, information with path to this project will be displayed.
In case you want to download project and store it as .tar
archive, you need to add option -a
to your call
2. Download via One-command mode
In this case, be sure to initiate the login command before calling commands that communicate with the instance.
If you do not need to download the whole project, you can designate the datasets of this project to be downloaded by separating them with a comma ,
. In this case, if you are downloading multiple projects, you need to designate datasets for each of them with a common separator |
. To download all datasets for a project in such a complex download, specify None
or all
for it.
☝️ Note that the sequence of projects and datasets for them must be consistent across the separator.
Last updated