AppApi

class AppApi(api)[source]

Bases: TaskApi

API for launching and managing Supervisely Apps (built on top of TaskApi).

Parameters:
api

Api object to use for API connection.

Methods

convert_info_to_json

Convert information about an entity to a dictionary.

create_task_detached

create_task_detached

deploy_model

deploy_model

download_git_archive

download_git_archive

download_git_file

Download a file from app repository.

download_import_file

download_import_file

find_module_id_by_app_name

get_context

Get context information by Application Task ID.

get_ecosystem_module_id

Returns ecosystem module id by slug.

get_ecosystem_module_info

Returns ModuleInfo object by module id and version.

get_field

get_field

get_fields

get_fields

get_import_files_list

get_import_files_list

get_info

get_info

get_info_by_id

Get application info by numeric ID.

get_list

Get list of applications for the specified team.

get_list_all_pages

Get list of all or limited quantity entities from the Supervisely server.

get_list_all_pages_generator

This generator function retrieves a list of all or a limited quantity of entities from the Supervisely server, yielding batches of entities as they are retrieved

get_list_ecosystem_modules

get_list_idx_page_async

Get the list of items for a given page number.

get_list_page_generator_async

Yields list of images in dataset asynchronously page by page.

get_logs

Returns the log entries for the given task ID in JSON format.

get_session_token

Get session token for the app with specified slug.

get_sessions

Get list of sessions (tasks) for the specified team and module.

get_status

get_training_metrics

get_training_metrics

get_url

get_url

info_sequence

Sequence of fields that are returned by the API to represent AppInfo.

info_tuple_name

Name of the tuple that represents AppInfo.

initialize

initialize

is_ready

Check if the task is ready.

is_ready_for_api_calls

Checks if app is ready for API calls.

is_running

Check if the task is running.

raise_for_status

Raise error if Application Task status is ERROR.

run_dtl

run_dtl

run_inference

run_inference

run_train

run_train

send_request

send_request

set_field

set_field

set_fields

set_fields

set_fields_from_dict

set_fields_from_dict

set_output_archive

set_output_archive

set_output_directory

set_output_directory

set_output_error

Set custom error message to the task output.

set_output_experiment

Sets output for the task with experiment info.

set_output_file_download

set_output_file_download

set_output_project

set_output_project

set_output_report

set_output_report

set_output_text

Set custom text message to the task output.

start

Start a new application session (task).

stop

stop

submit_logs

submit_logs

update_meta

Update given task metadata :param id: int - task id :param data: dict - meta data to update

update_status

Sets the specified status for the task.

upload_files

upload_files

wait

wait

wait_until_ready_for_api_calls

Waits until app is ready for API calls.

Attributes

MAX_WAIT_ATTEMPTS

Maximum number of attempts that will be made to wait for a certain condition to be met.

WAIT_ATTEMPT_TIMEOUT_SEC

Number of seconds for intervals between attempts.

InfoType

alias of AppInfo

class PluginTaskType(*values)

Bases: StrEnum

Task type for plugin-based tasks (train/inference/smarttool/etc.).

classmethod has_value(value)

Check if a value is in the enum.

Parameters:
value : str

Value to check.

Returns:

True if value is in the enum, False otherwise.

Return type:

bool

classmethod values()

Get all values of the enum.

class RestartPolicy(*values)

Bases: StrEnum

Task restart policy used for app deployments.

classmethod has_value(value)

Check if a value is in the enum.

Parameters:
value : str

Value to check.

Returns:

True if value is in the enum, False otherwise.

Return type:

bool

classmethod values()

Get all values of the enum.

class Status(*values)

Bases: StrEnum

Task lifecycle status values returned by the API.

classmethod has_value(value)

Check if a value is in the enum.

Parameters:
value : str

Value to check.

Returns:

True if value is in the enum, False otherwise.

Return type:

bool

classmethod values()

Get all values of the enum.

CONSUMED = 'consumed'

Application is consumed by an agent

DEPLOYED = 'deployed'

Only for Plugins

ERROR = 'error'

Application has finished with an error

FINISHED = 'finished'

Application has finished successfully

QUEUED = 'queued'

Application is queued for execution

STARTED = 'started'

Application has been started

STOPPED = 'stopped'

Application has been stopped

TERMINATING = 'terminating'

