Search code examples
rapacheopencpu

Delete object from opencpu session


How do I delete a previously created object in OpenCPU?

I need to delete some unused objects. For example, the result of a POST is the following:

/ocpu/tmp/x0b0f8555a1e1d6/R/.val
/ocpu/tmp/x0b0f8555a1e1d6/stdout
/ocpu/tmp/x0b0f8555a1e1d6/source
/ocpu/tmp/x0b0f8555a1e1d6/console
/ocpu/tmp/x0b0f8555a1e1d6/info
/ocpu/tmp/x0b0f8555a1e1d6/files/DESCRIPTION

How do I delete the object x0b0f8555a1e1d6?

I tried posting to

curl http://myserver:myport/ocpu/library/base/R/rm -d "x0b0f8555a1e1d6"

which gives an error:

... must contain names or character strings

In call:
rm(x0b0f8555a1e1d6 = NA)

And

curl http://myserver:myport/ocpu/library/base/R/rm -d "list='x0b0f8555a1e1d6'"

gives a warning that the object was not found:

object 'x0b0f8555a1e1d6' not found

Solution

  • The temporary objects automatically get deleted after a while (usually 24h). There is no http API to manually prune them. Have a look at the /etc/cron.d/opencpu script on your server.

    If you really want to delete a session you can manually delete the directory in /tmp/ocpu-store/ on your server. It also gets automatically deleted on reboot.