AppService

class AppService(logger=None, task_id=None, server_address=None, agent_token=None, ignore_errors=False, ignore_task_id=False)[source]

Bases: object

Legacy app service runtime that receives commands/events and sends UI/state updates to Supervisely.

Parameters:
logger=None

Logger instance.

task_id : int

Task ID.

server_address : str

Server address.

agent_token : str

Agent token.

ignore_errors : bool

If True, ignore errors.

ignore_task_id : bool

If True, ignore task_id validation.

Methods

call_periodic_function_sync

callback

A decorator that is used to register a view function for a given application command. This does the same thing as add_callback() but is intended for decorator usage:: @app.callback('calc') def calc_func(): return 'Hello World' :param callback_name: the command name as string.

compile_template

consume

consume_sync

get_template_path

handle_exception

handle_message_sync

ignore_errors_and_show_dialog_window

is_stopped

periodic

A decorator that is used to call functions periodically

publish

publish_sync

run

scheduler

send_response

show_modal_window

stop

Attributes

DEFAULT_EVENTS

NETW_CHUNK_SIZE

QUEUE_MAX_SIZE

app_url

data_dir

repo_dir

session_dir

callback(callback_name)[source]

A decorator that is used to register a view function for a given application command. This does the same thing as add_callback() but is intended for decorator usage:

@app.callback('calc')
def calc_func():
    return 'Hello World'
Parameters:
callback_name

the command name as string

periodic(seconds)[source]
A decorator that is used to call functions periodically

@app.periodic(seconds=5) def log_message_periodically():

sly.logger.info(‘periodically message’)

Parameters:
seconds

interval of function call in seconds