I have a list of ids which are called oaids and I want them to be downloaded from monday to friday from midnight until 6pm, but only during a certain time period of the day. As it is a list, I want the job not to start again if it have been already downloaded.
Below the way I though but I am not sure, do you have any suggestions?
import schedule
from schedule import repeat
from more_itertools import chunked
def main():
oaids = ['id1', 'id2', 'others..']
for chunked_oaids in chunked(oaids, os.cpu_count()):
schedule.every() \
.monday \
.to(5).days \
.at('00:00:00') \
.to(15).hours \
.do(do_download_job, oaids=chunked_oaids)
def do_download_job(oaids):
with ProcessPoolExecutor(os.cpu_count()) as ex:
results = [ex.submit(download_and_upload, oaid, target_az_container, az_subfolder) for oaid in oaids]