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.

Async, non-blocking jobs execution

See original GitHub issue

Hi,

Your lib almost perfectly fits my use case. But, after code inspecting, I suppose there is no support for asynchronous, non blocking jobs.

What do I exactly mean? I have plenty of jobs to start (let’s say 10k/min). Each of it contains a HTTP request(s), which I call using non-blocking http client. So, I have eg. CompletableFuture[Response] and based on the response I have to decide if reschedule the task instance or not (custom task and ExecutionHandler seem to be great to do it). Currently, I have to block the thread, but this is not the way to go, because there is a lot of tasks to start (requirement: immediately or as soon as possible) and mean time of waiting for response can be ~30s. The thread is blocked and just waiting for IO.

It seems that it can be solved if db-scheduler could be able to define and use sth like async execution handler:

public interface ExecutionHandler<T> {
   CompletableFuture<CompletionHandler<T>> execute(TaskInstance<T> taskInstance, ExecutionContext executionContext);
}

Or maybe I missed sth and there is a way to achieve sth like described above? If not, WDYT about the idea to introduce async interface and adapt db-scheduler to be able to work with it? Do you see any obstacles?

Thanks for your effort. This project and your care for it looks very impressive.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
coutoPLcommented, Jun 4, 2020

Me neither. I’ve not been there yet. But I’m going to consult with you all uncertain things here. Stay tuned 😃

1reaction
coutoPLcommented, Feb 5, 2021

I identified the interface which should be changed to introduce the fact that job can be done asynchronously.

public interface ExecutionHandler<T> {
   CompletableFuture<CompletionHandler<T>> execute(TaskInstance<T> taskInstance, ExecutionContext executionContext);
}

I was going to start there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PinLater: An asynchronous job execution system - Medium
PinLater is a Thrift service to manage scheduling and execution of asynchronous jobs. It provides three actions via its API: enqueue, dequeue and...
Read more >
Launch a job and/or execute it asynchronously - Procrastinate
Execute jobs asynchronously ​​ With async tasks (such as my_task above), and with concurrency set to a value greater than 1 in the...
Read more >
asynchronous and non-blocking calls? also between blocking ...
Asynchronous means that the API always returns immediately, having started a "background" effort to fulfil your request, so there must be some ...
Read more >
How to create asynchronous non-blocking queued jobs in ...
This guide will show you how to create asynchronous non-blocking queued jobs in Wordpress. This will allow you to implement things like bulk ......
Read more >
Dealing with jobs - JPPF 3.3 Documentation
Jobs can be submitted asynchronously from the application's perspective. This means that an asynchronous (or non-blocking) job will not block the application ...
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