rstudio / rscloud

Managing RStudio Cloud spaces with R
https://rstudio.github.io/rscloud
Other
22 stars 11 forks source link

Function 'space_member_usage' returns an error when using a 'groupby' filter #43

Closed kputschko closed 3 years ago

kputschko commented 3 years ago

I'm using rscloud version 0.0.0.9001 on R 4.0.3, hoping to get a view of project usage by user id. The documentation suggests I use

space_member_usage(space, filters = list(groupby = "user_id", from = "90d"))

But copying and pasting this code from the help page fails to run, with the error:

Error: Problem with `mutate()` input `last_activity`.
x Column `last_activity` not found in `.data`
Input `last_activity` is `as.POSIXct(.data$last_activity/1000, origin = "1970-01-01")`.
mine-cetinkaya-rundel commented 3 years ago

@kputschko Is last_activity a piece of information that's useful to you? A change in the API is what has broken this function and I'm exploring ways of fixing it without waiting for an API fix, at least temporarily.

kputschko commented 3 years ago

Hello @mine-cetinkaya-rundel! Thanks for reaching out. I'm not necessarily interested in the 'last_activity' value, but what I would like to have access to is the total amount of time a student user has spent active in RStudio Cloud. The use case I have in mind is to get a snapshot of this value each week, then estimate the amount of time each student is spending on the exercises.

mine-cetinkaya-rundel commented 3 years ago

@kputschko space_member_usage() should now be working with #46 merged in.

Note that this will return a tibble with a compute column, which factors in the CPU and Memory app allocated to project. The formula is (RAM + CPUs allocated) / 2 x hours. The default configuration for projects is 1 CPU and 1 GB of memory so you end up with 1 compute hour = 1 wall clock hour. If you've adjusted the project resources, then you'll need to know the relevant CPU and MEM associated with it to calculate time spent on project.