Skip to content

Commit

Permalink
remove vestigial internal argument
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Jun 5, 2024
1 parent 60b24ca commit dc2b51d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions R/syrup.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ syrup <- function(expr, interval = .5, peak = FALSE, env = caller_env()) {
sesh$call(
function(interval, keep_going_file, ps_r_processes, exclude, peak) {
id <- 1
res <- ps_r_processes(exclude = exclude, id = id)
res <- ps_r_processes(id = id)
current_peak <- sum(res$rss, na.rm = TRUE)

while (file.exists(keep_going_file)) {
id <- id + 1
Sys.sleep(interval)
new_res <- ps_r_processes(exclude = exclude, id = id)
new_res <- ps_r_processes(id = id)
if (peak) {
new_peak <- sum(new_res$rss, na.rm = TRUE)
if (new_peak > current_peak) {
Expand All @@ -109,7 +109,6 @@ syrup <- function(expr, interval = .5, peak = FALSE, env = caller_env()) {
interval = interval,
keep_going_file = keep_going_file,
ps_r_processes = ps_r_processes,
exclude = sesh$get_pid(),
peak = peak
)
)
Expand Down
3 changes: 1 addition & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# a reinterpretation of ps() that returns all available memory
# information and doesn't convert to tibble when returning
ps_r_processes <- function(exclude = NULL, id) {
ps_r_processes <- function(id) {
# can have no unstated dependencies in the separate process, so inline where needed
fallback <- function(expr, alternative) {
tryCatch(
Expand All @@ -21,7 +21,6 @@ ps_r_processes <- function(exclude = NULL, id) {

# retain only R-ish processes
r_ish <- nm == "R" | grepl("rsession", nm)
if (!is.null(exclude)) {r_ish <- r_ish[r_ish != exclude]}

processes <- processes[r_ish]
nm <- nm[r_ish]
Expand Down

0 comments on commit dc2b51d

Please sign in to comment.