Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger Jobs Manually #452

Closed
tanweerdev opened this issue Aug 24, 2020 · 11 comments · Fixed by #459
Closed

Trigger Jobs Manually #452

tanweerdev opened this issue Aug 24, 2020 · 11 comments · Fixed by #459
Assignees

Comments

@tanweerdev
Copy link

something like

    |> Quantum.Job.set_name(:test)
    |> Quantum.Job.set_schedule(:asap or :now)
    |> Quantum.Job.set_task(fn ->
      IO.puts("#{Timex.now()} - first hello")
    end)
    |> add_job()

#392

@maennchen
Copy link
Member

Currently this is not possible.

Why would you want to do this via quantum? Wouldn‘t Job.async or similar work for you?

@tanweerdev
Copy link
Author

tanweerdev commented Aug 24, 2020

@maennchen Job.async is part of some library? which one?

@maennchen
Copy link
Member

@tanweerdev Sorry, I meant Task.async:

https://hexdocs.pm/elixir/Task.html#async/3

@tanweerdev
Copy link
Author

tanweerdev commented Aug 24, 2020

I am getting this warning and timeout inside a channel event handle_in/3
[warn] Phoenix.Channel.Server #PID<0.765.0> received unexpected message in handle_info/2: {#Reference<0.4027534044.3015442433.81688>, {:ok, %ChannelConnection{__meta__: #Ecto.Schema.Metadata<:loaded, "channel_connections">, ...updated_at: ~N[2020-08-24 11:49:10.057884]}}}
and the documentation says Starts a task that must be awaited on. but I dont want to wait for this task to finish. This should continue totally independently...

@tanweerdev
Copy link
Author

@maennchen I mean now is also a timestamp and quantum should be able to handle it

@maennchen
Copy link
Member

@tanweerdev You can also run it completely independently with Task. Have a look at its functions.

Quantum currently only works with cron expressions. Opening that functionality up for different methods would be a long time goal (#268). Just adding a single atom as a schedule is however not a direction I‘d lile to go.

Quantum is about scheduling tasks i. intervals and i. the future. For right now there’s a lot of other options.

@ericdude4
Copy link
Contributor

Quantum handles event overlap, so it would be nice to be able to call MyApp.Scheduler.run_job(:my_job) and then have the overlap prevention stop this "one-off" job from overlapping with the normal job schedule.

@maennchen maennchen changed the title is there a way I can run the job now(ASAP) and only once Trigger Jobs Manually Sep 7, 2020
@maennchen
Copy link
Member

@ericdude4 That sounds like a reasonable enhancement. A PR would be very welcome.

@ericdude4
Copy link
Contributor

@maennchen I would be happy to

@maennchen
Copy link
Member

@ericdude4 Great! If you have any questions, I'll be happy to provide some guidance. (Here or on #quantum in the elixir slack.)

@maennchen
Copy link
Member

Released as v3.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants