使用 AWS Panorama API 管理應用程式 - AWS Panorama

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 AWS Panorama API 管理應用程式

您可以使用 AWS Panorama 圖像來監控和管理應用程式。

檢視

若要取得在設備上執行的應用程式清單,請使用 ListApplicationInstancesAPI。

$ 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" } }, ] }

要獲取有關應用程序實例節點的更多詳細信息,請使用 ListApplicationInstanceNodeInstancesAPI。

$ 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" } ] }

管理攝影機串流

您可以使用 SignalApplicationInstanceNodeInstancesAPI 暫停和繼續攝影機串流節點。

$ 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 node 1 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" }

透過暫停和恢復攝影機節點,您可以在比同時處理更多的攝影機串流中循環。為此,請將多個攝像機流映射到覆蓋清單中的相同輸入節點。

在下列範例中,覆寫資訊清單會對應兩個攝影機資料流,entrance-northwarehouse-floor及相同的輸入節點 (camera_node)。當應用程序啟動並且entrance-north節點等待信號打開時,warehouse-floor流處於活動狀態。

範例 覆蓋多點運行
"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 部署的詳細資訊,請參閱自動化應用部署