Run a scheduled Oban job from iEx without waiting

I have created a scheduled job for in 1 month, but I don’t want to wait the execution to test.

How do I get the job from DB and how do I execute it ?


You can use Oban.retry_job to make it run immediately or run all jobs in the queue synchronously with Oban.drain_queue(queue: :my_queue, with_scheduled: true).

Barring either of those methods, you can get into the database and overwrite the scheduled_at timestamp:

update oban_jobs set scheduled_at = now() where state = 'scheduled' and id = ID_OF_THE_JOB

If I am ever in the process of doing some REPL driven development, and want to quickly test out Oban jobs, I’ll usually invoke them directly like so: MyApp.perform(%Oban.Job{args: %{"some" => "data"}}).