Verify That IMES Results Reach Shift Handover Reports

Run a test IMES graph, confirm that its result reaches Kafka, and then confirm that IMES appears as a widget source in Shift Handover.

The implementation team does steps 1 to 4 in a test environment. A plant admin does steps 5 and 6.

Important:
The graph, tenant, work centers and Kafka key in this topic are test examples from the supplied iMES test setup: graph tg-waste_b4_24h, tenant dev-cwp-maximo, work centers B4, C7, PM02 and PM04, and Kafka key dev-cwp-maximo:B4. Do not copy them into a customer production configuration.
  1. Make sure the test environment has recent iMES data.

    A graph returns rows only when there is data inside its lookback window (its lookbackHours parameter) for the work center it queries.

    Test example: IMES simulator. Where no real iMES database is available, the IMES simulator writes iMES-shaped synthetic data into MySQL. It creates the data-set tables if they do not exist and inserts coherent data on each run. It is a Kubernetes CronJob (imes-simulator, from IMESSimulator/k8s/cronjob.yaml, in the Kubernetes namespace race) that runs hourly (0 * * * *) with concurrencyPolicy: Forbid and backoffLimit: 2. Use it only in test environments, never against production data.

    VariableDefaultMeaning
    MYSQL_HOST, MYSQL_PORT, MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORDRequired (port 3306)Target test database. The user needs CREATE and INSERT, and DROP only if truncating.
    MYSQL_SSLfalseTLS
    IMES_RECORDS25Orders per run
    IMES_WORK_CENTERSB4,C7,PM02,PM04Work centers generated (test values)
    IMES_TRUNCATEfalseEmpty the tables before inserting. Keep it false.

    Deploy it in a test environment, then run one batch just before the test:

    kubectl -n race create secret generic imes-mysql-credentials-secret \
      --from-literal='MYSQL_HOST=<host>' --from-literal=MYSQL_PORT=3306 \
      --from-literal='MYSQL_DATABASE=<db>' --from-literal='MYSQL_USER=<user>' \
      --from-literal='MYSQL_PASSWORD=<password>'
    kubectl apply -f IMESSimulator/k8s/cronjob.yaml
    kubectl -n race create job --from=cronjob/imes-simulator imes-simulator-manual
    kubectl -n race wait --for=condition=complete job/imes-simulator-manual --timeout=10m
    kubectl -n race logs job/imes-simulator-manual

    The log shows inserts and the Job completes (1/1). To run it again, delete the old Job first: kubectl -n race delete job imes-simulator-manual. To check the secret, list its key names only; this command does not print values:

    kubectl -n race get secret imes-mysql-credentials-secret \
      -o go-template='{{range $k, $v := .data}}{{$k}}{{"\n"}}{{end}}'
  2. In a separate terminal, start a Kafka console consumer on task.sql.results, and keep it running while you run the graph.

    Start it before you run the graph, without --from-beginning, so it shows only new messages. The Kafka listener requires TLS and SASL/SCRAM, so pass the client configuration file issued for your deployment (its TLS and SASL settings) with --consumer.config.

    kafka-console-consumer.sh --bootstrap-server '<KAFKA_BOOTSTRAP>' --topic task.sql.results \
      --consumer.config '<issued-client.properties>' \
      --property print.key=true --property key.separator=' | ' \
      | grep '^dev-cwp-maximo:B4 |'

    Stop the consumer with Ctrl+C after you have checked the result.

  3. Run the test graph synchronously.
    curl -s -X POST '<API_BASE_URL>/task-orchestration-api/task-graphs/tg-waste_b4_24h/execute' \
      -H 'Content-Type: application/json' \
      -d '{"context":{"tenantId":"dev-cwp-maximo","aggregateType":"TAXONOMY","aggregateId":"B4"}}' \
      | tee /tmp/e2e.json

    Do not use the graph tg-machine_time_kubernetes_job. It depends on an execution path this deployment does not use, so it fails and proves nothing.

  4. Check the result.
    jq '..|.tableName? // empty' /tmp/e2e.json

    The response has a row count greater than 0, and the table name is v_Material_Waste (the Waste data set; see iMES Data Sets for Shift Handover). The consumer from step 2 shows a new message with the key dev-cwp-maximo:B4. This proves that the iMES services publish results.

  5. Open Shift Handover > Report Configuration, select the plant, and start Create Widget in a custom section.

    IMES appears in Source, and v_Material_Waste appears in Collection. Shift Handover adds them when an IMES result for the table first arrives, so they show that results have reached Shift Handover at some point. They do not prove that the result from this test arrived.

  6. Make sure a current report shows an IMES widget for v_Material_Waste.

    If the plant has no such widget, add one; see Add Alerts and IMES Widgets to Shift Handover Reports. A new widget appears only on reports generated after you save, so wait for the next report before you continue.

  7. With the consumer from step 2 still running, run the graph again (step 3), then open the report and check the widget.

    Within about 30 seconds, the widget shows the rows from this run. Compare them with the rows in /tmp/e2e.json. This proves that the result from this test reached Shift Handover for your tenant.

If the test fails

SymptomCheck
Row count is 0The test data is older than the test window, or the work center is missing from IMES_WORK_CENTERS. Run a batch just before testing.
Table name is not v_Material_WasteThe graph in MongoDB is stale. Bootstrap never replaces an existing graph, so it must be re-seeded by the implementation team.
No Kafka messageThe Kafka settings on the service running the graph, and that the topic exists.
Startup log shows sql.configured: false or kafka.configured: falseThe MySQL or Kafka settings on the API or worker are missing or misnamed.
The API fails at startup with a kubectl or exec errorAccess to Temporal admintools: the two settings and the RBAC in the admintools Kubernetes namespace.
The widget does not show the rows from this runThe report was generated before the widget was added, or the result is not mapped to this tenant.
Kafka message arrives, but IMES is missing in Create WidgetenableSHRIMES is off, the Shift Handover IMES consumer is not set, or the result is not mapped to this tenant.