Coder Social home page Coder Social logo

Comments (2)

cicdw avatar cicdw commented on May 10, 2024

So I started working on output caching for tasks; however, I quickly ran into a question: where should the cached data be stored?

I began implementing it analogously to #78 by putting the outputs into a task's State which is then fed into the FlowRunner via task_states. However, after a successful first run the returned state is Success which effectively is an output cache except with no input-validation to ensure the cache is still valid.

We could continue down this route, and let the TaskRunner perform the necessary cache-validation checks when the task has a Success state, but this might alter the fundamental behavior of the TaskRunner when it is provided with a Success state (for example, if the TaskRunner receives a Success state whose cache is not valid anymore).

Two other options I immediately see:

  • the Task itself maintains the cache
  • prefect.Context somehow maintains a cache for all tasks via a dictionary _cached_tasks

The answer should probably depend on how we envision this output cache behaving in relation to our server and whether the cache should work across Flows or not.

cc: @jlowin

from prefect.

cicdw avatar cicdw commented on May 10, 2024

Another option is to create a new State: CachedState which inherits from Success but is handled differently than a Success in that the TaskRunner will rerun this task if the cache is no longer valid. (I think I actually prefer this option the most)

from prefect.

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.