Skip to content

Commit

Permalink
add error handling around ps file system calls
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Dec 3, 2024
1 parent 6ed7ecb commit 06def26
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Allow branch references to contain multi-element `path` vectors with cloud metadata (#1382, @n8layman).
* Avoid partial matches in internal code (#1384, @olivroy).
* Add error handling around calls to `ps::ps_disk_partitions()` and `ps::ps_fs_mount_point()`.

## Compatibility

Expand Down
14 changes: 13 additions & 1 deletion R/class_runtime.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,19 @@ runtime_set_file_info <- function(runtime, store) {
}

runtime_file_systems <- function() {
info <- ps::ps_disk_partitions()
info <- tryCatch(
ps::ps_disk_partitions(),
# nocov start
error = function(condition) {
data.frame(
device = character(0L),
mountpoint = character(0L),
fstype = character(0L),
options = character(0L)
)
}
# nocov end
)
out <- .subset2(info, "fstype")
names(out) <- .subset2(info, "mountpoint")
out
Expand Down
8 changes: 5 additions & 3 deletions R/utils_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ trust_timestamps <- function(path) {
file_systems <- runtime_file_systems()
tar_runtime$file_systems <- file_systems
}
mounts <- ps::ps_fs_mount_point(existing)
types <- as.character(file_systems[mounts])
trust[exists] <- !(types %in% unsafe)
try({
mounts <- ps::ps_fs_mount_point(existing)
types <- as.character(file_systems[mounts])
trust[exists] <- !(types %in% unsafe)
}, silent = TRUE)
}
trust
}
1 change: 0 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ Please read the [help guide](https://books.ropensci.org/targets/help.html) to le

## Deployment

* <https://solutions.rstudio.com/r/workflows/> explains how to deploy a pipeline to RStudio Connect ([example code](https://github.com/sol-eng/targets-deployment-rsc)).
* [`tar_github_actions()`](https://docs.ropensci.org/targets/reference/tar_github_actions.html) sets up a pipeline to run on GitHub Actions. The [minimal example](https://github.com/wlandau/targets-minimal) demonstrates this approach.

## Extending and customizing targets
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ to ask for help using `targets`.

## Deployment

- <https://solutions.rstudio.com/r/workflows/> explains how to deploy a
pipeline to RStudio Connect ([example
code](https://github.com/sol-eng/targets-deployment-rsc)).
- [`tar_github_actions()`](https://docs.ropensci.org/targets/reference/tar_github_actions.html)
sets up a pipeline to run on GitHub Actions. The [minimal
example](https://github.com/wlandau/targets-minimal) demonstrates this
Expand Down

0 comments on commit 06def26

Please sign in to comment.