Application is being terminated

class Workflow(api)[source]

Bases: object

Workflow functionality for connecting project states and task application sessions.

Parameters:
api

Api object to use for API connection.

add_input_dataset(dataset, task_id=None, meta=None)[source]

Add input type “dataset” to the workflow node. This type is used to show that the application has used the specified dataset. Customization of the dataset node is not supported and will be ignored. You can only customize the main node with this method.

Parameters:
dataset

Dataset ID or DatasetInfo object.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_input_file(file, model_weight=False, task_id=None, meta=None)[source]

Add input type “file” to the workflow node. This type is used to show that the application has used the specified file.

Parameters:
file

File ID, FileInfo object or file path in team Files.

model_weight : bool

Flag to indicate if the file is a model weight.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_input_folder(path, task_id=None, meta=None)[source]

Add input type “folder” to the workflow node. Path to the folder is a path in Team Files. This type is used to show that the application has used files from the specified folder.

Parameters:
path : str

Path to the folder in Team Files.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_input_job(id, task_id=None, meta=None)[source]

Add input type “job” to the workflow node. Job is a Labeling Job. This type indicates that the application has utilized a labeling job during its operation.

Parameters:
id : int

Labeling Job ID.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_input_project(project=None, version_id=None, version_num=None, task_id=None, meta=None)[source]

Add input type “project” to the workflow node. The project version can be specified to indicate that the project version was used especially for this task. Arguments project and version_id are mutually exclusive. If both are specified, version_id will be used. Argument version_num can only be used in conjunction with the project. This type is used to show that the application has used the specified project. Customization of the project node is not supported and will be ignored. You can only customize the main node with this method.

Parameters:
project=None

Project ID or ProjectInfo object.

version_id : Optional[int]

Version ID of the project.

version_num : Optional[int]

Version number of the project. This argument can only be used in conjunction with the project.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_input_task(input_task_id, task_id=None, meta=None)[source]

Add input type “task” to the workflow node. This type usually indicates that the one application has used another application for its work.

Parameters:
input_task_id : int

Task ID that is used as input.

task_id : Optional[int]

Task ID of the node. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_output_app(task_id=None, meta=None)[source]

Add output type “app_session” to the workflow node. This type is used to show that the application has an offline session in which you can find the result of its work.

Parameters:
task_id : Optional[int]

App Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_output_dataset(dataset, task_id=None, meta=None)[source]

Add output type “dataset” to the workflow node. This type is used to show that the application has created a dataset with the result of its work. Customization of the dataset node is not supported and will be ignored. You can only customize the main node with this method.

Parameters:
dataset

Dataset ID or DatasetInfo object.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_output_file(file, model_weight=False, task_id=None, meta=None)[source]

Add output type “file” to the workflow node. This type is used to show that the application has created a file with the result of its work.

Parameters:
file

File ID or FileInfo object.

model_weight : bool

Flag to indicate if the file is a model weight.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_output_folder(path, task_id=None, meta=None)[source]

Add output type “folder” to the workflow node. Path to the folder is a path in Team Files. This type is used to show that the application has created a folder with the result files of its work.

Parameters:
path : str

Path to the folder.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_output_job(id, task_id=None, meta=None)[source]

Add output type “job” to the workflow node. Job is a Labeling Job. This type is used to show that the application has created a labeling job with the result of its work.

Parameters:
id : int

Labeling Job ID.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_output_project(project, version_id=None, task_id=None, meta=None)[source]

Add output type “project” to the workflow node. The project version can be specified with “version” argument to indicate that the project version was created especially as result of this task. This type is used to show that the application has created a project with the result of its work. Customization of the project node is not supported and will be ignored. You can only customize the main node with this method.

Parameters:
project

Project ID or ProjectInfo object.

version_id : Optional[int]

Version ID of the project.

task_id : Optional[int]

Task ID. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

add_output_task(output_task_id, task_id=None, meta=None)[source]

Add output type “task” to the workflow node. This type is used to show that the application has created a task with the result of its work.

Parameters:
output_task_id : int

Created task ID.

task_id : Optional[int]

Task ID of the node. If not specified, the task ID will be determined automatically.

meta=None

Additional data for node customization.

Returns:

Response from the API.

Return type:

dict

check_instance_compatibility()[source]

