Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

swagger - R Plumber API giving error when the port of the endpoint changes

I created a R Plumber API on my local machine, to expose a Random Forest classification model (saved in RDS format). I used the Run API option in RStudio to generate the swagger file. Tested the API from Postman - it worked perfectly fine without any error.

But the next day, the say API with the same input started generating error when tested from Postman. The error said that the list can not be coerced to double. On investigation, I found out that this error was generated by the RF classifier list object.

On investigating the error pattern I found out that, every time I close the RStudio and then regenerate the Swagger file; a new port gets assigned. Every time this happens, the error starts coming in.

The error goes away if I re-create the RF model. Till I keep running the API at the same port, there is no error. But as soon as the endpoint port gets changed, the same error resurfaces.

Not able to figure out what the issue is out here - something seems to be corrupting the model.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...