Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Guides | Rest API

ML-TANGO edited this pageSep 27, 2023 ·34 revisions

Rest API Guides

ToC


In TANGO, there are two types of container.

  • Leader Container : For example,Project Manager, which makes the other containers start and stop, as well as coordinates them to proceed TANGO workflow.
  • Member Container: All containers except forProject Manager, which perform specific task in whole workflow under control ofLeader Container.

Leader Container (i.e,Project Manager) keeps the project details and coordinates theMember Containers' tasks

  • with call tostart() to start the specific task of the member container, periodically (defined as heart beat frequency, default: 2 sec),
  • with call tostop() to stop the current undergoing task of the member container, and/or
  • with call tostatus_request() of the member container to get the member container status, and

Member Container spontaneously report its task successful completion of failure

  • with callstatus_report(), which is provided and exposed byProject Manager, to notify that it has finished its task successfully or not
classDiagram    direction LR    Project Manager "1" .. "n" Member Container    class ProjectManager {    +status_report()    }    class MemberContainer {    +start()    +stop()    +status_request()    }
Loading

Basic form of the core TANGO REST API consist of scheme, hosts, url-path, and query.

http://<DOCKER_HOST_IP>:<CONTAINER_HOST_PORT>/command?arg1=val1&arg2=val2 ...
ComponentName
http://scheme
<DOCKER_HOST_IP>:<CONTAINER_HOST_PORT>hosts
/commandurl-path
?arg1=val1&arg2=val2queries
  • ? symbol denotes start of query strings
  • mutiple query strings should be separated with& symbol.

TANGO Core Rest APIs Summary

Container TypeExposed REST APIs
Leader Containerhttp://<DOCKER_HOST_IP>:<PROJECT_MANAGER_PORT>/status_report?container_id=<lt container_id>&user_id=<user_id>&project_id=<project_id>&status=<status>
Member Containerhttp://<DOCKER_HOST_IP>:<PROJECT_MANAGER_PORT>/start?user_id=<user_id>&project_id=<project_id>
http://<DOCKER_HOST_IP>:<PROJECT_MANAGER_PORT>/stop?user_id=<user_id>&project_id=<project_id>
http://<DOCKER_HOST_IP>:<PROJECT_MANAGER_PORT>/status_request?user_id=<user_id>&project_id=<project_id>
  • In addition to these core APIs, each container can implement its own private or public APIs if needed.
  • Refer toGuide | TANGO Architecture for usage of the Rest APIs amongLeader Container andMember Containers.

Note on API provider and consumer
Don't confuse between API provider and API consumer. For example,

  • the main consumers ofstatus_report(), provided by theLeader Container (i.e.,Project Manager), areMember Containers.
  • Vice versa, the main consumer ofstart(),stop(), andstatus_request(), provided byMember Containers, is theLeader Container (i.e.,Project Manager)

Core Rest APIs provided by the Project Manager

As a whole workflow coordinator, theLeader Container (Project Manager) should expose the following APIs forMember Containers that report their task status using followingstatus_report() function when their tasks was finished;

classDiagram    class ProjectManager {    +status_report()    }
Loading

status_report()

URI format HTTP GET Message calling from Member Containers.

http://<DOCKER_HOST_IP>:<PROJECT_MANAGER_PORT>/status_report?container_id=<container_id>&user_id=<user_id>&project_id=<project_id>&status=<status>

Equivalent route function form in Python Web Framework (e.g, Django)

status_report(container_id=<container_id>,user_id=<user_id>,project_id=<project_id>,status=<status>)
  • <DOCKER_HOST_IP>: the IP address or DNS Name of the machine that runs Docker Engine
  • <PROJECT_MANAGER_PORT> is port number associated with the Project Manager(e.g, 8085)

Arguments:

container_id indicates the container id who reports the status.possible values for<container_id> are as follows:

  • 'labelling' : Dataset Labeling Tool Container
  • 'bms' : Base Model Select Container
  • 'viz2code' : Model Visualizer Container
  • 'backbone_nas' : Backbone NAS Container
  • 'neck_nas' : Neck NAS Container
  • 'code_gen' : Code Generation Container
  • 'cloud_deploy' : Deployment Container for Cloud target
  • 'ondevice_deploy' : Deployment Container for OnDevice target

user_id,project_id indicate the project user's ID and project ID respectively, which were delivered parameters viastart() fromLeader Container (Project Manager) to theMember Containers.status indicates whether the task in theMember Container is success or failedpossible values for<status> are as follows:

  • 'success' : successful completion of the task in the member container
  • 'failed' : failure of the task in the member container

Returns:

TheLeader Container (Project Manager) should respond with the following HTTP response message;

  • 200 OK, when it receive the status report normally.

