Are data objects persistent in openCPU's R session?

自闭症网瘾萝莉.ら 提交于 2019-12-19 08:53:28

问题


I would like to provide a web tool that requires access to a large dataset. Preferentially, this R data object should be loaded into memory once and then be available for user-defined queries.

Does the openCPU framework support persistant data objects in any way or does every query begin with a blank slate?


回答1:


The OpenCPU API is stateless, there is no way to keep a process alive in between requests. But you can easily solve your problem by putting your dataset into a package, and installing that on the server.

You can use the preload option described in the server manual, or use the /etc/opencpu/Rprofile script to load the package with the dataset in memory when the server starts. That way the data will be will be ready to use when requests come in.



来源:https://stackoverflow.com/questions/12468574/are-data-objects-persistent-in-opencpus-r-session

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!