question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accumulate task inputs

See original GitHub issue

Use Case

Please provide a use case to help us understand your request in context

It would be great to be able to accumulate multiple task calls and execute them all at once. Examples are neural networks and database queries: doing one request at a time we don’t use resources efficiently and get ourselves a bottleneck.

Solution

Please describe your ideal solution

The simplest solution is to implement something like this.

We need to add flush_every and flush_interval parameters to the Task class.

Alternatives

Please describe any alternatives you’ve considered, even if you’ve dismissed them

I’ve read about Task Loops, but they don’t quite work because they just run the task with the same arguments multiple times, whereas we need to run job once, but with multiple arguments.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jcristcommented, May 19, 2020

Since prefect stores state (and if using cloud/server also posts state to a server) for every task, there is always going to be overhead per task. If you’re running fast tasks in prefect, you might consider wrapping these into a bulk api and having prefect schedule them at a higher level:

def my_fast_task(x):
    ...

def batched_fast_task(args):
    return [my_fast_task(x) for x in args]

We could implement batching in prefect, but that gets complicated to schedule when dealing with retries, etc… IMO I’d like to see more use cases that require changes (and can’t be done with user-level batching) before going down this route.

For mapped tasks there’s the suggestion in #2459 that I think we would be willing to support, would this be sufficient for your needs?

0reactions
github-actions[bot]commented, Dec 3, 2022

This issue was closed because it has been stale for 14 days with no activity. If this issue is important or you have more to add feel free to re-open it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved You need to complete the following four tasks. Task
Task 1: Accumulate Inputs (6 marks) Create a program that conducts the following processes: 1) Accumulates the user's inputs. (Let users enter the...
Read more >
An Accumulation-of-Evidence Task Using Visual Pulses for ...
Here, we describe a new evidence-accumulation task for head-fixed mice navigating in a virtual reality (VR) environment.
Read more >
DAT2219d : Repetitions To Accumulate Counts and Totals
Consider how these 3 stages apply to a typical task of accumulating a total: ... from somewhere (possibly, but not necessarilly, from a...
Read more >
Behavioral task and temporal accumulation of sensory input for...
Download scientific diagram | Behavioral task and temporal accumulation of sensory input for decision-making a Schematic of task events during example trial ...
Read more >
Flow Accumulation—ArcGIS REST APIs
The type of input flow direction raster between these three influences how the FlowAccumulation task partitions and accumulates flow in each cell.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found