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

docs: How to run cron jobs #44

Closed
agronholm opened this issue Nov 7, 2013 · 14 comments
Closed

docs: How to run cron jobs #44

agronholm opened this issue Nov 7, 2013 · 14 comments

Comments

@agronholm
Copy link
Owner

Originally reported by: Thomas Güttler (Bitbucket: thomas-guettler, GitHub: Unknown)


Please explain in the docs how to run example:

http://pythonhosted.org/APScheduler/cronschedule.html#example-1

My question (and I guess other people have this question, too):

How to execute this line?

Example: Linux server boots. The above snippet is installed somewhere, ... but how does this example get executed?

Please tell me, if you don't understand my question.


@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Other people have not had trouble running the provided examples. You are the first and only one to have asked such questions.
I'm interested in what you are missing. Which line are you referring to in the example?

@agronholm
Copy link
Owner Author

Original comment by Thomas Güttler (Bitbucket: thomas-guettler, GitHub: Unknown):


What I am missing:

  • Imagine the operating system is switched off.
  • now the server boots.
  • Normal cron (vixie) daemon starts, but this does not affect APScheduler (AFAIK).
  • According to my point of view, the above example lines won't get executed. Nothing will happen.

Do you understand what I am missing? I am missing documentation how the APScheduler gets started. Forgive me, if I am blind. I have not found it in the documentation.

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Maybe there is a big misunderstanding here. APScheduler is a Python library, not a command line tool or daemon. Your questions would make sense if it were one. APScheduler is meant to be used as a part of an existing Python application, so asking about starting it via upstart, init.d etc. doesn't make sense.

@agronholm
Copy link
Owner Author

Original comment by John Matthew (Bitbucket: jmatthew, GitHub: jmatthew):


I've seen these confusions on multiple issues, it may be worth having a section saying what apscheduler is and is not?

J

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


I thought the introduction made it crystal clear. From the short description:
"In-process task scheduler with Cron-like capabilities"
The "In-process" part already implies that it runs within an existing process.

Clue #2, from the longer description:
"This can be a far better alternative to externally run cron scripts for long-running applications (e.g. web applications), as it is platform neutral and can directly access your application's variables and functions."

If APScheduler can access the application's variables directly, then it runs within the application's process, right? After all this, can there be any confusion as to whether this is a daemon/command line tool or not?

@agronholm
Copy link
Owner Author

Original comment by John Matthew (Bitbucket: jmatthew, GitHub: jmatthew):


Oh I understand, but you mention CRON-LIKE a few times in the docs, which if your reading it quickly you may think it's cron.

Also, more importantly, I think you're the only project that actually does this, which means your way out of the box in terms of what you do (a very good thing). I'll i'm saying is for those people that have mentioned this "issue" it might be worth a quick couple paragraphs on how to implement apscheduler ?

J

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Well, there is cron-like scheduling of course, but so there is one in Quartz too, and I've yet to hear anyone mistake Quartz for a daemon or command line tool.

As for implementing apscheduler, there are examples as early as the second page in the docs: https://apscheduler.readthedocs.org/en/v2.1.0/#starting-the-scheduler
Or is this not what you meant by implementing it?

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


That said, I could take this into account when I rewrite the documentation for APScheduler 3.0.

@agronholm
Copy link
Owner Author

Original comment by John Matthew (Bitbucket: jmatthew, GitHub: jmatthew):


I'm just thinking that a little more explanation, might save you new 'issues' like these, that's all.

I love the project, is EXACTLY what I needed for my project, thanks for making and keeping it moving forward.

J

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Alright, I'll clarify things up front in the next iteration of the docs.

@agronholm
Copy link
Owner Author

Original comment by Unknown Name (Bitbucket: c24b, GitHub: c24b):


I see also a great difference between documentation and implementation:

scheduling a job using new scheduler.add_job() method say it requires more arguments than described in docs and example:

sched.add_job(backup, 'cron', {'day_of_week': 'mon-fri', 'hour': 5, 'minute': 30})

as specified in http://apscheduler.readthedocs.org/en/latest/cronschedule.html

thraw a TypeError
TypeError: add_job() takes at least 5 arguments (3 given)

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


The "latest" docs refer to APScheduler 3.0 which has yet to be released. This syntax has not even been finalized yet. The documentation on readthedocs is automatically generated whenever I push a commit to bitbucket. Perhaps this is not such a good idea.

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


I have modified the documentation link and changed RTD settings so that by default the documentation link points to the latest release (which is v2.1.0 as of this writing).

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


I believe the new docs have covered this well enough.

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

No branches or pull requests

1 participant