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

Scheduling Job at specific time feature is not working properly #6

Closed
SureshKL opened this issue Jan 18, 2020 · 1 comment
Closed

Comments

@SureshKL
Copy link

"""
Version Details:
    Python 3.7.4
    async-cron==1.6.1
"""
import asyncio
import sys

from async_cron.job import CronJob
from async_cron.schedule import Scheduler


def test(name):
    print(name)


sch = Scheduler(locale='en', check_interval=1)
job1 = CronJob()
job1.at('2020-01-18 22:34').go(test, ('test_job',))  # Does not get triggered when time is elapsed
job2 = CronJob()
job2.at('22:34').go(test, ('test_job',))  # Job triggered but fails with: TypeError: shift() keywords must be strings


if __name__ == '__main__':
    try:
        print('Start')
        sch.add_job(job1)
        sch.add_job(job2)
        loop = asyncio.get_event_loop()
        loop.run_until_complete(sch.start())
    except KeyboardInterrupt:
        sys.exit()
@aohan237
Copy link
Owner

job1, not triggered because default time is utc, you did not specify the timezone info, time_shift params of at function is the key. such as UTC/GMT+08:00, time_shift=8.

job2, if you use only hour and minute, you must specify the time unit , otherwise, it will not know which unit , such as daily or weekly.

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

2 participants