AppApi

class AppApi[source]

Bases: supervisely.api.task_api.TaskApi

AppApi

Methods

create_task_detached

delete_unused_checkpoints

rtype

Dict

deploy_model

deploy_model_async

rtype

int

download_git_archive

download_git_file

download_import_file

get_context

Get context information by task ID.

get_ecosystem_module_id

get_ecosystem_module_info

get_module_info

get_field

get_fields

get_import_files_list

get_info

get_info_by_id

type id

int

get_list

rtype

List[AppInfo]

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_sessions

rtype

List[SessionInfo]

get_status

rtype

Status

get_training_metrics

get_url

info_sequence

info_tuple_name

initialize

list_checkpoints

raise_for_status

Raise error if Task status is ERROR.

run_dtl

run_inference

run_train

send_request

set_field

rtype

Dict

set_fields

rtype

Dict

set_fields_from_dict

rtype

Dict

set_output_archive

rtype

Dict

set_output_directory

set_output_file_download

rtype

Dict

set_output_project

rtype

Dict

set_output_report

rtype

Dict

start

rtype

SessionInfo

stop

rtype

Status

submit_logs

rtype

None

update_meta

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

upload_dtl_archive

upload_files

wait

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 supervisely.api.module_api.AppInfo

class PluginTaskType

Bases: supervisely.collection.str_enum.StrEnum

PluginTaskType

class RestartPolicy

Bases: supervisely.collection.str_enum.StrEnum

RestartPolicy

class Status

Bases: supervisely.collection.str_enum.StrEnum

Status

create_task_detached(workspace_id, task_type=None)[source]
delete_unused_checkpoints(task_id)
Return type

Dict

deploy_model(agent_id, model_id)[source]
deploy_model_async(agent_id, model_id)
Return type

int

download_git_archive(ecosystem_item_id, app_id, version, save_path, log_progress=True, ext_logger=None)[source]
download_git_file(app_id, version, file_path, save_path)[source]
download_import_file(id, file_path, save_path)[source]
get_context(id)

Get context information by task ID.

Parameters
id : int

Task ID in Supervisely.

Returns

Context information in dict format

Return type

dict

Usage example
import supervisely as sly

task_id = 121230

os.environ['SERVER_ADDRESS'] = 'https://app.supervise.ly'
os.environ['API_TOKEN'] = 'Your Supervisely API Token'
api = sly.Api.from_env()

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_info(module_id, version=None)[source]

get_module_info

Return type

ModuleInfo

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]
Parameters
id : int

int

Return type

AppInfo

Returns

application info by numeric id

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)[source]
Return type

List[AppInfo]

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

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

get_training_metrics(task_id)[source]
get_url(task_id)[source]
static info_sequence()[source]
static info_tuple_name()[source]
initialize(task_id, template, data=None, state=None)[source]
list_checkpoints(task_id)
raise_for_status(status)

Raise error if Task status is ERROR.

Parameters
status : Status

Status object.

Returns

None

Return type

NoneType

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)
set_field(task_id, field, payload, append=False, recursive=False)
Return type

Dict

set_fields(task_id, fields)
Return type

Dict

set_fields_from_dict(task_id, d)
Return type

Dict

set_output_archive(task_id, file_id, file_name, file_url=None)
Return type

Dict

set_output_directory(task_id, file_id, directory_path)
set_output_file_download(task_id, file_id, file_name, file_url=None, download=True)
Return type

Dict

set_output_project(task_id, project_id, project_name=None)
Return type

Dict

set_output_report(task_id, file_id, file_name)
Return type

Dict

stop(id)[source]
Return type

Status

submit_logs(logs)
Return type

None

update_meta(id, data, agent_storage_folder=None, relative_app_dir=None)

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

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