Re: Heroku Scheduler API ?

2019-04-20 Thread localhostdotdev
On Tuesday, November 3, 2015 at 6:58:05 AM UTC+1, Greg Navis wrote:
>
> I work on a Rails app and have 3 entry point jobs: every_day, every_hour, 
> every_10_minutes. There are scheduler entries that run rake every_day, rake 
> every_hour and rake every_10_minutes with appropriate frequencies. Specific 
> jobs are defined as dependencies of these entry points. This allows me to 
> change the schedule by editing the code without touching the scheduler at 
> all.
>

thanks a lot for that great solution.

class EveryJob < ApplicationJob
  queue_as :default

  def perform(time)
if time == 10.minutes
  # do something
else
  raise "#{time} is not supported"
end
  end
end

and then in heroku scheduler:

rails runner "EveryJob.perform_later(10.minutes)"

works great

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Heroku" group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Heroku Scheduler API ?

2015-11-05 Thread Greg Navis
It seems the scheduler cannot be manipulated via the API at the moment. I
came up with three workarounds:

1. in your web process, start a thread that will run a one-off dyno to do
the background job in regular intervals (or do the processing in the thread
itself)
2. start a one-off dyno while processing a request - record the time when
the processing was run and if it's longer than 24 hours then run the
processing again (by starting a one-off dyno)
3. define a non-web process type that will do the processing in the
background (this will cost more though)

I absolutely realise that these are hacky, ugly workarounds. Do you think
you can apply one of them to your case? Maybe there are some other
workarounds.

Best regards

On Tue, Nov 3, 2015 at 2:10 PM, Regan Starr  wrote:

> Thanks Greg.
>
> I can see how that would work for some situations. Unfortunately, I'm
> trying to do something slightly different.
>
> I create small, open-source apps. I recently discovered the Heroku
> Platform API. Using /app-setups
> ,
> I'm able to let people deploy my apps on their own Heroku account with just
> a few clicks.
>
> Many of my apps require a "run this PHP script once a day" type of job.
> I'm trying to eliminate as much configuration for my users as possible.
>
> I know I can include add-ons during the /app-setup process, but I need to
> take it a step further and schedule a job on behalf of my users.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Heroku" group.
>
> To unsubscribe from this group, send email to
> heroku+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/heroku?hl=en_US?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Heroku Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to heroku+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Heroku" group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Heroku Scheduler API ?

2015-11-05 Thread Greg Navis
No problem, Regan! I'd love to learn how each of these options worked for
you.

On Fri, Nov 6, 2015 at 3:17 AM, Regan Starr  wrote:

> Thank you very much Greg.
>
> I will explore these options and see if any will work for my case.
>
> Regan
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Heroku" group.
>
> To unsubscribe from this group, send email to
> heroku+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/heroku?hl=en_US?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Heroku Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to heroku+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Heroku" group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Heroku Scheduler API ?

2015-11-05 Thread Regan Starr
Thank you very much Greg.

I will explore these options and see if any will work for my case.

Regan

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Heroku" group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Heroku Scheduler API ?

2015-11-03 Thread Regan Starr
Thanks Greg. 

I can see how that would work for some situations. Unfortunately, I'm 
trying to do something slightly different.

I create small, open-source apps. I recently discovered the Heroku Platform 
API. Using /app-setups 
,
 
I'm able to let people deploy my apps on their own Heroku account with just 
a few clicks.

Many of my apps require a "run this PHP script once a day" type of job. I'm 
trying to eliminate as much configuration for my users as possible.

I know I can include add-ons during the /app-setup process, but I need to 
take it a step further and schedule a job on behalf of my users.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Heroku" group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Heroku Scheduler API ?

2015-11-02 Thread Greg Navis
It seems there's no API (good to know!) but I have a workaround. Maybe
it'll be useful for you too.

I work on a Rails app and have 3 entry point jobs: every_day, every_hour,
every_10_minutes. There are scheduler entries that run rake every_day, rake
every_hour and rake every_10_minutes with appropriate frequencies. Specific
jobs are defined as dependencies of these entry points. This allows me to
change the schedule by editing the code without touching the scheduler at
all.

Will that work for you? What kind of problem are you trying to solve?

On Tue, Nov 3, 2015 at 2:59 AM, Regan Starr  wrote:

> Any update on this?
>
> I would love to have an API for creating new jobs in the Scheduler.
>
> Regan Starr
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Heroku" group.
>
> To unsubscribe from this group, send email to
> heroku+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/heroku?hl=en_US?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Heroku Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to heroku+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Heroku" group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Heroku Scheduler API ?

2015-11-02 Thread Regan Starr
Any update on this?

I would love to have an API for creating new jobs in the Scheduler.

Regan Starr

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Heroku" group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Heroku Scheduler API ?

