Skip to content

Apply 'stdout' and 'conditions' settings also on loaded 'packages' #789

@HenrikBengtsson

Description

@HenrikBengtsson

Adopted from #787 (comment):

Argument conditions does not apply to packages attached via the packages argument, e.g.

library(future)
f <- future(42, packages = "mclust", conditions = structure("condition", exclude = "packageStartupMessage"))
v <- value(f)
print(v)

This outputs:

                   __           __ 
   ____ ___  _____/ /_  _______/ /_
  / __ `__ \/ ___/ / / / / ___/ __/
 / / / / / / /__/ / /_/ (__  ) /_  
/_/ /_/ /_/\___/_/\__,_/____/\__/   version 6.1.1
Type 'citation("mclust")' for citing this R package in publications.

[1] 42

In constrast, conditions applies during the evaluation of the future expression, i.e.

library(future)
f <- future({
  mclust::map ## loads 'mclust'
  library(mclust) ## just to prove it works when package is attached too
  42
}, conditions = structure("condition", exclude = "packageStartupMessage"))
v <- value(f)
print(v)

This only outputs:

[1] 42

The solution is to make sure that conditions are also handled during the startup phase of the evaluation of the future.

UPDATE +30 mins: Added library(mclust) just to clarify that it also works when the package is attached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions