How to deliver an IOObject to an input port

monami555
monami555 New Altair Community Member
edited November 5 in Community Q&A
Hello it's me again.

Maybe someone could advise me on the following issue:

I have a KNN Learner operator which outputs a PredictionModel. I want to store this model object on disk, to be able to use it later, straight from the file, rather than training the model once again.

I am able to serialize and deserialize the PredictionModel object, but now I run into problem: how to pass this model to the ModelApplier operator input port? The most logical it would seem to me to connect the main process inner output with the ModelApplier model input, and then invoke modelApplier.inputPort.deliver(IOObject), but still I get the "No data was delivered at port ModelApplier.model" exception.

In general, what is the right way to deliver an IOObject to an input port?

Best,
M.

Answers

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    draw a line from the process input port(s) to the desired operators, and use this code when invoking the process from java:

    IOContainer ioInput = new IOContainer(new IOObject[]{ model });
    IOContainer ioResult = process.run(ioInput);
    Regards,
    Marco