Core Rest APIs provided by the Member Containers

AllMember Containers should expose following core APIs forLeader Container (Project Manager) to start/stop theMember Container's task and query on the task status;

classDiagram    class MemberContainer {    +start()    +stop()    +status_request()    }
Loading

start()

TheLeader Container (Project Manager) will callstart(), provided and exposed byMember Container, to make theMember Container start its task associated with<project_id> and<user_id>.

URI format HTTP GET Message calling from Member Containers.

http://<DOCKER_HOST_IP>:<MEMBER_CONTAINER_PORT>/start?user_id=<user_id>&project_id=<project_id>

Equivalent route function form in Python Web Framework (e.g, Django)

start(project_id=<project_id>,user_id=<user_id>)
  • <DOCKER_HOST_IP>: the IP address or DNS Name of the machine that runs Docker Engine
  • <MEMBER_CONTAINER_PORT>: port number associated with the correspondingMember Container
  • <user_id>,project_id indicate the associated project user's ID and project ID respectively for the task.

TheMember Container should respond with the HTTP response message

  • 200 OK with'Content-Type' / 'text/plain'="started", when it start it's task successfully.
  • 200 OK with'Content-Type' / 'text/plain'="error" , when it did not start it's task.

stop()

TheLeader Container (Project Manager) will callstop(), provided and exposed byMember Container, in order to enforce theMember Container stop its current task associated with<project_id> and<user_id>.

URI format HTTP GET Message calling from Member Containers.

http://<DOCKER_HOST_IP>:<MEMBER_CONTAINER_PORT>/stop?user_id=<user_id>&project_id=<project_id>

Equivalent route function form in Python Web Framework (e.g, Django)

stop(project_id=<project_id>, user_id=<user_id>)
  • <DOCKER_HOST_IP>: the IP address or DNS Name of the machine that runs Docker Engine
  • <MEMBER_CONTAINER_PORT>: port number associated with the correspondingMember Container
  • <user_id>,project_id indicate the associated project user's ID and project ID respectively for the task.

TheMember Container should respond with the HTTP response message

  • 200 OK with'Content-Type' / 'text/plain'="finished", when it stops it's task successfully.
  • 200 OK with'Content-Type' / 'text/plain'="error" , when it did not stop it's task.

status_request()

TheLeader Container (Project Manager) wil callsstatus_request(), provided and exposed byMember Container under following two conditions;

  • periodically (defined by its internal frequency) callsstatus_request(project_id=<project_id>, user_id=<user_id>) in order to check the task status in the member container after call to `start(), or
  • instantly callsstatus_request(project_id="", user_id="") in order to check the container readiness check during its project configuration phase before any call tostart().

URI format HTTP GET Message calling from Member Containers.

http://<DOCKER_HOST_IP>:<MEMBER_CONTAINER_PORT>/status_request?user_id=<user_id>&project_id=<project_id>

Equivalent route function form in Python Web Framework (e.g, Django)

status_request(project_id=<project_id>, user_id=<user_id>)
  • <DOCKER_HOST_IP>: the IP address or DNS Name of the machine that runs Docker Engine
  • <MEMBER_CONTAINER_PORT>: port number associated with the correspondingMember Container
    • refer toContiner Port Map Guideuser_id,project_id indicate the project user's ID and project ID respectively.user_id,project_id can be set as empty string (""), ifstatus_request() used for just member containerready status check.

TheMember Container should respond with the HTTP response with body one of the followings;

  • 200 OK with'Content-Type' / 'text/plain'="<status_code>", where<status_code> is one of the following values
    • "ready" : container service ready, when called withstatus_request(project_id="", user_id="").
    • "started" : already started its task.
    • "running" : currently running its task
    • "stopped" : stopped it task for response tostop() call or any internal reason.
    • "failed": fails to complete its task.
    • "completed": finishes its task successfully.

Member Container's States

  stateDiagram-v2  [*] --> Ready  Ready --> Started: start()  Started --> Running  Started --> Failed: Internal Error  Started --> Stopped: stop()  Running --> Stopped: stop()  Running --> Failed: Internal Error  Running --> Completed  Failed --> [*]  Stopped --> [*]  Completed --> Ready
Loading

Extra Rest APIs provided by the Member Containers


Project Manager

TBD


Labelling

TBD


Base Model Select

TBD


Backbone NAS

TBD


Neck NAS

TBD


Cloud Deployment

TBD

OnDevice Deployment

TBD

👉Note

  • This page might contain some wide rendered images. If you want to see the whole contents with wider page, please useWide GitHub extension of Chrome.
  • If you are experiencing the error on rendered images due to the low-bandwith Internet delay, please use F5 function key for refreshing current page.
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp