Git Product home page Git Product logo

Comments (7)

dbader avatar dbader commented on August 10, 2024

Hi @pawnies20. I'm not exactly sure what you mean by "kill or modify a schedule task" -- could you elaborate a bit more on what you want to achieve? Thanks.

from schedule.

robomotic avatar robomotic commented on August 10, 2024

I did like this:

   print ("Starting log...")
   schedule.every(20).minutes.do(get_weather_predictions)

   while 1:
      try:
         schedule.run_pending()
         time.sleep(2)
      except KeyboardInterrupt:
         print("Stopping scheduler")
         schedule.clear()
         print("Closing log")
         writer.close()
         break

from schedule.

pawnies20 avatar pawnies20 commented on August 10, 2024

Thank you, perfect !!!
A little question:
is it possible to cancel a specific schedule task?

Thank you very much
fred

 Le Vendredi 9 janvier 2015 12h52, Dr. Di Prodi <[email protected]> a écrit :

I did like this: print ("Starting log...")
schedule.every(20).minutes.do(get_weather_predictions)

while 1:
try:
schedule.run_pending()
time.sleep(2)
except KeyboardInterrupt:
print("Stopping scheduler")
schedule.clear()
print("Closing log")
writer.close()
break

Reply to this email directly or view it on GitHub.

from schedule.

pawnies20 avatar pawnies20 commented on August 10, 2024

Schedule.clear() works well, many thanx
But if i want to canceled a specific job what can i do?
schedule.cancel_job() or by returning schedule.CancelJob   seems don't work with me?
Thank you

Fred

 Le Vendredi 9 janvier 2015 14h41, severine fred <[email protected]> a écrit :

Thank you, perfect !!!
A little question:
is it possible to cancel a specific schedule task?

Thank you very much
fred

 Le Vendredi 9 janvier 2015 12h52, Dr. Di Prodi <[email protected]> a écrit :

I did like this: print ("Starting log...")
schedule.every(20).minutes.do(get_weather_predictions)

while 1:
try:
schedule.run_pending()
time.sleep(2)
except KeyboardInterrupt:
print("Stopping scheduler")
schedule.clear()
print("Closing log")
writer.close()
break

Reply to this email directly or view it on GitHub.

from schedule.

pawnies20 avatar pawnies20 commented on August 10, 2024

to dbader:

I only want to canceled a specific Schedule task.
Robomotic solution works fine but delete all active tasks

"Hi @pawnies20. I'm not exactly sure what you mean by "kill or modify a schedule task" -- could you elaborate a bit more on what you want to achieve? Thanks."

from schedule.

pawnies20 avatar pawnies20 commented on August 10, 2024

Please, help me !!!
Thanx

from schedule.

dbader avatar dbader commented on August 10, 2024

Hi @pawnies20 ,

you could do something like this:

def job_that_executes_once():
    # Do some work ...
    return schedule.CancelJob

schedule.today.at('10:30').do(job_that_executes_once)

Basically you let the job cancel itself the first time it executes.

(Linking this to #33 and #35)

from schedule.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.