Skip to main content
1-Visitor
Aug 24, 2018 1:48 PM UTC
Solved

Anomaly alert Failed after Training

Hello, I am having some issues with Anomaly Alert after Training

Here is everything I've done:

 

  • microservices.properties file is inside directory /etc/thingworx/microservices.properties
    results.destination.uri=results://52.169.91.141:8096/results/models
    file.storage.path=file:/ThingworxMicroservices/data/results
    dataset.webservices.url=
    dataset.app.id=
    dataset.app.key=
  • In the directory /ThingworxMicroservices I have the following files
    • data (dir)
    • logs (dir)
    • models (dir)
    • results-h2-file.yml
    • result-standalone-2.0.2-bin.jar
    • training-standalone-2.0.4-bin.jar
    • training-standalone-single.yml

  • results-h2-file.yml
    database:
     driverClass: org.h2.Driver
     url: jdbc:h2:file:./data/results/model-db
    
    # server config stuff
    server:
     applicationConnectors:
     - type: http
     port: 8096
     reuseAddress: true
     adminConnectors:
     - type: http
     port: 8097
     reuseAddress: true
     registerDefaultExceptionMappers: false
  • training-standalone-single.yml
    # server config stuff
    server:
    # softNofileLimit: 1000
    # hardNofileLimit: 1000
     applicationConnectors:
     - type: http
     port: 8090
     adminConnectors:
     - type: http
     port: 8091
     registerDefaultExceptionMappers: false
  • AlertProcessingSubsystem
    Anomaly Detection Training Service URI: http://52.169.91.141:8090/training
    Anomaly Detection Results Service URI: http://52.169.91.141:8096/results/models

  • I run results and training with the following commands
    java -Dproperties.file=/etc/thingworx/microservices.properties -jar 'result-standalone-2.0.2-bin.jar' server results-h2-file.yml > logs/results.log &
    java -Dproperties.file=/etc/thingworx/microservices.properties -jar 'training-standalone-2.0.4-bin.jar' server training-standalone-single.yml > logs/training.log &

    I get the following errors (cut for brevity)
    Returning a FAILED state for TimedValue [timestamp=1535104090265, value=1011.0362249999962]. ThingWatcherMessage [timestamp=2018-08-24T11:48:10.767, severity=ERROR, state=ThingWatcherInternalState [internal=TRAINING, external=TRAINING], messageCode=WAT9999E, messageText=Unexpected exception. {Throwable=[RetryableTrainingRequestException: Received error from POST of Training request with Code(500)_Message(Internal Server Error)_Details:_{code=500, message=Failed during training, details=Caused by: org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "CONSTRAINT_INDEX_C ON PUBLIC.JOB_EXEC_INFO(CLAIM_CHECK) VALUES ('1', 1)"; SQL statement:_/* JobExecutionInfoDAO.add */ insert into job_exec_info (claim_check, created, request) values (?, ?, ?) [23505-192] [statement:"insert into job_exec_info (claim_check, created, request) values (:claimCheck, :created, :request)", located:"insert into job_exec_info (claim_check, created, request) values 

    Anomaly Alert [AnomalyAlertTest_Thing-propTest1-AnomalyAlertTest] Failed when in [TRAINING] State. Thingwatcher Error Code :: [WAT9999E] Message :: Unexpected exception. {Throwable=[RetryableTrainingRequestException: Received error from POST of Training request with Code(500)_Message(Internal Server Error)_Details:_{code=500, message=Failed during training, details=Caused by: org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "CONSTRAINT_INDEX_C ON PUBLIC.JOB_EXEC_INFO(CLAIM_CHECK) VALUES ('1', 1)"; SQL statement:_/* JobExecutionInfoDAO.add */ insert into job_exec_info (claim_check, created, request) values (?, ?, ?) [23505-192] [statement:"insert into job_exec_info (claim_check, created, request) values (:claimCheck, :created, :request)", located:"insert into job_exec_info (claim_check, created, request) values (:claimCheck, :created, :request)", rewritten:"/* JobExecutionInfoDAO.add */ insert into job_exec_info (claim_check, created, request) values (?, ?, ?)", arguments:{ positional:{}, named:{request:'{"goalName":"Goal","dataSource":{"datasetUri":"body:///","format":"json","exclusions":[],"data":"[{\"EntityId\":\"EntityId1\",\"Goal\":84.4649635544983,\"Time\":1535104002582},{\"EntityId\":\"EntityId1\",\"Goal\":66.53744259471634,\"Time\":1535104002735},{\"EntityId\":\"EntityId1\",\"Goal\":52.42285620347115,\"Time\":1535104002888},{\"EntityId\":\"EntityId1\",\"Goal\":89.6188606133255,\"Time\":1535104003041},{\"EntityId\":\"EntityId1\",\"Goal\":85.13964386168999,\"Time\":1535104003194},{\"EntityId\":\"EntityId1\",\"Goal\":67.83531276896812,\"Time\":1535104003347},{\"EntityId\":\"EntityId1\",\"Goal\":61.62003522072911,\"Time\":1535104003500},

    Could anyone help me understanding where the error is?
This topic has been closed for replies.
cmorfinAnswer
19-Tanzanite
Sep 17, 2018 10:55 AM UTC

For the record, this has been resolved offline, by clearing the result db file.

See https://www.ptc.com/en/support/article?n=CS292986 for details.

26 replies

19-Tanzanite
Aug 24, 2018 2:00 PM UTC

Hi

 

This error is reported at https://www.ptc.com/en/support/article?n=CS270206.
Could you apply the resolution provided and check if it helps here.

 

Thanks

Kind regards

Christophe

 

Translate
fmanniti1-VisitorAuthor
1-Visitor
Aug 24, 2018 3:08 PM UTC

I tried that solution but it didn't worked for me.
Still the same error

Translate
19-Tanzanite
Aug 24, 2018 3:20 PM UTC

Hi

 

Could you upload the complete yml files for result and training ?

Could you also specify which version of ThingWorx you are using ?

It could also be useful to get the training and result output in a file and upload it - the following article should help for this https://www.ptc.com/en/support/article?n=CS266118

 

Kind regards

Christophe

 

Translate