Skip to content

Commit

Permalink
JOURNAL: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Jan 26, 2024
1 parent f1da4a4 commit ef4d651
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: future
Version: 1.33.1-9001
Version: 1.33.1-9002
Title: Unified Parallel and Distributed Processing in R for Everyone
Imports:
digest,
Expand Down Expand Up @@ -39,5 +39,5 @@ LazyLoad: TRUE
ByteCompile: TRUE
URL: https://future.futureverse.org, https://github.com/HenrikBengtsson/future
BugReports: https://github.com/HenrikBengtsson/future/issues
RoxygenNote: 7.3.0
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
48 changes: 28 additions & 20 deletions R/journal.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@
#' @return
#' A data frame of class `FutureJournal` with columns:
#'
#' 1. `event` (character string) - type of event that took place
#' 2. `category` (character string) - the category of the event
#' 3. `parent` (character string) - (to be describe)
#' 4. `start` (POSIXct) - the timestamp when the event started
#' 5. `at` (difftime) - the time when the event started relative to
#' first event
#' 6. `duration` (difftime) - the duration of the event
#' 1. `event` (factor) - type of event that took place
#' 2. `category` (factor) - the category of the event
#' 3. `parent` (character string) - (to be describe)
#' 4. `start` (POSIXct) - the timestamp when the event started
#' 5. `at` (difftime) - the time when the event started
#' relative to first event
#' 6. `duration` (difftime) - the duration of the event
#' 7. `future_label` (character string) - the label of the future
#' 8. `future_uuid` (character string) - the UUID of the future
#' 9. `session_uuid` (character string) - the UUID of the R session
#' where the event took place
#' 8. `future_uuid` (factor) - the UUID of the future
#' 9. `session_uuid` (factor) - the UUID of the R session where the
#' event took place
#'
#' The common events are:
#'
#' * `create` - the future was created (an `overhead`)
#' * `launch` - the future was launched (an `overhead`)
#' * `create` - the future was created (an `overhead`)
#' * `launch` - the future was launched (an `overhead`)
#' * `evaluate` - the future was evaluated (an `evaluation`)
#' * `resolved` - the future was queried (may be occur multiple times)
#' (an `overhead`)
#' * `gather` - the results was retrieved (an `overhead`)
#' * `gather` - the results was retrieved (an `overhead`)
#'
#' but others may be added by other Future classes.
#'
#' Common event categorys are:
#' Common event categories are:
#'
#' * `evaluation` - processing time is spent on evaluation
#' * `overhead` - processing time is spent on orchestrating the future
#' * `waiting` - processing time is spent on waiting to set up or
#' * `overhead` - processing time is spent on orchestrating the future
#' * `waiting` - processing time is spent on waiting to set up or
#' querying the future
#'
#' but others may be added by other Future classes.
Expand Down Expand Up @@ -82,10 +82,10 @@ journal.Future <- function(x, ...) {
if (!is.element("evaluate", data$event) && !is.null(x$result)) {
stop_if_not(is.character(session_uuid))
x <- appendToFutureJournal(x,
event = "evaluate",
category = "evaluation",
start = x$result$started,
stop = x$result$finished
event = "evaluate",
category = "evaluation",
start = x$result$started,
stop = x$result$finished
)
data <- x$.journal
stop_if_not(length(x$result$session_uuid) == 1L, is.character(x$result$session_uuid))
Expand Down Expand Up @@ -117,6 +117,14 @@ journal.Future <- function(x, ...) {
levels <- c(known_levels, other_levels)
data$event <- factor(data$event, levels = levels)

## Coerce 'category' to a factor
levels <- c("evaluation", "overhead", "waiting")
data$category <- factor(data$category, levels = levels)

## Coerce 'category' to a factor
levels <- c("evaluation", "overhead", "waiting")
data$category <- factor(data$category, levels = levels)

## Sort by relative start time
if (nrow(data) > 1L) data <- data[order(data$at), ]

Expand Down

0 comments on commit ef4d651

Please sign in to comment.