# Path: mrq/context.py
# _GLOBAL_CONTEXT = {
# 
#     # Contains all the running greenlets for this worker. greenletid => Job object
#     "greenlets": {},
# 
#     # pointer to the current worker
#     "worker": None,
# 
#     # pointer to the current config
#     "config": {}
# }
# def setup_context(**kwargs):
# def set_current_job(job):
# def get_current_job(greenlet_id=None):
# def set_current_worker(worker):
# def get_current_worker():
# def set_logger_config():
# def set_current_config(config):
# def get_current_config():
# def retry_current_job(delay=None, max_retries=None, queue=None):
# def abort_current_job():
# def _connections_factory(attr):
#     def versiontuple(v):
# def enable_greenlet_tracing():
#     def trace(*args):
# def run_task(path, params):
# def set_current_job_progress(ratio, save=False):
# def queue_raw_jobs(*args, **kwargs):
# def queue_job(*args, **kwargs):
# def queue_jobs(*args, **kwargs):
# def metric(*args, **kwargs):


from future.builtins import str, object
from .context import log, queue_job
import datetime
import ujson as json
import time
            interval = datetime.timedelta(seconds=task["interval"])

            if task["datelastqueued"] >= now:
                continue

            if task.get("monthday", current_monthday) != current_monthday:
                continue

            if task.get("weekday", current_weekday) != current_weekday:
                continue

            if task.get("dailytime"):
                if task["datelastqueued"].date() == now.date() or now.time() < task["dailytime"].time():
                    continue

            # if we only have "interval" key
            if all(k not in task for k in ["monthday", "weekday", "dailytime"]):
                if now - task["datelastqueued"] < interval:
                    continue

            queue_job(
                task["path"],
                task.get("params") or {},
                queue=task.get("queue")
            )

            self.collection.update({"_id": task["_id"]}, {"$set": {
                "datelastqueued": now
            }})


# Path: mrq/context.py
# _GLOBAL_CONTEXT = {
# 
#     # Contains all the running greenlets for this worker. greenletid => Job object
#     "greenlets": {},
# 
#     # pointer to the current worker
#     "worker": None,
# 
#     # pointer to the current config
#     "config": {}
# }
# def setup_context(**kwargs):
# def set_current_job(job):
# def get_current_job(greenlet_id=None):
# def set_current_worker(worker):
# def get_current_worker():
# def set_logger_config():
# def set_current_config(config):
# def get_current_config():
# def retry_current_job(delay=None, max_retries=None, queue=None):
# def abort_current_job():
# def _connections_factory(attr):
#     def versiontuple(v):
# def enable_greenlet_tracing():
#     def trace(*args):
# def run_task(path, params):
# def set_current_job_progress(ratio, save=False):
# def queue_raw_jobs(*args, **kwargs):
# def queue_job(*args, **kwargs):
# def queue_jobs(*args, **kwargs):
# def metric(*args, **kwargs):


# Path: mrq/scheduler.py
from future.builtins import str, object
from .context import log, queue_job
import datetime
import ujson as json
import time

            interval = datetime.timedelta(seconds=task["interval"])

            if task["datelastqueued"] >= now:
                continue

            if task.get("monthday", current_monthday) != current_monthday:
                continue

            if task.get("weekday", current_weekday) != current_weekday:
                continue

            if task.get("dailytime"):
                if task["datelastqueued"].date() == now.date() or now.time() < task["dailytime"].time():
                    continue

            # if we only have "interval" key
            if all(k not in task for k in ["monthday", "weekday", "dailytime"]):
                if now - task["datelastqueued"] < interval:
                    continue

            queue_job(
                task["path"],
                task.get("params") or {},
                queue=task.get("queue")
            )

            self.collection.update({"_id": task["_id"]}, {"$set": {
                "datelastqueued": now
            }})


            log.debug("Scheduler: queued %s" % _hash_task(task))