0

I have a python script that reads .csv files in a specific folder every x sec/min/hour automatically. I am trying to find better way(for performance and resources) to do it. The OS is Windows.

Example code:

import os
from apscheduler.schedulers.blocking import BlockingScheduler

def s_job():
    base_dir = "C:\\path"
    csv_files = os.listdir(base_dir)
    for csv_file in csv_files:
        #read csv file and import to sql server
        ......
        #delete csv file
        os.remove(f'{base_dir}\\{csv_file}')


scheduler = BlockingScheduler()
scheduler.add_job(s_job, 'interval', hours=1)
scheduler.start()

To be honest I know scheduler but I don't know what is the BlockingScheduler. So, there are many scheduler types I can use. Are there any resources where I can find information about these scheduler types?

Thanks.

  • pythonanywhere.com has a free (but limited) scheduler – Nicholas Hansen-Feruch Oct 22 '22 at 00:00
  • 1
    "for performance and resources" what is the issue with performance that you are encountering? – juanpa.arrivillaga Oct 22 '22 at 00:01
  • 3
    You could call your script with the windows integrated task scheduler. [how create automated task using task scheduler windows 10](https://www.windowscentral.com/how-create-automated-task-using-task-scheduler-windows-10) – Ovski Oct 22 '22 at 00:08
  • I didn't encounter any errors with scheduler. I want the scripts to run periodically without encountering any errors and any memory limit error. I want to know if there is a more robust way than the scheduler. – Yakup Bilen Oct 22 '22 at 00:30

0 Answers0