Contents ======== * `Contents <#contents>`__ * `DiscoverHistory Tool <#discoverhistory-tool>`__ * `Build and Run the DiscoverHistory Tool <#build-and-run-the-discoverhistory-tool>`__ * `Prerequisites <#prerequisites>`__ * `Run the DiscoverHistory Tool in the PROD mode <#run-the-discoverhistory-tool-in-the-prod-mode>`__ * `Run the DiscoverHistory Tool in the DEV Mode <#run-the-discoverhistory-tool-in-the-dev-mode>`__ * `Run the DiscoverHistory Tool in the zmq_ipc Mode <#run-the-discoverhistory-tool-in-the-zmq_ipc-mode>`__ * `Sample Select Queries <#sample-select-queries>`__ * `Multi-instance Feature Support for the Builder Script with the DiscoverHistory Tool <#multi-instance-feature-support-for-the-builder-script-with-the-discoverhistory-tool>`__ DiscoverHistory Tool -------------------- You can get history metadata and images from the DataStore container using the DiscoverHistory tool. Build and Run the DiscoverHistory Tool ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This section provides information for building and running DiscoverHistory tool in various modes such as the PROD mode and the DEV mode. Prerequisites ~~~~~~~~~~~~~ As a prerequisite to run the DiscoverHistory tool, a set of config, interfaces, public, and private keys should be present in ETCD. To meet the prerequisite, ensure that an entry for the DiscoverHistory tool with its relative path from the ``[WORK_DIR]/IEdgeInsights]`` directory is set in the ``video-streaming-storage.yml`` file in the ``[WORK_DIR]/IEdgeInsights/build/usecases/`` directory. For more information, see the following example: .. code-block:: sh AppContexts: - ConfigMgrAgent - VideoIngestion - VideoAnalytics - Visualizer/multimodal-data-visualization-streaming/eii - Visualizer/multimodal-data-visualization/eii - tools/DiscoverHistory - DataStore Run the DiscoverHistory Tool in the PROD mode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After completing the prerequisites, perform the following steps to run the DiscoverHistory tool in the PROD mode: #. Open the ``config.json`` file. #. Enter the query for DataStore influxdb. #. Run the following command to generate the new ``docker-compose.yml`` that includes DiscoverHistory: .. code-block:: sh python3 builder.py -f usecases/video-streaming-storage.yml #. Provision, build, and run the DiscoverHistory tool along with the EII video-streaming-storage recipe or stack. For more information, refer to the `EII README `_. #. Check if the ``ia_datastore`` service is running. #. Locate the ``data`` and the ``frames`` directories from the following path: ``/opt/intel/eii/tools_output``. .. **Note:** The ``frames`` directory will be created only if ``img_handle`` is part of the select statement. If frames directory is not created, restarting the DiscoverHistory service would help to create it as the dependent services would have come up by then. #. Use the ETCDUI to change the query in the configuration. #. Run the following command to start the container with new configuration: .. code-block:: sh docker restart ia_discover_history Run the DiscoverHistory Tool in the DEV Mode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After completing the prerequisites, perform the following steps to run the DiscoverHistory tool in the DEV mode: #. Open the [.env] file from the ``[WORK_DIR]/IEdgeInsights/build`` directory. #. Set the ``DEV_MODE`` variable as ``true``. Run the DiscoverHistory Tool in the zmq_ipc Mode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After completing the prerequisites, to run the DiscoverHistory tool in the zmq_ipc mode, modify the interface section of the ``config.json`` file as follows: .. code-block:: json { "type": "zmq_ipc", "EndPoint": "/EII/sockets" } Sample Select Queries ^^^^^^^^^^^^^^^^^^^^^ The following table shows the samples for the select queries and its details: .. list-table:: :header-rows: 1 * - Select Query - Details * - "select * from camera1_stream_results order by desc limit 10" - This query will return latest 10 records. * - "select height,img_handle from camera1_stream_results order by desc limit 10" - * - "select * from camera1_stream_results where time>='2019-08-30T07:25:39Z' AND time<='2019-08-30T07:29:00Z'" - This query will return all the records between the given time frame, which is (time>='2019-08-30T07:25:39Z' and time<='2019-08-30T07:29:00Z') * - "select * from camera1_stream_results where time>=now()-1h" - This query will return all the records from the current time, going back upto last 1 hour. * - .. note:: Include the following parameters in the query to get the good and the bad frames: * *img_handle * *defects * *encoding_level * *encoding_type * *height * *width * *channel The following examples shows how to include the parameters: * "select img_handle, defects, encoding_level, encoding_type, height, width, channel from camera1_stream_results order by desc limit 10" * "select * from camera1_stream_results order by desc limit 10" Multi-instance Feature Support for the Builder Script with the DiscoverHistory Tool ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The multi-instance feature support of the Builder works only for the video pipeline (\ ``[WORK_DIR]/IEdgeInsights/build/usecase/video-streaming.yml``\ ). For more details, refer to the `EII core Readme `_ In the following example, you can view how to change the configuration to use the builder.py script -v 2 feature with 2 instances of the DiscoverHistory tool enabled: .. image:: /4.0/IEdgeInsights/tools/DiscoverHistory/img/discoverHistoryTool-conf-change1.png :target: /4.0/IEdgeInsights/tools/DiscoverHistory/img/discoverHistoryTool-conf-change1.png :alt: DiscoverHistory instance 1 interfaces .. image:: /4.0/IEdgeInsights/tools/DiscoverHistory/img/discoverHistoryTool-conf-change2.png :target: /4.0/IEdgeInsights/tools/DiscoverHistory/img/discoverHistoryTool-conf-change2.png :alt: DiscoverHistory instance 2 interfaces