Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend API: Formally define the "state" of a future #667

Open
1 task done
HenrikBengtsson opened this issue Feb 13, 2023 · 1 comment
Open
1 task done

Backend API: Formally define the "state" of a future #667

HenrikBengtsson opened this issue Feb 13, 2023 · 1 comment
Labels
Backend API Part of the Future API that only backend package developers rely on documentation

Comments

@HenrikBengtsson
Copy link
Collaborator

HenrikBengtsson commented Feb 13, 2023

The state of a future is stored in the internal state field, which takes a character string. Supported values are:

  • "created" - the future has been created, but not yet not launched
  • "running" - the future has been launched, and is assumed to be running
  • "finished" - the future has been successfully evaluated ("resolved"); results may or may not have been collected

It is to be decided if:

  • "failed" - evaluation of the future failed
  • "interrupted" - evaluation of the future was interrupted

should also be added to the above list. They are really not needed, because they could be inferred if we collect the FutureResults object and inspect that.

In the past, this was mostly specific to the future package, but with the move to a more generic backend solution (e.g. lazy futures are vanilla Future objects until launched, make it possible to relaunch failed Future objects, etc.) we need to tighten this up and standardize it.

  • I'll start by adding internal validation to the still, internal field state, to make sure it only takes known values, e.g. by creating a $<-.Future method. (Added to future 1.32.0 [2023-03-07]).
@HenrikBengtsson
Copy link
Collaborator Author

2023-05-26: Running revdep checks with R_FUTURE_STATE_ONINVALID=error reveals that civis 3.1.2 [2023-03-31] sets the future state to "cancelled" in its cancel() for CivisFuture, cf. https://github.com/civisanalytics/civis-r/blob/51c2e2270ed52a977ebbba869a69a76f1a7311cc/R/civis_future.R#L160-L163.

@HenrikBengtsson HenrikBengtsson modified the milestones: 1.33.0, Next release Jul 1, 2023
@HenrikBengtsson HenrikBengtsson modified the milestones: 1.33.1, Next release Dec 21, 2023
@HenrikBengtsson HenrikBengtsson modified the milestones: 1.33.2, Next release Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend API Part of the Future API that only backend package developers rely on documentation
Projects
None yet
Development

No branches or pull requests

1 participant