Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to place time to stop the job? #160

Open
volokonski opened this issue Sep 4, 2017 · 1 comment
Open

how to place time to stop the job? #160

volokonski opened this issue Sep 4, 2017 · 1 comment

Comments

@volokonski
Copy link

hi,
I have this line of code:

schedule.every().tuesday.at("01:48").do(run_threaded, job4) #follow followers

and I have to stop this job after some exact time, as the job could crash and will not work good in next day, help me please to fix this line:

schedule.cancel_job.every().tuesday.at("01:50").do(run_threaded, job4) #follow followers

@anlcnydn
Copy link

anlcnydn commented Feb 8, 2018

Hey,

Why don't you try to schedule a new job to cancel the previous one and cancels out itself?

I mean,

schedule.every().tuesday.at("01:48").do(run_threaded, job4).tag("UNIQUE_ID_FOR_JOB4")

def job_4_canceller(): 
    schedule.clear("UNIQUE_ID_FOR_JOB4")
    return schedule.CancelJob

schedule.every().tuesday.at("01:50").do(run_threaded, job_4_canceller)

I am not sure that you are looking for this, but it seems so.

Happy scheduling!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants