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

FutureWarning for Cron Scheduled Jobs #299

Open
ross-spencer opened this issue Oct 10, 2023 · 0 comments
Open

FutureWarning for Cron Scheduled Jobs #299

ross-spencer opened this issue Oct 10, 2023 · 0 comments

Comments

@ross-spencer
Copy link

The current implementation is raising a FutureWarning for Cron jobs.

(venv) user:~/git/orcfax/collector-node$ python heartbeat.py 
Feeds to be removed by this heartbeat before being added: ADAUSD-ee4eed14-ffc2-11ed-9f67-67fb68ae3988
/home/user/git/orcfax/collector-node/venv/lib/python3.10/site-packages/rq_scheduler/utils.py:28: FutureWarning: Version 0.22.0+ of crontab will use datetime.utcnow() and
datetime.utcfromtimestamp() instead of datetime.now() and
datetime.fromtimestamp() as was previous. This had been a bug, which will be
remedied. If you would like to keep the *old* behavior:
`ct.next(..., default_utc=False)` . If you want to use the new behavior *now*:
`ct.next(..., default_utc=True)`. If you pass a datetime object with a tzinfo
attribute that is not None, timezones will *just work* to the best of their
ability. There are tests...
  next_time = cron.next(now=now, return_datetime=True)
Feeds queued: ADAUSD-ee4eed14-ffc2-11ed-9f67-67fb68ae3988

This seems to be the affected line:

next_time = cron.next(now=now, return_datetime=True)

This can be fixed using the default_utc argument above, or now = datetime.now(timezone.utc).

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

No branches or pull requests

1 participant