Decorator to check instance compatibility with workflow features. If the instance is not compatible, the function will not be executed.

Parameters:
min_instance_version : Optional[str]

Determine the minimum instance version that accepts the workflow method. If not specified, the minimum version will be “6.9.31”.

disable()[source]

Disable the workflow functionality.

enable()[source]

Enable the workflow functionality.

is_enabled()[source]

Check if the workflow functionality is enabled.

classmethod convert_info_to_json(info)

Convert information about an entity to a dictionary.

Parameters:
info : NamedTuple

Information about the entity.

Returns:

Dictionary with information about the entity.

Return type:

dict

static info_sequence()[source]

Sequence of fields that are returned by the API to represent AppInfo.

static info_tuple_name()[source]

Name of the tuple that represents AppInfo.

create_task_detached(workspace_id, task_type=None)[source]
deploy_model(agent_id, model_id)[source]
download_git_archive(ecosystem_item_id, app_id, version, save_path, log_progress=True, ext_logger=None)[source]
download_git_file(module_id, save_path, app_id=None, version=None, file_path=None, file_key=None, log_progress=True, ext_logger=None)[source]

Download a file from app repository. File should be added in the app config under files key.

Parameters:
module_id : int

ID of the module

save_path : str

Path to save the file

app_id : int

ID of the app

version : str

Version of the app

file_path : str

Path to the file in the app github repository

file_key : str

Key of the file in the app github repository

log_progress : bool

If True, will log the progress of the download

ext_logger : Logger

Logger to use for logging

Returns:

None

Return type:

None

download_import_file(id, file_path, save_path)[source]
get_context(id)

Get context information by Application Task ID.

Parameters:
id : int

Task ID in Supervisely.

Returns:

Context information in dict format

Return type:

dict

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

task_id = 121230
context = api.task.get_context(task_id)
print(context)
# Output: {
#     "team": {
#         "id": 16087,
#         "name": "alexxx"
#     },
#     "workspace": {
#         "id": 23821,
#         "name": "my_super_workspace"
#     }
# }
get_ecosystem_module_id(slug)[source]

Returns ecosystem module id by slug. E.g. slug = “supervisely-ecosystem/export-to-supervisely-format”. Slug can be obtained from the application URL in browser.

Parameters:
slug : str

module slug, starts with “supervisely-ecosystem/”

Returns:

ID of the module

Return type:

int

Raises:
  • KeyError – if module with given slug not found

  • KeyError – if there are multiple modules with the same slug

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
load_dotenv(os.path.expanduser("~/supervisely.env"))
api = sly.Api.from_env()

slug = "supervisely-ecosystem/export-to-supervisely-format"
module_id = api.app.get_ecosystem_module_id(slug)
print(f"Module {slug} has id {module_id}")
# Module supervisely-ecosystem/export-to-supervisely-format has id 81
get_ecosystem_module_info(module_id=None, version=None, slug=None)[source]

Returns ModuleInfo object by module id and version.

Parameters:
module_id : int

ID of the module

version : Optional[str]

version of the module, e.g. “v1.0.0”

slug : Optional[str]

slug of the module, e.g. “supervisely-ecosystem/export-to-supervisely-format”

Raises:
  • ValueError – if both module_id and slug are None

  • ValueError – if both module_id and slug are provided

Returns:

ModuleInfo object

Return type:

ModuleInfo

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
load_dotenv(os.path.expanduser("~/supervisely.env"))
api = sly.Api.from_env()

module_id = 81
module_info = api.app.get_ecosystem_module_info(module_id)
get_field(task_id, field)
get_fields(task_id, fields)
get_import_files_list(id)[source]
get_info(module_id, version=None)[source]
get_info_by_id(id)[source]

Get application info by numeric ID.

Parameters:
id : int

Application ID.

Returns:

Application info by numeric ID.

Return type:

AppInfo

get_list(team_id, filter=None, context=None, repository_key=None, show_disabled=False, integrated_into=None, session_tags=None, only_running=False, with_shared=True, force_all_sessions=True)[source]

Get list of applications for the specified team.

Parameters:
team_id : int

Team ID.

filter : Optional[List[dict]]

List of filters.

context : Optional[List[str]]

List of application contexts.

repository_key : Optional[str]

Repository key.

show_disabled : bool

Show disabled applications.

