Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-8042

Refactor PredictionCodegen

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None
    • False
    • None
    • False
    • Medium
    • Hide

      Execute tests in multithread environments, e.g. `integration-tests-quarkus-norest` from Ricardo Zanini's multicore build refactoring. Repeat them because they do not always fails.

      Show
      Execute tests in multithread environments, e.g. `integration-tests-quarkus-norest` from Ricardo Zanini's multicore build refactoring. Repeat them because they do not always fails.
    • ---
    • ---
    • 2022 Week 38-40 (from Sept 19)

      `PredictionCodegen` extends `AbstractGenerator` and override the method `internalGenerate` that creates "GeneratedFile"s out of `PMMLResources` and `IndexFiles`.
      The issue is that `resources` and `indexFiles` are populated by statically by `PredictionCodegen.ofCollectedResources` that, at one point, has to delete the previously created `IndexFiles` to avoid mixing of different builds.
      The result is that, inside a multithread environment, those files get deleted by one thread while are accessed on another one, raising the exception:
      `19:02:44 [ERROR] [error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateSources threw an exception: org.kie.pmml.api.exceptions.KiePMMLException: Failed to read content of (/....)/target/IndexFile.pmml_json`.
      Removing the `deleteIndexFiles();` invocation at line 107 does not works because, in that case, all the different models gets merged in one single file (`PredictionCodegenTest.generateAllFiles*` tests fails).
      The solution should be to move the code generation part (both resources and indexfile) inside the `PredictionCodegen` instance.
      As side note, it would be better to create an utility class with all the static methods, separated from the `PredictionCodegen` that should contain only instance methods.

              gcardosi Gabriele Cardosi (Inactive)
              gcardosi Gabriele Cardosi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: