lparallel icon indicating copy to clipboard operation
lparallel copied to clipboard

Add execute-task to execute task and discard return value

Open tmccombs opened this issue 9 years ago • 11 comments

This allows you to schedule a task without the overhead of needing to keep track of the return value.

tmccombs avatar Feb 15 '16 20:02 tmccombs

I would really like to see this merged. Right now I'm running a special worker just to keep the channel from accumulating endless amounts of return values.

jorams avatar Feb 25 '16 09:02 jorams

@jorams Something like this also works

(lparallel.kernel::submit-raw-task
   (lparallel.kernel::make-task-instance
    (lambda ()
      (apply handler args))
    :cl-events)
   *kernel*)

deadtrickster avatar Feb 25 '16 10:02 deadtrickster

@deadtrickster but you have to use non-exported functions in that. And my change basically just exports a function that does that.

tmccombs avatar Feb 25 '16 20:02 tmccombs

Sorry for the delay. I think this is a good idea, though I'd prefer a name that makes it clearer what is happening -- maybe submit-untracked-task or submit-unchanneled-task or submit-task/no-channel? I'm open to suggestions. There could also be a trivial wrapper macro to match future syntax.

lmj avatar Feb 26 '16 20:02 lmj

I think I would go with submit-bare-task. There are complications with error handling which remind me that I've visited this issue before. The transfer-error restart, which is bound at the start of each worker, can't transfer an error since there is no channel. Hiding the restart inside a bare task seems like a bad idea because the user probably expects *debug-tasks-p* and (task-handler-bind ((error #'invoke-transfer-error)) ...) to work with bare tasks. Thus transfer-error should stay, yet not do what it is advertised to do. I suppose we tell users that in the context of a bare task transfer-error means transfer to oblivion.

lmj avatar Feb 27 '16 15:02 lmj

Random idea (that might give better ideas to someone else or make submit-bare-task look even better): submit-task-and-forget.

luismbo avatar Feb 27 '16 15:02 luismbo

Can't just a future be used for that purpose?

mdbergmann avatar May 26 '20 13:05 mdbergmann

A future needs to keep track of the result value. The purpose of this PR is to provide a way to schedule a task without needing the overhead of keeping the result value.

tmccombs avatar May 26 '20 20:05 tmccombs

In Java/Scala you can define a future like Future[Unit] which basically is a future without result.

Anyway. I don't want to interfere with this PR. What's keeping it from getting merged?

mdbergmann avatar May 27 '20 06:05 mdbergmann

What is keeping this from being merged?

sabracrolleton avatar Oct 19 '22 19:10 sabracrolleton

Yes, I also want this behavior. I don't want to have to purge the channel of unwanted return values. Is anyone managing this repo? It looks dead.

MonadMania avatar Jul 08 '24 20:07 MonadMania