Giter VIP home page Giter VIP logo

celerybeat-mongo's Introduction

ZMap: The Internet Scanner

Build Status

ZMap is a fast single packet network scanner designed for Internet-wide network surveys. On a typical desktop computer with a gigabit Ethernet connection, ZMap is capable scanning the entire public IPv4 address space on a single port in under 45 minutes. With a 10gigE connection and netmap or PF_RING, ZMap can scan the IPv4 address space in under 5 minutes.

ZMap operates on GNU/Linux, Mac OS, and BSD. ZMap currently has fully implemented probe modules for TCP SYN scans, ICMP, DNS queries, UPnP, BACNET, and can send a large number of UDP probes. If you are looking to do more involved scans (e.g., banner grab or TLS handshake), take a look at ZGrab 2, ZMap's sister project that performs stateful application-layer handshakes.

Using ZMap

If you haven't used ZMap before, we have a step-by-step Getting Started Guide that details how to perform basic scans. Documentation about all of ZMap's options and more advanced functionality can be found in our GitHub Wiki.

If you have questions, please first check our FAQ. Still have questions? Ask the community in Github Discussions. Please do not create an Issue for usage or support questions.

Installation

The latest stable release of ZMap is version 4.1.1 and supports Linux, macOS, and BSD.

Instructions on building ZMap from source can be found in INSTALL.

Architecture

More information about ZMap's architecture and a comparison with other tools can be found in these two research papers:

If you use ZMap for published research, please cite the original research paper:

@inproceedings{durumeric2013zmap,
  title={{ZMap}: Fast Internet-wide scanning and its security applications},
  author={Durumeric, Zakir and Wustrow, Eric and Halderman, J Alex},
  booktitle={22nd USENIX Security Symposium},
  year={2013}
}

Citing the ZMap paper helps us to track ZMap usage within the research community and to pursue funding for continued development.

License and Copyright

ZMap Copyright 2023 Regents of the University of Michigan

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See LICENSE for the specific language governing permissions and limitations under the License.

celerybeat-mongo's People

Contributors

cikay avatar dimrozakis avatar dongsheng2014 avatar gmiejski avatar johnnywalnut avatar kjlockhart avatar noirbizarre avatar usrlocalben avatar zakird avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

celerybeat-mongo's Issues

New release

Would it be possible to make a new release? The 0.1.0 was in 2016 which might start to be a bit old.

Thank you!

All tasks execution stops when one task hits it's "max_run_count" value

I'm just starting testing celerybeat-mongo and it looks quite promising, however when I've got two tasks:

  • one enabled task with no "max_run_count" (call it alive)
  • one enabled task with "max_run_count" == "total_run_count" (call it dead)

Both tasks are crontab tasks with a crontab setting for executing every 1 minute.

When starting the celery beat deamon the first task get executed (as expected), and the second isn't (as expected). However After that first exectution everything freezes; the first task is not executed after the crontab cycle expires.

Restarting the celery beat deamon repeats this proces.

Looks like still alive tasks are blocked when there is a dead task in the database.

Mongo can't insert the data

celery -A celtask.celeryapp --loglevel=info beat -S celerybeatmongo.schedulers.MongoScheduler
and show
oScheduler
celery beat v3.1.20 (Cipater) is starting.
__ - ... __ - _
Configuration ->
. broker -> redis://10.1.245.138:6379/9
. loader -> celery.loaders.app.AppLoader
. scheduler -> celerybeatmongo.schedulers.MongoScheduler

. logfile -> [stderr]@%INFO
. maxinterval -> now (0s)

[2016-03-08 20:05:35,197: INFO/MainProcess] beat: Starting...
[2016-03-08 20:05:35,197: INFO/MainProcess] backend scheduler using mongodb://10.1.245.138:27017/celery:schedules

but Mongo db:celery table:schedules can't insert the data it‘s none
celtask/celeryapp.py
CELERY_MONGODB_SCHEDULER_DB = "celery",
CELERY_MONGODB_SCHEDULER_COLLECTION = "schedules",
CELERY_MONGODB_SCHEDULER_URL = "mongodb://10.1.245.138:27017",
CELERYBEAT_SCHEDULE={
"test_xsum": {
"task": "celtask.tasks.mul",
"schedule": timedelta(seconds=10),
"args": (2,3)
},
"test_crontab": {
# ececutes every monday morning at 7:30
"task": "celtask.tasks.add",
"schedule": timedelta(seconds=10),
"args": (2,3)
}

celtask/tasks.py
from future import absolute_import
import time
from celtask.celeryapp import app

@app.task
def add(x, y):
time.sleep(5)
return x + y

@app.task
def mul(x, y):
time.sleep(10)
return x * y

Duplicate key error - null key

Hi guys, look at this error:

beat raised exception <class 'mongoengine.errors.NotUniqueError'>: NotUniqueError('Tried to save duplicate unique keys (insertDocument :: caused by :: 11000 E11000 duplicate key error index: heroku_app25944079.schedules.$name_1  dup key: { : null })',)

Situation:

Everytime that I restart celerybeat, a document with an empty name is created. Even when I delete it. It has just the "total_run" and "last_run_at" attributes.

Sometimes I'm trying save a new task in the database and I get a duplicate unique keys error. I'm certain that my tasks do not have duplicate names:

# how I create my tasks name
periodic_task = celerybeatmongo.models.PeriodicTask(
        name='verify_tml_delay_{}'.format(datetime.datetime.now().isoformat()),
        ....

The weirdest thing is the document with empty data... perhaps it is related to the duplicate names?

Any guidance or suggestion will be of extreme value: i have been stuck with this for hours!

Many thanks in advance!

Cheers,

SaveConditionError when modifying PeriodicTask

Currently the scheduler tries to save all entries in its local copy of the schedule to the database in its sync()-method:

def sync(self):
    for entry in self._schedule.values():
        entry.save()

The schedule property, which is accessed by beat internally will update this local copy periodically via get_from_database().
However, get_from_database() calls sync() first before updating the dictionary:

def get_from_database(self):
    self.sync()
    d = {}
    for doc in self.Model.objects():
        d[doc.name] = self.Entry(doc)
    return d

If any Document is deleted from the PeriodicTask-Colleciton this will cause a SaveConditionError to be raised during the next get_from_database()-call. Mongoengine raises this error if an update did not update any documents (this is achieved by checking n_modified). This is always the case because the local copy is saved before fetching updates (even if its counterpart on the database no longer exists). This also causes similar race conditions when updating documents in the PeriodicTask-Collection (changes are sometimes overridden by the local copy).

Maybe the local copy should not be modified at all and therefore never be saved to the database. Instead it should only be periodically updated to avoid too many database requests.
Variables like total_run_count could be updated via atomic update so no race conditions occur.

Enabled tasks do not run when there is another schedule entry which is disabled

Hello!

I'm using celery 4.2.1 and celerybeat-mongo 0.1.0. In the tests I'm doing, I have 2 tasks:

Task A: disabled, Interval schedule (runs every hour)
Task B: enabled, Interval schedule (runs every 30 seconds)

The problem I have is that Task B executes only once.

Celery's heap of schedule entries is ordered primarily by time, because it is a queue of tuples defined in https://github.com/celery/celery/blob/4.1/celery/beat.py ('time', 'priority', 'entry'), and it doesn't take into account the enabled flag.
The next_time_to_run of Task A is always 5 seconds (because the task is disabled -> celerybeatmongo/schedulers.py - line 58).
After Task B runs for the first time, its next_time_to_run is 30 seconds.
Therefore, Task A ends up being at the top of the heap always, even though it is disabled.
This means that Task B never makes it to the top of the heap again and the Scheduler.tick() method never checks if Task B is due.

I'm looking for suggestions on how to fix this (considering that the definition of the event_t tuple is in Celery) or corrections to my analysis.

Thanks you very much for your help!

Issue with Timezone

Hello,

I opened an issue on celery repo (celery/celery#6617)

The last_run_at is saved in UTC in mongo but each time celery pick the task, it schedule it in UTC while I defined not to use UTC.

Examples: contain "unexpected keyword argument 'max_targets' "

see: my pull request.

[2014-06-24 10:18:44,237: ERROR/MainProcess] Task tasks1.add[dc50a2f3-a012-4245-b24a-1b79db4f15dd] raised unexpected: TypeError("add
() got an unexpected keyword argument 'max_targets'",)
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\celery\app\trace.py", line 240, in trace_task
R = retval = fun(_args, *_kwargs)
File "C:\Python27\lib\site-packages\celery\app\trace.py", line 437, in protected_call
return self.run(_args, *_kwargs)
TypeError: add() got an unexpected keyword argument 'max_targets'

run_immediately doesn't :)

Setting the boolean field run_immediately from false to true does not start the task at all. The only thing I see is that after I set the field to 'true' that several seconds later the run_immediately field is set back to 'false'. Logs show no task activity, the task involved is not started directly; it only follows the configured crontab schedule.

TypeError: Keyword must be String

Hi
Following is my code:

from celery import Celery

app = Celery('tasks', broker='redis://localhost')

app.config_from_object('celeryconfig')

@app.task
def add(x, y):
    return int(x) + int(y)

and following is snippet of mongo collection

{ "_id" : ObjectId("59786aa52f3dd74f7a2943d3"), "_cls" : "PeriodicTask", "name" : "Addition", "task" : "task.add", "enabled" : true, "interval" : { "every" : 1, "period" : "minute" }, "args" : [ "2", "5" ], "kwargs" : { "max_targets" : "100" } }

and when i am executing command:
celery beat -l debug -S celerybeatmongo.schedulers.MongoScheduler
it shows following error:
(image)

Interval and Crontab models as separated class

All celerybeat-mongo models are centralized on celerybeatmongo.models.PeriodicTask, having and Interval and Crontab as nested classes. I think it could be better to make Interval and Crontab as separated class. This can make easy to maintain and to write unit test.

Is not a good practice to make PeriodicTask as a "god class". The code could be messy over time when, for example, we add the Solar scheduler support.

Feature request: The ability to set UPDATE_INTERVAL via the config file

I am having issues with the short update interval. I have a large schedule and the celery beat process is spending much of its time synching the schedule. It would be great if it was possible setting the update interval in the config file. I suppose it is possible changing the interval manually, but it would be neat if it was possible through the config file.

Non-default connection and database location settings are not used

Even though I added the correct keys into my celery app.conf, celerybeat-mongo does not find / uses them and falls back to the default collection, db and host-uri.

app.conf.update(
    CELERY_MONGODB_SCHEDULER_DB="database",
    CELERY_MONGODB_SCHEDULER_COLLECTION="schedules",
    CELERY_MONGODB_SCHEDULER_URL="mongodb://127.0.0.1:27017"
)

For whatever reason the current_app.conf does not hold the keys above and the defaults are initialized. I confirmed that the above config is send correctly to the celery app, I can manually retrieve the settings and the values match as they where set in the app.conf.update above.

With some minor alterations to the MongoScheduler init method (close to the same changes @rafaelreuber suggests to the MongoScheduler instantiation) I was able to succesfully push non-default settings towards celerybeat-mongo.

Celery 4+ compatibility

Looks like lost :((
I fixed it with modifying this:

def get_from_database(self):
        d = {}
        for doc in PeriodicTask.objects():
            if doc.enabled:
                d[doc.name] = MongoScheduleEntry(doc)
        return d

And remapping tick method:

def tick(self, *args, **kwargs):
        """Run a tick - one iteration of the scheduler.

        Executes one due task per call.

        Returns:
            float: preferred delay in seconds for next call.
        """

        adjust = self.adjust
        intervals = []
        for entry in self.schedule.values():
            is_due, next_time_to_run = self.is_due(entry)
            intervals.append(adjust(next_time_to_run))
            if is_due:
                next_entry = self.reserve(entry)
                self.apply_entry(entry, producer=self.producer)
        return min(intervals + [self.sync_every])

Celery beat is not working with MongoScheduler

We run celery beat and celery worker. We use PeriodicTask correctly and save stores it the schedules collection in our db. But celery beat does not pick up the task and add to queue for worker to process on the scheduled time. It used to work for us but all of a sudden it has stopped working. So we know our task configuration is correct since it used to work. Any guidance here?

We are running the following commands:

celery --app app.celery beat -S celerybeatmongo.schedulers.MongoScheduler --loglevel=debug
celery --app app.celery worker --loglevel=debug

The logs only show:

[2023-01-09 09:23:43,294: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.
[2023-01-09 09:23:48,697: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.
[2023-01-09 09:23:54,087: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.
[2023-01-09 09:24:00,893: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.

They don't show the task being picked up despite it being in the db.

The task configuration is as follows in the db:

{
_id: ObjectId('63a38122893af0ab7af4832a'),
_cls: "PeriodicTask",
name: "test-task",
task: "scheduler.tasks.test_func",
crontab: Object,
args: Array,
kwargs: Object,
expires: 2023-12-22T18:05:00.000+00:00,
enabled: true
total_run_count: 0
max_run_count: 0
run_immediately: false
last_run_at:
}

Would appreciate any help here. Seem like an issue with how beat and the MongoScheduler interface with one another.

Using Models & Mixing with other mongoengine Models

I am looking for help with how to integrate this with an existing flask project that already uses mongoengine models.

I have this working, but only with manually entered tasks. I can't seem to figure out how to load the tasks from the database or create new ones and save them in.

Issues that I am running in with are errors about no default connections or a default connection already exists and sometimes authentication errors.

for the celery setup i have included the username and password in the connection URL, but when I try to interact within the main app it seems that it isn't using the same url for the connection.

I am using mongoengine to manage documents for another aspect of this same app. That is working and it does use the same database it uses a different login. I have checked and both of these logins have the same access to the schedule collection since they run in the same database. Is there an issue with using mongoengine for multiple purposes within the same app?

Cannot import name 'Interval'

when trying to run the example from the README I get the error:

File "/home/adonias/Workspaces/Training/celery_test/proj.py", line 11, in <module>
    from celerybeatmongo.models import PeriodicTask, Interval
ImportError: cannot import name 'Interval' from 'celerybeatmongo.models' (/home/adonias/.local/lib/python3.8/site-packages/celerybeatmongo/models.py)

Any idea why this error?

from celery import Celery

config = {
    "mongodb_scheduler_db": "my_project",
    "mongodb_scheduler_url": "mongodb://localhost:27017",
}

app = Celery('hello', broker='redis://localhost//')
app.conf.update(**config)

from celerybeatmongo.models import PeriodicTask, Interval

periodic = PeriodicTask(
    name='Importing contacts',
    task="proj.import_contacts",
    interval=Interval(every=10, period="seconds") # executes every 10 seconds.
)
periodic.save()

Race conditions throw by mongodb

Hi,

I got Race conditions errors, and sometimes, when I edit a schedule, bunch of other tasks are executed without respecting their schedules.

Reading the code, I think it could be optimized but I'm not sure enough, I post it here if someone reads me ;)

We have this in MongoSchedulers:

 def get_from_database(self):
        self.sync()
        d = {}
        for doc in self.Model.objects.filter(enabled=True):
            d[doc.name] = self.Entry(doc)
        return d

    @property
    def schedule(self):
        if self.requires_update():
            self._schedule = self.get_from_database()
            self._last_updated = datetime.datetime.now()
        return self._schedule

    def sync(self):
        logger.debug('Writing entries...')
        for entry in self._schedule.values():
            entry.save()

While in beat.py from celery, at each tick, we verify difference between previous schedule and new one, so we trigger a get_from_database quiet often because the require_upates refresh every 5sec, the same as tick time interval.

So every 5 sec, we sync, we fetch from database, and once finished, we look if we need to sync again and probably we do.

So we could let beat.py :

    def should_sync(self):
        return (
            (not self._last_sync or
             (time.monotonic() - self._last_sync) > self.sync_every) or
            (self.sync_every_tasks and
             self._tasks_since_sync >= self.sync_every_tasks)
        )

decide if we should sync :

   @property
   def schedule(self):
       return self._schedule

   def sync(self):
       logger.debug('Writing entries...')
       for entry in self._schedule.values():
           entry.save()
       self._schedule = {}
       for doc in self.Model.objects.filter(enabled=True):
           self._schedule[doc.name] = self.Entry(doc)

I need to test it.

missing import traceback line 84

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/celery/apps/beat.py", line 112, in start_scheduler
    beat.start()
  File "/usr/lib/python2.7/site-packages/celery/beat.py", line 472, in start
    self.sync()
  File "/usr/lib/python2.7/site-packages/celery/beat.py", line 475, in sync
    self.scheduler.close()
  File "/usr/lib/python2.7/site-packages/celery/beat.py", line 285, in close
    self.sync()
  File "/src/celerybeat-mongo/celerybeatmongo/schedulers.py", line 145, in sync
    entry.save()
  File "/src/celerybeat-mongo/celerybeatmongo/schedulers.py", line 84, in save
    get_logger(__name__).error(traceback.format_exc())
NameError: global name 'traceback' is not defined```

fixed: 

Publish new release

Hey there, do you think you could bump up the version and publish a new release to pypi?

Btw, the version in setup.py is 0.0.11 whereas version 0.1.0 is available on pypi.

Can't run scheduler properly

First I start scheduler with celery beat -l debug -S celerybeatmongo.schedulers.MongoScheduler but it seem like this command didn't get my config because backend scheduler is a default value

image

so i tried with this command celery -A config beat -S celerybeatmongo.schedulers.MongoScheduler -l info it return this
TypeError: name must be an instance of <class 'str'>

How to pass arguments to periodic task function

Could you share an example where the async function which will called periodically have arguments. How to save those functions and how will they be called periodically with these arguments.

CELERYBEAT_SCHEDULE Tasks not picked up by the scheduler

I am running a simple test to print hello every 30 sec using celery 4.0.2 in my django app.

@app.task()
def test():
    print("hello")

My celery config is:

CELERY_BROKER_URL = REDIS_CELERY_BROKER_URL
CELERY_RESULT_BACKEND = REDIS_CELERY_RESULT_URL  # 'sqs;//' no support for SQS result backend for now
CELERY_MONGODB_SCHEDULER_DB = MONGO_DB
CELERY_MONGODB_SCHEDULER_COLLECTION = "schedules"
CELERY_MONGODB_SCHEDULER_URL = MONGO_URL
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ENABLE_UTC = True
CELERY_DEFAULT_QUEUE = CELERY_DEV_QUEUE
CELERY_QUEUES = {
    CELERY_DEFAULT_QUEUE: {
        'exchange': CELERY_DEFAULT_QUEUE,
        'binding_key': CELERY_DEFAULT_QUEUE,
    }
}

CELERY_BEAT_SCHEDULE = {
    'test': {
        'task': 'proj.tasks.test',
        'schedule': crontab(minute='*/2')
    }
}

The task is picked up when using the default celery.beat.PersistentScheduler but not when using the celerybeatmongo.schedulers.MongoScheduler

The command I use is:
celery beat -A proj -l debug -S celerybeatmongo.schedulers.MongoScheduler

The log says:

[2016-12-17 06:55:13,748: DEBUG/MainProcess] beat: Ticking with max interval->5.00 seconds
[2016-12-17 06:55:14,486: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.
[2016-12-17 06:55:19,492: DEBUG/MainProcess] beat: Synchronizing schedule...
[2016-12-17 06:55:19,492: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.
[2016-12-17 06:55:24,496: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.

There's no document in the mongoDB.

rs0:PRIMARY> db.schedules.find().count(); 
0 

The mongodb is my main database and the user has read-write permission.

Is there any way to fix it? Am I doing anything wrong??

Auto-reconnect fails when intermediate connection problems with MongoDB, causing celery beat to stop

Hi Guys,

We've noticed that celerybeat-mongo doesn't handle auto-reconnect properly when there are some intermediate connection problems with MongoDB. This causes celery beat to stop working and the only way to get it back up is to do the manual restart.

Below is the log traces, Please let me know if you need any additional info and what could be the solution to this problem.

Thanks,
Oleksiy

Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/bin/celery", line 11, in
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: sys.exit(main())
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: Traceback (most recent call last):
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler CRITICAL: beat raised exception <class 'pymongo.errors.AutoReconnect'>: AutoReconnect('cluster1-shard-00-00-ho8p9.mongodb.net:27017: [Errno 111] Connection refused',) Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/celery/apps/beat.py", line 109, in start_scheduler service.start() File "/usr/local/lib/python2.7/site-packages/celery/beat.py", line 588, in start interval = self.scheduler.tick() File "/usr/local/lib/python2.7/site-packages/celery/beat.py", line 291, in tick not self.schedules_equal(self.old_schedulers, self.schedule)): File "/usr/local/lib/python2.7/site-packages/celerybeatmongo/schedulers.py", line 132, in schedule self._schedule = self.get_from_database() File "/usr/local/lib/python2.7/site-packages/celerybeatmongo/schedulers.py", line 123, in get_from_database self.sync() File "/usr/local/lib/python2.7/site-packages/celerybeatmongo/schedulers.py", line 138, in sync entry.save() File "/usr/local/lib/python2.7/site-packages/celerybeatmongo/schedulers.py", line 79, in save self._task.save() File "/usr/local/lib/python2.7/site-packages/mongoengine/document.py", line 377, in save self.ensure_indexes() File "/usr/local/lib/python2.7/site-packages/mongoengine/document.py", line 894, in ensure_indexes collection.create_index(fields, background=background, **opts) File "/usr/local/lib/python2.7/site-packages/pymongo/collection.py", line 1958, in create_index self.__create_index(keys, kwargs, session, **cmd_options) File "/usr/local/lib/python2.7/site-packages/pymongo/collection.py", line 1847, in __create_index with self._socket_for_writes() as sock_info: File "/usr/local/lib/python2.7/contextlib.py", line 17, in enter return self.gen.next() File "/usr/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 1058, in _get_socket with server.get_socket(self.__all_credentials) as sock_info: File "/usr/local/lib/python2.7/contextlib.py", line 17, in enter return self.gen.next() File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 1004, in get_socket sock_info = self._get_socket_no_auth() File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 1044, in _get_socket_no_auth sock_info = self._check(sock_info) File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 1095, in _check return self.connect() File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 972, in connect _raise_connection_failure(self.address, error) File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 283, in _raise_connection_failure raise AutoReconnect(msg) AutoReconnect: cluster1-shard-00-00-ho8p9.mongodb.net:27017: [Errno 111] Connection refused
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/main.py", line 16, in main
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: _main()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/celery.py", line 322, in main
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: cmd.execute_from_commandline(argv)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: super(CeleryCommand, self).execute_from_commandline(argv)))
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/base.py", line 275, in execute_from_commandline
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/celery.py", line 488, in handle_argv
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: return self.handle_argv(self.prog_name, argv[1:])
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: return self.execute(command, argv)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/celery.py", line 420, in execute
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: ).run_from_argv(self.prog_name, argv[1:], command=argv[0])
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/base.py", line 279, in run_from_argv
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: sys.argv if argv is None else argv, command)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/base.py", line 363, in handle_argv
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: return self(*args, **options)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/base.py", line 238, in call
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: ret = self.run(*args, **kwargs)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/bin/beat.py", line 107, in run
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: return beat().run()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/apps/beat.py", line 81, in run
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: self.start_scheduler()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/apps/beat.py", line 109, in start_scheduler
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: service.start()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/beat.py", line 588, in start
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: interval = self.scheduler.tick()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celery/beat.py", line 291, in tick
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: not self.schedules_equal(self.old_schedulers, self.schedule)):
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celerybeatmongo/schedulers.py", line 132, in schedule
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: self._schedule = self.get_from_database()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celerybeatmongo/schedulers.py", line 123, in get_from_database
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celerybeatmongo/schedulers.py", line 138, in sync
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: self.sync()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/celerybeatmongo/schedulers.py", line 79, in save
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: entry.save()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: self._task.save()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/mongoengine/document.py", line 377, in save
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: self.ensure_indexes()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/mongoengine/document.py", line 894, in ensure_indexes
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: collection.create_index(fields, background=background, **opts)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/pymongo/collection.py", line 1958, in create_index
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/pymongo/collection.py", line 1847, in __create_index
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: self.__create_index(keys, kwargs, session, **cmd_options)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: with self._socket_for_writes() as sock_info:
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/contextlib.py", line 17, in enter
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: return self.gen.next()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 1058, in _get_socket
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/contextlib.py", line 17, in enter
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: with server.get_socket(self.__all_credentials) as sock_info:
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 1004, in get_socket
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: sock_info = self._get_socket_no_auth()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: return self.gen.next()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 1044, in _get_socket_no_auth
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: sock_info = self._check(sock_info)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 1095, in _check
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: return self.connect()
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 972, in connect
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: _raise_connection_failure(self.address, error)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: File "/usr/local/lib/python2.7/site-packages/pymongo/pool.py", line 283, in _raise_connection_failure
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: raise AutoReconnect(msg)
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: pymongo.errors
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: .
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: :
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: AutoReconnect
Mar 28 21:14:45 SCHED_SERVICE_PROD_scheduler WARNING: cluster1-shard-00-00-ho8p9.mongodb.net:27017: [Errno 111] Connection refused

Task enabled

Hi,

an update of the enabled propertie of the PeriodicTask model is not taken into account by the beat.
What is the solution to prevent a task of being executed ?

Bump version to 0.2.1 and upgrade pip version

I think is time to bump version to 0.2.1 and upgrade pip version.

Important issues was fixed such as:

  • All tasks execution stops when one task hits it's "max_run_count" value #55
  • Enabled tasks do not run when there is another schedule entry which is disabled #37
  • Fix date_changed is not updated when PeriodicTask instance is saved fa8dfef

Hour schedule does not work

Hello,

I'm trying different cron rules in my project where I'm trying to use celerybeat-mongo, and it seems that when I choose an hour, the task does not start.

This task did not ran at 11:40 today:


{
    _id: ObjectId('5ee348d9a633652319cb74c8'),
    _cls: 'PeriodicTask',
    name: '5ee348cec246a73eec460a2f',
    task: 'app.lib.celery_beat.schedule_job',
    crontab: {
        _cls: 'Crontab',
        minute: '40',
        hour: '11',
        day_of_week: 'fri',
        day_of_month: '*',
        month_of_year: '6'
    },
    args: [],
    kwargs: {
        task: '5ea6e85be59acce50a7b7b46',
        cron_job_id: '5ee348cec246a73eec460a2f',
        service: '5e43c0d68b5ee7b0ba9d1c39'
    },
    enabled: true,
    total_run_count: 11,
    max_run_count: 0,
    last_run_at: ISODate('2020-06-12T09:39:00.000Z'),
    run_immediately: false
}

While this task run every minutes fine:

{
    _id: ObjectId('5ee348d9a633652319cb74c8'),
    _cls: 'PeriodicTask',
    name: '5ee348cec246a73eec460a2f',
    task: 'app.lib.celery_beat.schedule_job',
    crontab: {
        _cls: 'Crontab',
        minute: '*/1',
        hour: '*',
        day_of_week: 'fri',
        day_of_month: '*',
        month_of_year: '6'
    },
    args: [],
    kwargs: {
        task: '5ea6e85be59acce50a7b7b46',
        cron_job_id: '5ee348cec246a73eec460a2f',
        service: '5e43c0d68b5ee7b0ba9d1c39'
    },
    enabled: true,
    total_run_count: 11,
    max_run_count: 0,
    last_run_at: ISODate('2020-06-12T09:39:00.000Z'),
    run_immediately: false
}

Proper versionning

Hi !

Right now, there is a new 0.0.10 that has been published, but it doesn't seems retrocompatible and we don't know what's in it.

As a consequence, it's very difficult to properly upgrade.
Is it possible to provide a changelog for versionning and to tag published version ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.