integrated_into : Optional[List[str]]

Destination(s) of the application. Available values:

  • panel

  • files

  • standalone

  • data_commander

  • image_annotation_tool

  • video_annotation_tool

  • dicom_annotation_tool

  • pointcloud_annotation_tool

session_tags : Optional[List[str]]

list of session tags

only_running : bool

show only running applications (status is one of “queued”/”consumed”/”started”/”deployed”)

with_shared : bool

include shared applications

force_all_sessions : bool

force to get all sessions (tasks) for each application. Works only if only_running is False. Note that it can be a long operation.

Returns:

list of applications

Return type:

List[AppInfo]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

team_id = 447

# Get list of all applications (including all tasks in `tasks` field)
apps = api.app.get_list(team_id=team_id)

# Get list of all applications (only running tasks included in `tasks` field)
apps = api.app.get_list(team_id=team_id, force_all_sessions=False)

# Get list of only running applications
apps = api.app.get_list(team_id=team_id, only_running=True)

# Get list of applications with specific filters
filter = [{"field": "moduleId", "operator": "=", "value": 428}]
apps = api.app.get_list(team_id=team_id, filter=filter)
get_list_all_pages(method, data, progress_cb=None, convert_json_info_cb=None, limit=None, return_first_response=False)

Get list of all or limited quantity entities from the Supervisely server.

Parameters:
method : str

Request method name

data : dict

Dictionary with request body info

progress_cb : Progress, optional

Function for tracking download progress.

convert_json_info_cb : Callable, optional

Function for convert json info

limit : int, optional

Number of entity to retrieve

return_first_response : bool, optional

Specify if return first response

Returns:

List of entities.

Return type:

List[dict]

get_list_all_pages_generator(method, data, progress_cb=None, convert_json_info_cb=None, limit=None, return_first_response=False)

This generator function retrieves a list of all or a limited quantity of entities from the Supervisely server, yielding batches of entities as they are retrieved

Parameters:
method : str

Request method name

data : dict

Dictionary with request body info

progress_cb : Progress, optional

Function for tracking download progress.

convert_json_info_cb : Callable, optional

Function for convert json info

limit : int, optional

Number of entity to retrieve

return_first_response : bool, optional

Specify if return first response

async get_list_idx_page_async(method, data)

Get the list of items for a given page number. Page number is specified in the data dictionary.

Parameters:
method : str

Method to call for listing items.

data : dict

Data to pass to the API method.

Returns:

List of items.

Return type:

Tuple[int, List[NamedTuple]]

async get_list_page_generator_async(method, data, pages_count=None, semaphore=None)

Yields list of images in dataset asynchronously page by page.

Parameters:
method : str

Method to call for listing items.

data : dict

Data to pass to the API method.

pages_count : int, optional

Preferred number of pages to retrieve if used with a per_page limit. Will be automatically adjusted if the pagesCount differs from the requested number.

semaphore=None

Semaphore for limiting the number of simultaneous requests.

Returns:

List of images in dataset.

Return type:

AsyncGenerator[List[ImageInfo]]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

method = 'images.list'
data = {'datasetId': 123456}

loop = sly.utils.get_or_create_event_loop()
images = loop.run_until_complete(api.image.get_list_generator_async(method, data))
get_logs(task_id, since_time=None, limit=None)

Returns the log entries for the given task ID in JSON format.

Parameters:
task_id : int

Task ID in Supervisely.

since_time : Optional[str]

Optional ISO 8601 formatted timestamp to filter logs that were created after the specified time.

limit : Optional[int]

Optional integer to limit the number of log entries returned.

Returns:

List of log entries in JSON format.

Return type:

List[Dict]

Usage Example:
since_time = "2026-03-30T14:28:58.816Z"
limit = 100
task_id = 12345
logs = api.task.get_logs(task_id, since_time=since_time, limit=limit)
for log_entry in logs:
    print(log_entry) # {'level': 'info', 'message': "Added object class... 'timestamp': '2026-03-30T14:28:56.525Z', 'task_id': 58595}
get_session_token(slug)[source]

Get session token for the app with specified slug.

Parameters:
slug : str

Slug of the app, e.g. “supervisely-ecosystem/hello-world-app”.

Returns:

Session token for the app.

Return type:

str

