WARNING: This function is under development. It can change at any time. For now, please, do not depend on this function in a published R package.

journal(x, ...)

Arguments

x

A Future object.

...

Not used.

Value

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

  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

The common events are:

  • 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)

but others may be added by other Future classes.

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 querying the future

but others may be added by other Future classes.

The data frame is sorted by the at time. Note that the timestamps for the evaluate event are based on the local time on the worker. The system clocks on the worker and the calling R system may not be in perfect sync.

Enabling and disabling event logging

To enable logging of events, set option future.journal is TRUE. To disable, set it to FALSE (default).

See also

Use capture_journals() to capture journals from all futures.

Examples

## Enable journaling of futures
oopts <- options(future.journal = TRUE)

plan(multisession, workers = 2L)

t_start <- Sys.time()
fs <- lapply(1:3, FUN = function(x) future({ Sys.sleep(x); sqrt(x) }))
vs <- value(fs)
js <- lapply(fs, FUN = journal, baseline = t_start)
print(js)
#> [[1]]
#>            event   category parent               start              at
#> 1         create   overhead   <NA> 2024-04-18 18:03:35 0.00000000 secs
#> 6         launch   overhead   <NA> 2024-04-18 18:03:35 0.01693034 secs
#> 2      getWorker   overhead launch 2024-04-18 18:03:35 0.01754522 secs
#> 3    eraseWorker   overhead launch 2024-04-18 18:03:35 0.01824069 secs
#> 4 attachPackages   overhead launch 2024-04-18 18:03:35 0.01917315 secs
#> 5  exportGlobals   overhead launch 2024-04-18 18:03:35 0.01969481 secs
#> 9       evaluate evaluation   <NA> 2024-04-18 18:03:35 0.06274104 secs
#> 7  receiveResult   overhead gather 2024-04-18 18:03:36 1.08842921 secs
#> 8         gather   overhead   <NA> 2024-04-18 18:03:36 1.09052896 secs
#>            duration future_label                          future_uuid
#> 1 4.189968e-03 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#> 6 4.133463e-03 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#> 2 1.180172e-04 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#> 3 3.771782e-04 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#> 4 3.814697e-05 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#> 5 3.216267e-04 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#> 9 1.003197e+00 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#> 7 2.090931e-04 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#> 8 8.845329e-05 secs         <NA> d90f1220-2b66-0f9d-e587-62c0e0ea9be0
#>                           session_uuid
#> 1 d08570db-2393-2baf-bd2e-30e1babbe000
#> 6 d08570db-2393-2baf-bd2e-30e1babbe000
#> 2 d08570db-2393-2baf-bd2e-30e1babbe000
#> 3 d08570db-2393-2baf-bd2e-30e1babbe000
#> 4 d08570db-2393-2baf-bd2e-30e1babbe000
#> 5 d08570db-2393-2baf-bd2e-30e1babbe000
#> 9 d08570db-2393-2baf-bd2e-30e1babbe000
#> 7 d08570db-2393-2baf-bd2e-30e1babbe000
#> 8 d08570db-2393-2baf-bd2e-30e1babbe000
#> 
#> [[2]]
#>            event   category parent               start              at
#> 1         create   overhead   <NA> 2024-04-18 18:03:35 0.00000000 secs
#> 6         launch   overhead   <NA> 2024-04-18 18:03:35 0.01723981 secs
#> 2      getWorker   overhead launch 2024-04-18 18:03:35 0.01783776 secs
#> 3    eraseWorker   overhead launch 2024-04-18 18:03:35 0.01863003 secs
#> 4 attachPackages   overhead launch 2024-04-18 18:03:35 0.05407882 secs
#> 5  exportGlobals   overhead launch 2024-04-18 18:03:35 0.05464578 secs
#> 9       evaluate evaluation   <NA> 2024-04-18 18:03:36 0.09722281 secs
#> 7  receiveResult   overhead gather 2024-04-18 18:03:38 2.14253330 secs
#> 8         gather   overhead   <NA> 2024-04-18 18:03:38 2.14359283 secs
#>            duration future_label                          future_uuid
#> 1 2.372265e-03 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#> 6 3.889966e-02 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#> 2 1.318455e-04 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#> 3 3.475881e-02 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#> 4 4.887581e-05 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#> 5 4.613400e-04 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#> 9 2.044917e+00 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#> 7 2.219677e-04 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#> 8 3.933907e-05 secs         <NA> c2522b8c-6162-4be1-8c37-2e88c689b195
#>                           session_uuid
#> 1 d08570db-2393-2baf-bd2e-30e1babbe000
#> 6 d08570db-2393-2baf-bd2e-30e1babbe000
#> 2 d08570db-2393-2baf-bd2e-30e1babbe000
#> 3 d08570db-2393-2baf-bd2e-30e1babbe000
#> 4 d08570db-2393-2baf-bd2e-30e1babbe000
#> 5 d08570db-2393-2baf-bd2e-30e1babbe000
#> 9 d08570db-2393-2baf-bd2e-30e1babbe000
#> 7 d08570db-2393-2baf-bd2e-30e1babbe000
#> 8 d08570db-2393-2baf-bd2e-30e1babbe000
#> 
#> [[3]]
#>            event   category parent               start              at
#> 1         create   overhead   <NA> 2024-04-18 18:03:35 0.00000000 secs
#> 6         launch   overhead   <NA> 2024-04-18 18:03:35 0.01615810 secs
#> 2      getWorker   overhead launch 2024-04-18 18:03:35 0.01675677 secs
#> 3    eraseWorker   overhead launch 2024-04-18 18:03:36 1.01800060 secs
#> 4 attachPackages   overhead launch 2024-04-18 18:03:36 1.01983762 secs
#> 5  exportGlobals   overhead launch 2024-04-18 18:03:36 1.02080894 secs
#> 9       evaluate evaluation   <NA> 2024-04-18 18:03:37 1.06818700 secs
#> 7  receiveResult   overhead gather 2024-04-18 18:03:40 4.07898259 secs
#> 8         gather   overhead   <NA> 2024-04-18 18:03:40 4.08111310 secs
#>            duration future_label                          future_uuid
#> 1 2.320290e-03 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#> 6 1.006922e+00 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#> 2 1.000105e+00 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#> 3 7.171631e-04 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#> 4 8.749962e-05 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#> 5 5.497932e-04 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#> 9 3.005220e+00 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#> 7 3.075600e-04 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#> 8 6.866455e-05 secs         <NA> 5ae8c8a4-3efd-ad96-b9ac-bd4511f7bb71
#>                           session_uuid
#> 1 d08570db-2393-2baf-bd2e-30e1babbe000
#> 6 d08570db-2393-2baf-bd2e-30e1babbe000
#> 2 d08570db-2393-2baf-bd2e-30e1babbe000
#> 3 d08570db-2393-2baf-bd2e-30e1babbe000
#> 4 d08570db-2393-2baf-bd2e-30e1babbe000
#> 5 d08570db-2393-2baf-bd2e-30e1babbe000
#> 9 d08570db-2393-2baf-bd2e-30e1babbe000
#> 7 d08570db-2393-2baf-bd2e-30e1babbe000
#> 8 d08570db-2393-2baf-bd2e-30e1babbe000
#> 

## Stop parallel workers and disable journal logging and signaling
plan(sequential)
options(oopts)