0
我想知道是否有人可以在使用schedule函數庫調用工作函數時如何傳遞參數。我發現在使用線程和run_threaded函數時,有一些相同的示例,但沒有任何示例。如何使用調度庫調用函數時傳遞參數?
在下面的代碼片段中,我試圖通過'sample_input'作爲參數,並混淆瞭如何定義此參數。
def run_threaded(job_func):
job_thread = threading.Thread(target=job_func)
job_thread.start()
@with_logging
def job(input_name):
print("I'm running on thread %s" % threading.current_thread())
main(input_name)
schedule.every(10).seconds.do(run_threaded, job(‘sample_input’))