get_sessions(team_id, module_id, show_disabled=False, session_name=None, statuses=None, with_shared=False)[source]

Get list of sessions (tasks) for the specified team and module.

Parameters:
team_id : int

team id

module_id : int

application module id

show_disabled : bool

show disabled applications

session_name : Optional[str]

session name to filter sessions

statuses=None

list of statuses to filter sessions

with_shared : bool

include shared application sessions

Returns:

List of sessions

Return type:

List[SessionInfo]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

team_id = 447
module_id = 428

# Get list of all sessions for the specified team and module ID
sessions = api.app.get_sessions(team_id, module_id)

# Get list of sessions with specific statuses
from supervisely.api.task_api import TaskApi

statuses = [TaskApi.Status.STARTED]
sessions = api.app.get_sessions(team_id, module_id, statuses=statuses)
get_training_metrics(task_id)[source]
get_url(task_id)[source]
initialize(task_id, template, data=None, state=None)[source]
is_ready(task_id)

Check if the task is ready.

Parameters:
task_id : int

Task ID in Supervisely.

Returns:

True if the task is ready, False otherwise.

Return type:

bool

is_ready_for_api_calls(task_id)[source]

Checks if app is ready for API calls. :param task_id: ID of the running task. :type task_id: int :returns: True if app is ready for API calls, False otherwise.

is_running(task_id)

Check if the task is running.

Parameters:
task_id : int

Task ID in Supervisely.

Returns:

True if the task is running, False otherwise.

Return type:

bool

raise_for_status(status)

Raise error if Application Task status is ERROR.

Parameters:
status : Status

Status object.

Returns:

None

Return type:

None

run_dtl(workspace_id, dtl_graph, agent_id=None)[source]
run_inference(agent_id, input_project_id, input_model_id, result_project_name, inference_config=None)[source]
run_train(agent_id, input_project_id, input_model_id, result_nn_name, train_config=None)[source]
send_request(task_id, method, data, context={}, skip_response=False, timeout=60, outside_request=True, retries=10, raise_error=False)
set_field(task_id, field, payload, append=False, recursive=False)
set_fields(task_id, fields)
set_fields_from_dict(task_id, d)
set_output_archive(task_id, file_id, file_name, file_url=None)
set_output_directory(task_id, file_id, directory_path)
set_output_error(task_id, title, description=None, show_logs=True)

Set custom error message to the task output.

Parameters:
task_id : int

Application task ID.

title : str

Error message to be displayed in the task output.

description : Optional[str]

Description to be displayed in the task output.

show_logs : Optional[bool], default True

If True, the link to the task logs will be displayed in the task output.

Returns:

Response JSON.

Return type:

Dict

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

task_id = 12345
title = "Something went wrong"
description = "Please check the task logs"
show_logs = True
api.task.set_output_error(task_id, title, description, show_logs)
set_output_experiment(task_id, experiment_info)

Sets output for the task with experiment info.

Parameters:
task_id : int

Task ID in Supervisely.

experiment_info : dict

Experiment info from TrainApp. See class ExperimentInfo.

Returns:

Server response JSON.

Return type:

dict

Usage Example:
experiment_info = {
    "experiment_name": "247 Lemons RT-DETRv2-M",
    "framework_name": "RT-DETRv2",
    "model_name": "RT-DETRv2-M",
    "task_type": "object detection",
    "project_id": 76,
    "project_version": {"id": 222, "version": 4},
    "task_id": 247,
    "model_files": {"config": "model_config.yml"},
    "checkpoints": [
        "checkpoints/best.pth",
        "checkpoints/checkpoint0025.pth",
        "checkpoints/checkpoint0050.pth",
        "checkpoints/last.pth",
    ],
    "best_checkpoint": "best.pth",
    "export": {"ONNXRuntime": "export/best.onnx"},
    "app_state": "app_state.json",
    "model_meta": "model_meta.json",
    "train_val_split": "train_val_split.json",
    "train_size": 4,
    "val_size": 2,
    "train_collection_id": 530,
    "val_collection_id": 531,
    "hyperparameters": "hyperparameters.yaml",
    "artifacts_dir": "/experiments/76_Lemons/247_RT-DETRv2/",
    "datetime": "2025-01-22 18:13:43",
    "evaluation_report_id": 12961,
    "evaluation_report_link": "https://app.supervisely.com/model-benchmark?id=12961",
    "evaluation_metrics": {"mAP": 0.994, "AP50": 1.0, "AP75": 1.0},  # and other metrics
    "primary_metric": "mAP",
    "logs": {"type": "tensorboard", "link": "/experiments/76_Lemons/247_RT-DETRv2/logs/"},
}
set_output_file_download(task_id, file_id, file_name, file_url=None, download=True)
set_output_project(task_id, project_id, project_name=None, project_preview=None)
set_output_report(task_id, file_id, file_name, description='Report')
set_output_text(task_id, title, description=None, show_logs=False, zmdi_icon='zmdi-comment-alt-text', icon_color='#33c94c', background_color='#d9f7e4')

