update cron job schedule

This commit is contained in:
MuslemRahimi 2024-10-09 19:27:58 +02:00
parent 401279d35e
commit 8831a68e61
2 changed files with 20 additions and 5 deletions

View File

@ -576,6 +576,24 @@ def run_price_analysis():
]
run_command(command)
def run_ai_score():
run_command(["python3", "cron_ai_score.py"])
run_command(["python3", "cron_stockdeck.py"])
run_command(["python3", "restart_json.py"])
# Define the directories for rsync
directories = ["stockdeck", "stock-screener", "ai-score"]
base_dir = "/root/backend/app/json"
remote_dir = f"root@{useast_ip_address}:{base_dir}"
# Rsync commands in a loop
for directory in directories:
command = [
"sudo", "rsync", "-avz", "-e", "ssh",
f"{base_dir}/{directory}",
f"{remote_dir}"
]
run_command(command)
# Create functions to run each schedule in a separate thread
def run_threaded(job_func):
@ -590,6 +608,8 @@ schedule.every().day.at("03:00").do(run_threaded, run_dark_pool)
schedule.every().day.at("05:00").do(run_threaded, run_options_gex).tag('options_gex_job')
schedule.every().day.at("06:00").do(run_threaded, run_historical_price).tag('historical_job')
schedule.every().day.at("06:30").do(run_threaded, run_ai_score).tag('ai_score_job')
schedule.every().day.at("07:00").do(run_threaded, run_ta_rating).tag('ta_rating_job')
schedule.every().day.at("09:00").do(run_threaded, run_hedge_fund).tag('hedge_fund_job')
schedule.every().day.at("07:30").do(run_threaded, run_government_contract).tag('government_contract_job')

View File

@ -33,10 +33,6 @@ def run_restart_cache():
subprocess.run(["pm2", "restart","fastapi"])
subprocess.run(["pm2", "restart","fastify"])
def run_stockdeck():
week = datetime.today().weekday()
if week <= 5:
subprocess.run(["python3", "cron_stockdeck.py"])
def run_json_job():
# Run the asynchronous function inside an asyncio loop
@ -56,7 +52,6 @@ def run_threaded(job_func):
schedule.every().day.at("06:30").do(run_threaded, run_pocketbase).tag('pocketbase_job')
schedule.every().day.at("13:30").do(run_threaded, run_stockdeck).tag('stockdeck_job')
schedule.every().day.at("15:45").do(run_threaded, run_restart_cache)
schedule.every(2).hours.do(run_threaded, run_json_job).tag('json_job')
schedule.every(1).minutes.do(run_threaded, run_cron_price_alert).tag('price_alert_job')