[UPDT] BASE: Updated scheduler add_job function call by adding it in a condition to start
This commit is contained in:
@@ -4,6 +4,7 @@ scheduler.py
|
||||
This module is used to register scheduled tasks
|
||||
"""
|
||||
|
||||
import sys
|
||||
from datetime import date, timedelta
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
@@ -83,6 +84,10 @@ def notify_expiring_documents():
|
||||
document.is_active = False
|
||||
|
||||
|
||||
if not any(
|
||||
cmd in sys.argv
|
||||
for cmd in ["makemigrations", "migrate", "compilemessages", "flush", "shell"]
|
||||
):
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.add_job(notify_expiring_assets, "interval", hours=4)
|
||||
scheduler.add_job(notify_expiring_documents, "interval", hours=4)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import calendar
|
||||
import datetime as dt
|
||||
import sys
|
||||
from datetime import date, datetime, timedelta
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
@@ -429,11 +430,12 @@ def recurring_holiday():
|
||||
recurring_holiday.save()
|
||||
|
||||
|
||||
if not any(
|
||||
cmd in sys.argv
|
||||
for cmd in ["makemigrations", "migrate", "compilemessages", "flush", "shell"]
|
||||
):
|
||||
scheduler = BackgroundScheduler()
|
||||
|
||||
# Set the initial start time to the current time
|
||||
start_time = datetime.now()
|
||||
|
||||
# Add jobs with next_run_time set to the end of the previous job
|
||||
try:
|
||||
scheduler.add_job(rotate_shift, "interval", minutes=5, id="job1")
|
||||
|
||||
@@ -133,7 +133,8 @@ def block_unblock_disciplinary():
|
||||
|
||||
|
||||
if not any(
|
||||
cmd in sys.argv for cmd in ["makemigrations", "migrate", "compilemessages", "flush"]
|
||||
cmd in sys.argv
|
||||
for cmd in ["makemigrations", "migrate", "compilemessages", "flush", "shell"]
|
||||
):
|
||||
"""
|
||||
Initializes and starts background tasks using APScheduler when the server is running.
|
||||
|
||||
@@ -48,7 +48,8 @@ def leave_reset():
|
||||
|
||||
|
||||
if not any(
|
||||
cmd in sys.argv for cmd in ["makemigrations", "migrate", "compilemessages", "flush"]
|
||||
cmd in sys.argv
|
||||
for cmd in ["makemigrations", "migrate", "compilemessages", "flush", "shell"]
|
||||
):
|
||||
"""
|
||||
Initializes and starts background tasks using APScheduler when the server is running.
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="oh-input-group oh-label__info">
|
||||
<label for="id_carryforward_expire_date" class="oh-label">{% trans "Carryforward Expire In" %}</label>
|
||||
<label for="id_carryforward_expire_date" class="oh-label">{% trans "Carryforward Expire Date" %}</label>
|
||||
<span class=" oh-info me-3" title="{% trans 'The date on which carryforward leave resets to 0. After this reset, the date will be updated to the next expiration period.' %}"></span>
|
||||
</div>
|
||||
{{form.carryforward_expire_date}}
|
||||
|
||||
@@ -5,6 +5,7 @@ This module is used to register scheduled tasks
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
from datetime import date, timedelta
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
@@ -137,6 +138,10 @@ def auto_payslip_generate():
|
||||
generate_payslip(date=date.today(), companies=companies, all=False)
|
||||
|
||||
|
||||
if not any(
|
||||
cmd in sys.argv
|
||||
for cmd in ["makemigrations", "migrate", "compilemessages", "flush", "shell"]
|
||||
):
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.add_job(expire_contract, "interval", hours=4)
|
||||
scheduler.add_job(auto_payslip_generate, "interval", hours=3)
|
||||
|
||||
@@ -48,7 +48,8 @@ def candidate_convert():
|
||||
|
||||
|
||||
if not any(
|
||||
cmd in sys.argv for cmd in ["makemigrations", "migrate", "compilemessages", "flush"]
|
||||
cmd in sys.argv
|
||||
for cmd in ["makemigrations", "migrate", "compilemessages", "flush", "shell"]
|
||||
):
|
||||
"""
|
||||
Initializes and starts background tasks using APScheduler when the server is running.
|
||||
|
||||
Reference in New Issue
Block a user