noumenal
noumenal

Reputation: 1237

Problems Running OpenCPU on a Specified Port

My goal is to access the OpenCPU when I start the browser, e.g. localhost:7978/ocpu/. However, I have problems changing the port to a predictable setting. By default, my localhost server randomizes the port number.

I tried the following — How to set the opencpu default port for single user in my .Rprofile:

library('stats')
library('opencpu')
opencpu$start(7978)

However, opencpu will simply repeat whatever command it is being fed, without reaching a REPL state. I run R from a .bat file without arguments.

I also had a look at .opencpu.conf but did not become much wiser.


EDIT

I was not aware that the version of opencpu I was working with started the REPL when loading the package using the library command. I should have read the manual...

Solution (OpenCPU < v2.0 ?):

library(opencpu)
opencpu$stop()
opencpu$start(7978)

However, since the API and function call have since changed, I chose Jeroen's answer.

Upvotes: 0

Views: 146

Answers (1)

Jeroen Ooms
Jeroen Ooms

Reputation: 32978

The API has changed in the OpenCPU 2.0 release. You now do:

ocpu_start_server(port = 5656)

Upvotes: 1

Related Questions