Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i have to check files in folder structure like this

|_HMR
| |__2015
| |__2016
| |__2017
|
|_TMR1
 |__2015
 |__2016
 |__2017

i use to call my function like this and it works fine

check_continuity('TMR1', 2015)
check_continuity('TMR1', 2016)
check_continuity('TMR1', 2017)
check_continuity('HMR', 2015)
check_continuity('HMR', 2016)
check_continuity('HMR', 2017)

but i would like to make this faster by using multiprocessing (concurrent.futures), so is this a right way to send arguments to my function. since first argument has only two variants and second one has three. and i want first argument to run for three different years and then second argument for three different years.

in short i would like to get the result like my previous way of calling functions individually but faster

am trying to do like this, but looks like its missing few combinations

if __name__ == '__main__':
    with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
        print('creating ThreadPoolExecutor')
        start_scrape1 = executor.map(check_continuity, ('HMR', 'TMR1'), (2015, 2016, 2017))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...