本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 AWS Panorama API 管理應用程式
您可以使用 AWS Panorama API 監控和管理應用程式。
檢視應用程式
若要取得在 設備上執行的應用程式清單,請使用 ListApplicationInstances API。
$
aws panorama list-application-instances
"ApplicationInstances": [ { "Name": "aws-panorama-sample", "ApplicationInstanceId": "applicationInstance-ddaxxmpl2z7bg74ywutd7byxuq", "DefaultRuntimeContextDevice": "device-4tafxmplhtmzabv5lsacba4ere", "DefaultRuntimeContextDeviceName": "my-appliance", "Description": "command-line deploy", "Status": "DEPLOYMENT_SUCCEEDED", "HealthStatus": "RUNNING", "StatusDescription": "Application deployed successfully.", "CreatedTime": 1661902051.925, "Arn": "arn:aws:panorama:us-east-2:123456789012:applicationInstance/applicationInstance-ddaxxmpl2z7bg74ywutd7byxuq", "Tags": { "client": "sample" } }, ] }
若要取得應用程式執行個體節點的詳細資訊,請使用 ListApplicationInstanceNodeInstances API。
$
aws panorama list-application-instance-node-instances --application-instance-id applicationInstance-ddaxxmpl2z7bg74ywutd7byxuq
{ "NodeInstances": [ { "NodeInstanceId": "code_node", "NodeId": "SAMPLE_CODE-1.0-fd3dxmpl-interface", "PackageName": "SAMPLE_CODE", "PackageVersion": "1.0", "PackagePatchVersion": "fd3dxmpl2bdfa41e6fe1be290a79dd2c29cf014eadf7416d861ce7715ad5e8a8", "NodeName": "interface", "CurrentStatus": "RUNNING" }, { "NodeInstanceId": "camera_node_override", "NodeId": "warehouse-floor-1.0-9eabxmpl-warehouse-floor", "PackageName": "warehouse-floor", "PackageVersion": "1.0", "PackagePatchVersion": "9eabxmple89f0f8b2f2852cca2a6e7971aa38f1629a210d069045e83697e42a7", "NodeName": "warehouse-floor", "CurrentStatus": "RUNNING" }, { "NodeInstanceId": "output_node", "NodeId": "hdmi_data_sink-1.0-9c23xmpl-hdmi0", "PackageName": "hdmi_data_sink", "PackageVersion": "1.0", "PackagePatchVersion": "9c23xmplc4c98b92baea4af676c8b16063d17945a3f6bd8f83f4ff5aa0d0b394", "NodeName": "hdmi0", "CurrentStatus": "RUNNING" }, { "NodeInstanceId": "model_node", "NodeId": "SQUEEZENET_PYTORCH-1.0-5d3cabda-interface", "PackageName": "SQUEEZENET_PYTORCH", "PackageVersion": "1.0", "PackagePatchVersion": "5d3cxmplb7113faa1d130f97f619655d8ca12787c751851a0e155e50eb5e3e96", "NodeName": "interface", "CurrentStatus": "RUNNING" } ] }
管理攝影機串流
您可以使用 SignalApplicationInstanceNodeInstances API 暫停和繼續攝影機串流節點。
$
aws panorama signal-application-instance-node-instances --application-instance-id applicationInstance-ddaxxmpl2z7bg74ywutd7byxuq \ --node-signals '[{"NodeInstanceId": "camera_node_override", "Signal": "PAUSE"}]'
{ "ApplicationInstanceId": "applicationInstance-ddaxxmpl2z7bg74ywutd7byxuq" }
在指令碼中,您可以取得節點清單,然後選擇一個以互動方式暫停或繼續。
範例 pause-camera.sh – 用量
my-app$
./pause-camera.sh
Getting nodes... 0: SAMPLE_CODE RUNNING 1: warehouse-floor RUNNING 2: hdmi_data_sink RUNNING 3: entrance-north PAUSED 4: SQUEEZENET_PYTORCH RUNNING Choose a node1
Signalling node warehouse-floor + aws panorama signal-application-instance-node-instances --application-instance-id applicationInstance-r3a7xmplcbmpjqeds7vj4b6pjy --node-signals '[{"NodeInstanceId": "warehouse-floor", "Signal": "PAUSE"}]' { "ApplicationInstanceId": "applicationInstance-r3a7xmplcbmpjqeds7vj4b6pjy" }
透過暫停和恢復攝影機節點,您可以循環瀏覽比可同時處理更多數量的攝影機串流。若要這樣做,請將多個攝影機串流映射到覆寫資訊清單中的相同輸入節點。
在下列範例中,覆寫資訊清單會將兩個攝影機串流warehouse-floor
和 映射entrance-north
至相同的輸入節點 (camera_node
)。當應用程式啟動且entrance-north
節點等待訊號開啟時,warehouse-floor
串流會處於作用中狀態。
範例 override-multicam.json
"nodeGraphOverrides": {
"nodes": [
{
"name": "warehouse-floor",
"interface": "123456789012::warehouse-floor.warehouse-floor",
"launch": "onAppStart"
},
{
"name": "entrance-north",
"interface": "123456789012::entrance-north.entrance-north",
"launch": "onSignal"
},
...
"packages": [
{
"name": "123456789012::warehouse-floor",
"version": "1.0"
},
{
"name": "123456789012::entrance-north",
"version": "1.0"
}
],
"nodeOverrides": [
{
"replace": "camera_node",
"with": [
{
"name": "warehouse-floor"
},
{
"name": "entrance-north"
}
]
}
如需使用 API 部署的詳細資訊,請參閱 自動化應用程式部署。