2012-03-09 Thread Martin Moss
How would I use this to run a PHP script?
On Mar 5, 2012 3:02 AM, Mark Pundsack m...@heroku.com wrote:

 Sorry for the delayed response. We updated the docs to mention running
 Procfile entries via `heroku run`:
 http://devcenter.heroku.com/articles/oneoff-admin-ps

 Anything that works via `heroku run` works via Heroku Scheduler. Just put
 the name of the process type as the 'task in Scheduler. No special syntax
 required. And you can even pass it arguments.

 On Feb 22, 2012, at 5:51 PM, kowsik wrote:

 Didn't know that. I thought the scheduler can only run commands, like
 rake tasks and what not. Assuming my Procfile has this:

 cleanup: bundle exec rake jobs:cleanup

 How exactly can the scheduler reference the cleanup process without
 duplicating the 'bundle exec ..' line?

 K.
 ---
 http://blitz.io
 @k0ws1k

 On Wed, Feb 22, 2012 at 8:04 AM, Mark Pundsack m...@heroku.com wrote:

 Thanks for the feedback.


 In case this wasn't obvious, Scheduler can certainly reference elements in
 the Procfile. If you've got a cleanup entry defined, for example, you can
 just set up Scheduler to run cleanup every hour, or whatever.


 On Feb 22, 2012, at 7:58 AM, kowsik wrote:


 I second the the API and/or the CLI integration. We have multiple apps

 with various background processes. It's hard to get a global

 perspective of what exactly is happening in the app, since the

 scheduler tasks are not in the Procfile.


 So I would have to check the Procfile, do a heroku ps, go to the

 scheduler's dashboard and see what's scheduled for when to really

 understand the app. This is especially important when we add new

 members to the team.


 Maybe the scheduler should reference a named element in the Procfile?


 K.

 ---

 http://blitz.io

 @k0ws1k


 On Wed, Feb 22, 2012 at 7:13 AM, Mark Pundsack m...@heroku.com wrote:

 Sorry, there's no API for scheduler. Can I ask what you want one for?


 On Feb 22, 2012, at 3:05 AM, Michel Pigassou wrote:


 Hi

 Is there an API for the Heroku Scheduler

 (https://addons.heroku.com/scheduler) or do we have to go through the web
 UI

 ?


 --

 You received this message because you are subscribed to the Google Groups

 Heroku group.

 To view this discussion on the web visit

 https://groups.google.com/d/msg/heroku/-/9OFedCoHRF4J.

 To post to this group, send email to heroku@googlegroups.com.

 To unsubscribe from this group, send email to

 heroku+unsubscr...@googlegroups.com.

 For more options, visit this group at

 http://groups.google.com/group/heroku?hl=en.



 --

 You received this message because you are subscribed to the Google Groups

 Heroku group.

 To post to this group, send email to heroku@googlegroups.com.

 To unsubscribe from this group, send email to

 heroku+unsubscr...@googlegroups.com.

 For more options, visit this group at

 http://groups.google.com/group/heroku?hl=en.


 --

 You received this message because you are subscribed to the Google Groups
 Heroku group.

 To post to this group, send email to heroku@googlegroups.com.

 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.

 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.



 --

 You received this message because you are subscribed to the Google Groups
 Heroku group.

 To post to this group, send email to heroku@googlegroups.com.

 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.

 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.



 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Scheduler API ?

2012-02-22 Thread Mark Pundsack
Sorry, there's no API for scheduler. Can I ask what you want one for?

On Feb 22, 2012, at 3:05 AM, Michel Pigassou wrote:

 Hi
 Is there an API for the Heroku Scheduler 
 (https://addons.heroku.com/scheduler) or do we have to go through the web UI ?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Heroku group.
 To view this discussion on the web visit 
 https://groups.google.com/d/msg/heroku/-/9OFedCoHRF4J.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to 
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Scheduler API ?

2012-02-22 Thread kowsik
I second the the API and/or the CLI integration. We have multiple apps
with various background processes. It's hard to get a global
perspective of what exactly is happening in the app, since the
scheduler tasks are not in the Procfile.

So I would have to check the Procfile, do a heroku ps, go to the
scheduler's dashboard and see what's scheduled for when to really
understand the app. This is especially important when we add new
members to the team.

Maybe the scheduler should reference a named element in the Procfile?

K.
---
http://blitz.io
@k0ws1k

On Wed, Feb 22, 2012 at 7:13 AM, Mark Pundsack m...@heroku.com wrote:
 Sorry, there's no API for scheduler. Can I ask what you want one for?

 On Feb 22, 2012, at 3:05 AM, Michel Pigassou wrote:

 Hi
 Is there an API for the Heroku Scheduler
 (https://addons.heroku.com/scheduler) or do we have to go through the web UI
 ?

 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/heroku/-/9OFedCoHRF4J.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.


 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Scheduler API ?

2012-02-22 Thread kowsik
Didn't know that. I thought the scheduler can only run commands, like
rake tasks and what not. Assuming my Procfile has this:

cleanup: bundle exec rake jobs:cleanup

How exactly can the scheduler reference the cleanup process without
duplicating the 'bundle exec ..' line?

K.
---
http://blitz.io
@k0ws1k

On Wed, Feb 22, 2012 at 8:04 AM, Mark Pundsack m...@heroku.com wrote:
 Thanks for the feedback.

 In case this wasn't obvious, Scheduler can certainly reference elements in 
 the Procfile. If you've got a cleanup entry defined, for example, you can 
 just set up Scheduler to run cleanup every hour, or whatever.

 On Feb 22, 2012, at 7:58 AM, kowsik wrote:

 I second the the API and/or the CLI integration. We have multiple apps
 with various background processes. It's hard to get a global
 perspective of what exactly is happening in the app, since the
 scheduler tasks are not in the Procfile.

 So I would have to check the Procfile, do a heroku ps, go to the
 scheduler's dashboard and see what's scheduled for when to really
 understand the app. This is especially important when we add new
 members to the team.

 Maybe the scheduler should reference a named element in the Procfile?

 K.
 ---
 http://blitz.io
 @k0ws1k

 On Wed, Feb 22, 2012 at 7:13 AM, Mark Pundsack m...@heroku.com wrote:
 Sorry, there's no API for scheduler. Can I ask what you want one for?

 On Feb 22, 2012, at 3:05 AM, Michel Pigassou wrote:

 Hi
 Is there an API for the Heroku Scheduler
 (https://addons.heroku.com/scheduler) or do we have to go through the web UI
 ?

 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/heroku/-/9OFedCoHRF4J.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.


 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.

 --
 You received this message because you are subscribed to the Google Groups 
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to 
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/heroku?hl=en.


 --
 You received this message because you are subscribed to the Google Groups 
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to 
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/heroku?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.