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

Two bug #15

Closed
Amos-x opened this issue Mar 6, 2018 · 5 comments
Closed

Two bug #15

Amos-x opened this issue Mar 6, 2018 · 5 comments
Labels
wait response Waiting response about bug fix

Comments

@Amos-x
Copy link

Amos-x commented Mar 6, 2018

  1. django_apscheduler/result_storage.py line 32 :
    job_execution.duration = float(job_execution.finished) - float(job_execution.started)
    job_execution.started or job_execution.finished is possible to be empty,so,float will raise except.
    You can simply change to:
    try: job_execution.duration = float(job_execution.finished) - float(job_execution.started) except: job_execution.duration = None

  2. django_apscheduler/models.py line 40:
    next_run_time = models.DateTimeField(db_index=True)
    Fields should not be set as required, job.pause() will not work
    You can simply change to:
    next_run_time = models.DateTimeField(db_index=True,blank=True,null=True)

@sallyruthstruik
Copy link
Collaborator

Hello,

Thank you for this info about bugs and providing patches. I'll try to fix it ASAP

@GitBib
Copy link

GitBib commented Mar 27, 2018

Another problem. Migration complete
from django_apscheduler.jobstores import DjangoJobStore, register_events File "c:\users\usi\src\django-apscheduler\django_apscheduler\jobstores.py", line 15, in <module> from django_apscheduler.models import DjangoJob File "c:\users\usi\src\django-apscheduler\django_apscheduler\models.py", line 39, in <module> class DjangoJob(models.Model): File "C:\Users\usi\AppData\Roaming\Python\Python36\site-packages\django\db\models\base.py", line 100, in __new__ app_config = apps.get_containing_app_config(module) File "C:\Users\usi\AppData\Roaming\Python\Python36\site-packages\django\apps\registry.py", line 244, in get_containing_app_config self.check_apps_ready() File "C:\Users\usi\AppData\Roaming\Python\Python36\site-packages\django\apps\registry.py", line 127, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Settings:
INSTALLED_APPS = [....,
'django_apscheduler',
]
Versions:
Django == 2.0.3
django-apscheduler == 0.2.5
apscheduler==3.5.1

@askerka
Copy link

askerka commented Apr 11, 2018

@sallyruthstruik Hi! Do you have any updates or approximate schedule of fixes?
@GitBib BTW, it doesn't look like a bug. Perhaps, you trying import model (DjangoJobStore) before django ready. Try do it in apps.py on ready event

@sallyruthstruik
Copy link
Collaborator

@asduj I'm sorry for a long reply. I've just uploaded new release: https://github.com/jarekwg/django-apscheduler/releases/tag/0.2.6. Also available on Pypi. This release fixes two bugs described above. Please, check with you project, and if all is ok I'm close the issue.

@GitBib asduj is right, looks like you import models before app initialization. If problem still exists, please give me traceback in more clear form using ```: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code

@sallyruthstruik sallyruthstruik added the wait response Waiting response about bug fix label Apr 12, 2018
@askerka
Copy link

askerka commented Apr 14, 2018

Looks good!

sallyruthstruik pushed a commit that referenced this issue Apr 14, 2018
Added exception catching in float(job_execution.finished) to prevent float(None)
Added tests for such situation
Now next_run_time allowed to be blank and null. Added migration for it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wait response Waiting response about bug fix
Projects
None yet
Development

No branches or pull requests

4 participants