Skip to content

Instantly share code, notes, and snippets.

@trAve3113r
Last active May 6, 2018 19:28
Show Gist options
  • Save trAve3113r/dc47075aec0bbd3794ee06c74c5b6a90 to your computer and use it in GitHub Desktop.
Save trAve3113r/dc47075aec0bbd3794ee06c74c5b6a90 to your computer and use it in GitHub Desktop.
# -------------------------------- #
# the main advanatages of celery : #
# -------------------------------- #
# queueing,
# 0. http://python-rq.org/
# queueing is for invoking a function asynchronously
# retries (the most important feature)::
# 0. https://pypi.org/project/backoff/ :: perfect solution
# 1.https://julien.danjou.info/python-tenacity/
# 2.https://pypi.org/project/retrying/
# 3. https://github.com/ionelmc/python-aspectlib/blob/master/src/aspectlib/contrib.py
# multi-threading :: works on top of the Queue concept/logic
# 0.https://stackoverflow.com/questions/2846653/how-to-use-threading-in-python
# 1.https://docs.python.org/2/library/multiprocessing.html#module-multiprocessing :: much better than threading
# full-blown alternative to celery :: https://django-q.readthedocs.io/en/latest/index.html
# use::
# python-crontab
# --------------------#
# documentation links:
# https://pypi.org/project/python-crontab/
# http://blog.appliedinformaticsinc.com/managing-cron-jobs-with-python-crontab/
# https://github.com/doctormo/python-crontab
# https://github.com/manugarri/cron-metrics :: has multiple dependencies
# --------------------- #
# django-integrated solutions
# --------------------------- #
# https://github.com/kraiz/django-crontab :: no monitoring of cron job state
# https://github.com/Tivix/django-cron :: does monitoring, no queing of jobs
# https://github.com/jgorset/django-kronos
# https://bitbucket.org/wnielson/django-chronograph/
# monitor cron jobs
# ----------------- #
# https://github.com/jamesrwhite/minicron
# https://pythonhosted.org/django-cron-monitor/ :: has webUI for task states
# <https://pypi.org/project/django-cron-monitor/> :: pip install django-cron-monitor
# syslog: https://www.debuntu.org/how-to-remote-syslog-logging-on-debian-and-ubuntu/
# cron's arg :: MAILTO=someuser
# see this thread :: https://stackoverflow.com/questions/573618/django-set-up-a-scheduled-job
# or supervisor
command=/path/to/my_command.py
directory=/home/mwaiharyan/trade_bot/fx
autostart=true
startretries=5
stderr_logfile=/var/log/task_manager/err.log
user=www-data
@trAve3113r
Copy link
Author

executing cron jobs on specific days of the month,e.g,every last Monday, see http://ashok-linux-tips.blogspot.co.ke/2010/12/executing-cronjobs-on-specific-days-in.html

@trAve3113r
Copy link
Author

trAve3113r commented May 6, 2018

use 'Monit' to monitor a cron job https://mmonit.com/wiki/Monit/ConfigurationExamples#cron

check process myprocessname matching "myprocessname" start program = "nohup /usr/bin/python /path/testing.py > /tmp/test.out &" stop program = "/usr/bin/killall myprocessname"

@trAve3113r
Copy link
Author

Weird :
use a cronjob to run 'Huey' every second,every business day during the trading hours

@trAve3113r
Copy link
Author

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