Skip to content

Instantly share code, notes, and snippets.

@osharaki
Last active May 3, 2021 14:40
Show Gist options
  • Save osharaki/356261a9618a87606ca02a8bace293b4 to your computer and use it in GitHub Desktop.
Save osharaki/356261a9618a87606ca02a8bace293b4 to your computer and use it in GitHub Desktop.
Unogs API miner: task scheduler (snippet 4/6)
if args.exec_time == "now":
job()
if not done:
# Prevent scheduling in case of permanent termination
schedule.every().day.at(default_time).do(job)
else:
schedule.every().day.at(args.exec_time).do(job)
while True:
if done:
break
n = schedule.idle_seconds()
if n >= 0:
time.sleep(n)
remaining_quota = buffer + 1
schedule.run_pending()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment