I plan to create a web service which will allow the users to spawn a large number, let's say 3k-5k, of certain types of jobs. There'll be a few different, pre-defined types of jobs.
defmoudle Job1 do
def do_work1(a, b, c) do
end
end
defmoudle Job2 do
def do_work2(a, b, c) do
end
end
# defmoudle Job10 do
# .......
Each one will take on average 5-10, up to 30 minutes to complete, if this is relevant.
It's important that the user should be able to create them at runtime, view the active ones, view the status of each, optionally pause if possible, view the progress if possible, and terminate the jobs.
Should use DynamicSupervisor
for this? How would I start a job? As Task.async(..)
... await(..)
? As Task.start(..)
? Or anything else?
And I probably wouldn't need to make each job a GenServer
, right?
Without overcomplication. Only by the means of OTP. Oban won't suit me in this case.