Contents ======== * `Contents <#contents>`__ * `Software Trigger Utility for VideoIngestion Module <#software-trigger-utility-for-videoingestion-module>`__ * `Software Trigger Utilily Prerequisites <#software-trigger-utilily-prerequisites>`__ * `Configuration File <#configuration-file>`__ * `Running Software Trigger Utility <#running-softwaretriggerutility>`__ * `Usage of Software Trigger Utility <#usageofsoftwaretriggerutility>`__ Software Trigger Utility for VideoIngestion Module -------------------------------------------------- This utility is used for invoking various software trigger features of VideoIngestion. The currently supported triggers for the VideoIngestion module are: #. START INGESTION-to start the ingestor #. STOP_INGESTION-to stop the ingestor #. SNAPSHOT-to get a frame snapshot, which feeds one frame into the video data pipeline. Software Trigger Utilily Prerequisites ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SWTriggerUtility expects a set of config, interfaces, and public private keys to be present in ETCD as a prerequisite. To achieve this, ensure an entry for SWTriggerUtility with its relative path from the IEdgeInsights(\ ``[WORK_DIR]/IEdgeInsights/``\ ) directory is set in any of the .yml files present in build/usecases(\ ``[WORK_DIR]/IEdgeInsights/build/usecases``\ ) directory. * An example has been provided below to add the entry in video-streaming.yml(\ ``[WORK_DIR]/IEdgeInsights/build/usecases/video-streaming.yml``\ ) .. code-block:: yml AppContexts: ---snip--- - tools/SWTriggerUtility Configuration File ^^^^^^^^^^^^^^^^^^ **config.json** is the configuration file used for sw_trigger_utility. .. list-table:: :header-rows: 1 * - Field - Meaning - Type of the value * - ``num_of_cycles`` - ``Number of cyles of start-stop ingestions to repeat`` - ``integer`` * - ``dev_mode`` - ``dev mode ON or OFF`` - ``boolean (true or false)`` * - ``log_level`` - ``Log level to view the logs accordingly`` - ``integer [DEBUG=3 (default), ERROR=0, WARN=1, INFO=2]`` .. note:: When working with GigE cameras, which requires ``network_mode: host``\ , update the ``EndPoint`` key of the SWTriggerUtility interface in config.json(\ ``[WORK_DIR]/IEdgeInsights/tools/SWTriggerUtility/config.json``\ ) to have the host system IP instead of the service name of the server. Example: In order to connect to the ``ia_video_ingestion`` service, which is configured with a GigE camera refer the following ``EndPoint`` change in the SWTriggerUtility interface: .. code-block:: javascript { "Clients": [ { "EndPoint": ":64013", "Name": "default", "ServerAppName": "VideoIngestion", "Type": "zmq_tcp" } ] } .. * If one needs to change the values in config.json(\ ``[WORK_DIR]/IEdgeInsights/tools/SWTriggerUtility/config.json``\ ), then ensure to re-run the steps mentioned in `pre-requisites section <#software-trigger-utilily-pre-requisites>`__ to see the updated changes are getting applied ``OR`` one can choose to update the config key of SWTriggerUtility app via ETCD UI and then restart the application. **This utility works in both DEV & PROD mode.** As a pre-requisite, ensure to turn ON the flag corresponding to "dev_mode" to true or false in the config.json file. Running Software Trigger Utility ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. EII services can be run in prod or dev mode by setting ``DEV_MODE`` value accordingly in build/.env(\ ``[WORK_DIR]/IEdgeInsights/build/.env``\ ) #. Execute builder.py script: .. code-block:: sh cd [WORKDIR]/IEdgeInsights/build/ python3 builder.py -f usecases/video-streaming.yml .. **NOTE**\ : The same yml file to which the **SWTriggerUtility** entry was added in `pre-requisites <#software-trigger-utilily-pre-requisites>`__ must be selected while running the `pre-requisites <#software-trigger-utilily-pre-requisites>`__ Usage of Software Trigger Utility ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default, the Software Trigger Utility container will not execute anything, and one needs to interact with the running container to generate the trigger commands. Ensure the video ingestion (VI) service is up and ready to process the commands from the utility. The software trigger utility can be used in the following ways: #. "START INGESTION" -> "allows ingestion for the default time (120 seconds being the default)" -> "STOP INGESTION" .. code-block:: sh cd [WORKDIR]/IEdgeInsights/build docker-compose run --rm --entrypoint "./sw_trigger_utility" ia_sw_trigger_utility #. "START INGESTION" -> "allows ingestion for a user-defined time (configurable time in seconds)" -> "STOP INGESTION" .. code-block:: sh cd [WORKDIR]/IEdgeInsights/build docker-compose run --rm --entrypoint "./sw_trigger_utility 300" ia_sw_trigger_utility .. **Note:** In the previous example, VideoIngestion starts, then does ingestion for 300 seconds, then stops ingestion after 300 seconds, and the cycle repeats for the number of cycles configured in the config.json. #. Selectively send the START_INGESTION software trigger: .. code-block:: sh cd [WORKDIR]/IEdgeInsights/build docker-compose run --rm --entrypoint "./sw_trigger_utility START_INGESTION" ia_sw_trigger_utility #. Selectively send the STOP_INGESTION software trigger: .. code-block:: sh cd [WORKDIR]/IEdgeInsights/build docker-compose run --rm --entrypoint "./sw_trigger_utility STOP_INGESTION" ia_sw_trigger_utility #. Selectively send the SNAPSHOT software trigger: .. code-block:: sh cd [WORKDIR]/IEdgeInsights/build docker-compose run --rm --entrypoint "./sw_trigger_utility SNAPSHOT" ia_sw_trigger_utility .. note:: * If duplicate START_INGESTION or STOP_INGESTION sw_triggers are sent by mistake, then the VI is capable of catching these duplicates and responding back to the client, conveying that duplicate triggers were sent and requesting to send proper sw_triggers. * In order to send the SNAPSHOT trigger, ensure that the ingestion is stopped. If the START_INGESTION trigger was previously sent, use the STOP_INGESTION trigger to stop the ingestion.