update && add cron job
This commit is contained in:
parent
35cbff8bbd
commit
091f031fc4
@ -61,11 +61,11 @@ async def run():
|
|||||||
tasks.append(process_ticker(ticker))
|
tasks.append(process_ticker(ticker))
|
||||||
|
|
||||||
# Run tasks concurrently in batches to avoid too many open connections
|
# 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)):
|
for i in tqdm(range(0, len(tasks), batch_size)):
|
||||||
batch = tasks[i:i + batch_size]
|
batch = tasks[i:i + batch_size]
|
||||||
await asyncio.gather(*batch)
|
await asyncio.gather(*batch)
|
||||||
await asyncio.sleep(120)
|
#await asyncio.sleep(30)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -115,6 +115,17 @@ def run_cron_var():
|
|||||||
]
|
]
|
||||||
run_command(command)
|
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():
|
def run_analyst_estimate():
|
||||||
week = datetime.today().weekday()
|
week = datetime.today().weekday()
|
||||||
if week <= 5:
|
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: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("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_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)
|
schedule.every().day.at("15:45").do(run_threaded, run_restart_cache)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user