update && add cron job

This commit is contained in:
MuslemRahimi 2024-08-26 10:50:52 +02:00
parent 35cbff8bbd
commit 091f031fc4
2 changed files with 14 additions and 2 deletions

View File

@ -61,11 +61,11 @@ async def run():
tasks.append(process_ticker(ticker))
# Run tasks concurrently in batches to avoid too many open connections
batch_size = 10 # Adjust based on your system's capacity
batch_size = 1 # Adjust based on your system's capacity
for i in tqdm(range(0, len(tasks), batch_size)):
batch = tasks[i:i + batch_size]
await asyncio.gather(*batch)
await asyncio.sleep(120)
#await asyncio.sleep(30)
if __name__ == "__main__":
try:

View File

@ -115,6 +115,17 @@ def run_cron_var():
]
run_command(command)
def run_cron_sector():
week = datetime.today().weekday()
if week <= 5:
run_command(["python3", "cron_sector.py"])
command = [
"sudo", "rsync", "-avz", "-e", "ssh",
"/root/backend/app/json/sector",
f"root@{useast_ip_address}:/root/backend/app/json"
]
run_command(command)
def run_analyst_estimate():
week = datetime.today().weekday()
if week <= 5:
@ -557,6 +568,7 @@ schedule.every().day.at("13:30").do(run_threaded, run_stockdeck).tag('stockdeck_
schedule.every().day.at("13:40").do(run_threaded, run_analyst_estimate).tag('analyst_estimate_job')
schedule.every().day.at("13:45").do(run_threaded, run_similar_stocks).tag('similar_stocks_job')
schedule.every().day.at("14:00").do(run_threaded, run_cron_var).tag('var_job')
schedule.every().day.at("14:00").do(run_threaded, run_cron_sector).tag('sector_job')
schedule.every().day.at("15:45").do(run_threaded, run_restart_cache)