Set custom text message to the task output.

Parameters:
task_id : int

Application task ID.

title : str

Text message to be displayed in the task output.

description : Optional[str]

Description to be displayed in the task output.

show_logs : Optional[bool], default False

If True, the link to the task logs will be displayed in the task output.

zmdi_icon : Optional[str], default "zmdi-comment-alt-text"

Icon class name from Material Design Icons set (ZMDI).

icon_color : Optional[str], default "#33c94c" (nearest Duron Jolly Green)

Icon color in HEX format.

background_color : Optional[str], default "#d9f7e4" (Cosmic Latte)

Background color in HEX format.

Returns:

Response JSON.

Return type:

Dict

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

task_id = 12345
title = "Task is finished"
api.task.set_output_text(task_id, title)
start(agent_id, app_id=None, workspace_id=None, description='', params=None, log_level='info', users_id=None, app_version=None, is_branch=False, task_name='run-from-python', restart_policy='never', proxy_keep_url=False, module_id=None, redirect_requests={}, kubernetes_settings=None, multi_user_session=False)[source]

Start a new application session (task).

Parameters:
agent_id : int

ID of the agent to run the task on. If set None - the task will be run on the any available agent.

app_id : Optional[int]

Deprecated. Use module_id instead.

workspace_id : Optional[int]

ID of the workspace to run the task in. If not specified, the default workspace will be used.

description : str

Task description which will be shown in UI.

params : Optional[dict]

Task parameters which will be passed to the application.

log_level : Literal["info", "debug", "warning", "error"]

Log level for the task. Default is “info”.

users_id : Optional[int]

User ID for which will be created an instance of the application.

app_version : Optional[str]

Application version e.g. “v1.0.0” or branch name e.g. “dev”.

is_branch : bool

If the application version is a branch name, set this parameter to True.

task_name : str

Task name which will be shown in UI. Default is “run-from-python”.

restart_policy : str

When the app should be restarted: never or if error occurred.

proxy_keep_url : bool

For internal usage only.

module_id : Optional[int]

Module ID. Can be obtained from the apps page in UI.

redirect_requests : dict

For internal usage only in Develop and Debug mode.

kubernetes_settings=None

Kubernetes settings for the task. If not specified, default settings will be used.

multi_user_session : bool, default is False

If True, the application session will be created as multi-user. In this case, multiple users will be able to connect to the same application session. All users will have separate application states. Available only for applications that support multi-user sessions.

Returns:

SessionInfo object with information about the started task.

Return type:

SessionInfo

Raises:
  • ValueError – If both app_id and module_id are not provided.

  • ValueError – If both app_id and module_id are provided.

stop(id)[source]
submit_logs(logs)
update_meta(id, data, agent_storage_folder=None, relative_app_dir=None)

Update given task metadata :param id: int - task id :param data: dict - meta data to update

update_status(task_id, status)

Sets the specified status for the task.

Parameters:
task_id : int

Task ID in Supervisely.

status

Task status to set.

Raises:

ValueError – If the status value is not allowed.

upload_files(task_id, abs_paths, names, progress_cb=None)[source]
wait(id, target_status, attempts=None, attempt_delay_sec=None)[source]
wait_until_ready_for_api_calls(task_id, attempts=10, attempt_delay_sec=10)[source]

Waits until app is ready for API calls.

Parameters:
task_id : int

ID of the running task.

attempts : int

Number of attempts to check if app is ready for API calls.

attempt_delay_sec : int

Delay between attempts in seconds.

Returns:

True if app is ready for API calls, False otherwise.