Code Monkey home page Code Monkey logo

Comments (4)

wlandau avatar wlandau commented on August 11, 2024 1

Thanks for explaining, Henrik. targets is already capable of temporary plans, and I have updated the docs to encourage that kind of usage.

From my perspective as a user, it seemed safer to supply resources to the future instead of the plan because temporary plans seem difficult in the general case: for example, if temporarily switching to a different plan automatically shuts down the PSOCK cluster in the original plan. targets currently relies on future::plan(.cleanup = FALSE), which as you explained earlier, is not really officially supported either.

But I do understand the need for a consistent interface with appropriate semantic guardrails.

from future.batchtools.

wlandau avatar wlandau commented on August 11, 2024

Downgrading to future version 1.21.0 appears to have fixed the issue on my end. So could this have to do with the recent release of version 1.22.1 on August 25? Apologies for posting the issue in the wrong place.

from future.batchtools.

wresch avatar wresch commented on August 11, 2024

Thanks @wlandau - I can confirm the behavior and that downgrading to future 1.21.0 fixes this in our environment.

from future.batchtools.

HenrikBengtsson avatar HenrikBengtsson commented on August 11, 2024

Hi, this actually never meant to work, because resources is not an argument that is part of the Future API, and more specifically future(). It was just a side effect of ... arguments being passed down to the underlying future backend constructor (here batchtools_sge). The reason it is not meant to work is that it breaks the core philosophy that future code should not make assumptions about what backend is being used.

You can argue that being able to specify "resources" should be part of the Future API. There is indeed a plan to work on this, cf. https://www.futureverse.org/roadmap.html. With such an API, it would make sense for a developer to specify certain "resources" that is requires in order to resolve a future.

A somewhat hacky workaround would be to do something like the following in targets;

the_plan <- plan("list")
strategy <- the_plan[[1]]
if (inherits(strategy, "batchtools_template")) {
  strategy <- tweak(strategy, resources = resources)
  the_plan[[1]] <- strategy
  old_plan <- plan(the_plan)
  on.exit(plan(old_plan), add = TRUE)
}

This also highlight my point above. Imagine there's another HPC backend that names the corresponding argument, say, needs. Then you would have to add conditional code for that as well. More importantly, if the developer would use future(..., resources = ...) their code would not run as expected with this new backend. So, resources is not part of the Future API (yet).

PS. We have the related problem that batchtools don't have a strict definition of what resources should hold. So, it is really up to the person writing the template file to define what it should contain. It could be different between different HPC templates, which would again cause the code to be hard-coded for a specific backend. The goal to add support for "resource specifications" to the Future API is to at least identify a core set of well-defined specs (and syntax for it).

from future.batchtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.