Search code examples
pythonpandasdataframeschedule

Why is my scheduled job running automatically?


I run the cell and it just runs continuously without stopping. Instead id like to have the script not start until the time period is triggered.

I have 4 functions being called in the main function. What am I missing?

Here's my script:



def main():
    print("Lets connect to Snowflake...")
    SnowDB = ConnectSnow('email.com', passwordSNOW)
    print("Reading Snowflake statement")
    DFsnow = SnowZips(sqlzipterry)
    print("Lets connect to Salesforce...")
    SFDB = ConnectSalesforce('email.com', passwordSF)
    print("Reading Salesforce statement")
    df2 = SFZips(sf_data)
    Final  = MergeZips(df2,df1)
    
#schedule.every().day.at("16:30").do(main) 
schedule.every(1).minutes.do(main)


while True:
    schedule.run_pending()
    time.sleep(1)

Thanks!


Solution

  • u are running the code inside a while loop with true condition so it will start executing infinitely .