Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 07:15
    agronholm commented #465
  • 00:33
    m3nu commented #465
  • Mar 01 13:08
    agronholm labeled #494
  • Mar 01 13:08
    agronholm closed #494
  • Mar 01 13:08
    agronholm commented #494
  • Mar 01 13:02
    felixdittrich92 opened #494
  • Feb 27 18:30
    agronholm edited #465
  • Feb 27 18:25
    agronholm edited #465
  • Feb 26 20:17

    agronholm on master

    Removed debugging code and comm… (compare)

  • Feb 26 07:48
    agronholm commented #488
  • Feb 26 07:46
    junior-senior commented #488
  • Feb 25 22:16

    agronholm on master

    Reformatted the version history… (compare)

  • Feb 25 22:07
    agronholm commented #465
  • Feb 25 22:01

    agronholm on ci-fix

    (compare)

  • Feb 25 22:01

    agronholm on master

    Fixed test setup issues (#493) … (compare)

  • Feb 25 22:01
    agronholm closed #493
  • Feb 25 22:00
    agronholm ready_for_review #493
  • Feb 25 21:57
    agronholm synchronize #493
  • Feb 25 21:57

    agronholm on ci-fix

    Switched run order (compare)

  • Feb 25 21:56
    agronholm synchronize #493
José Flores
@FloresFactorB_twitter
Basically I want to do something similar to what this endpoint does but to get me the jobs that failed and if they will run again. How can I achieve that in the simplest way?
@app.get("/schedule/show_schedules/",response_model=CurrentScheduledJobsResponse,tags=["schedule"])
async def get_scheduled_syncs():
    """
    Will provide a list of currently Scheduled Tasks

    """
    schedules = []
    for job in Schedule.get_jobs():
        schedules.append({"job_id": str(job.id), "run_frequency": str(job.trigger), "next_run": str(job.next_run_time)})
    return {"jobs":schedules}
Alex Grönholm
@agronholm
@FloresFactorB_twitter what do you mean by a failed job?
if a the target function of a job causes an exception, it will still be run on its next calculated run time
BPHT
@newTypeGeek
@agronholm I would like to clarify the CronTrigger expression: a-b. The doc said the job would Fire on any value within the a-b range (a must be smaller than b). So if I config hour='4-6', does it mean that it would only trigger the job once between hour 0400 and 0600 ?
what is the correct expression if want to trigger the job every hour between 0400 and 0600 (i.e. fires at time 0400, 0500 and 0600)
BPHT
@newTypeGeek
oh...I overlooked the doc, use , will do. So hour='4,5,6' will trigger the cronjob to fire at 0400, 0500 and 0600
Alex Grönholm
@agronholm
@newTypeGeek both will do that
like it says, any value between 4-6. Those values are 4,5,6.
Suhrob Malikov
@malikovss
hi there. how to give an attribute in job function?
Alex Grönholm
@agronholm
what do you mean?
an attribute? to what?
Suhrob Malikov
@malikovss
to function. f. e. def func(num:int):print(num); schedule.add_job(func,num=1) @agronholm
Alex Grönholm
@agronholm
you mean arguments, not attributes?
have you read the API documentation for add_job()?
Suhrob Malikov
@malikovss
@agronholm I couldn't find any example from doc.
Alex Grönholm
@agronholm
you found the API documentation for add_job() though?
Suhrob Malikov
@malikovss
@agronholm thanks
Alex Grönholm
@agronholm
@malikovss to improve the documentation, could I ask why you were unable to find this on your own? where did you look?
Alex Grönholm
@agronholm
yes, and the relevant API documentation can be accessed by clicking on add_job()
did you expect there to be examples for every possible parameter of that method?
Mirkenan Kazımzade
@Kenan7

so İ have a Bot class which is from twitchio package, and that's running asynchronously.

what would I have to do if I wanted to make apshceduler and twitchio bot run together?

aim: I will update the data periodically so my bot will respond faster

from twitchio.ext import commands

class Bot(commands.Bot):
    def __init__(self):
        ...

bot = Bot()
bot.run() # there is run_until_complete function in run()
Alex Grönholm
@agronholm
@Kenan7 which async framework is twitchio using?
Mirkenan Kazımzade
@Kenan7
looks like just asyncio
Alex Grönholm
@agronholm
how do you know?
ok, the source looks like it uses asyncio
Mirkenan Kazımzade
@Kenan7
yes :)
Alex Grönholm
@agronholm
start the scheduler first, then the bot
Alex Grönholm
@agronholm
@Kenan7 yeah, and use AsyncIOScheduler
Mirkenan Kazımzade
@Kenan7
I tried this but I get this error: maxiumum number of running instances reached(1) but I set max_instances to 5
try:
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.bind(("127.0.0.1", 47200))
    log.info("socket bind")
except socket.error:
    log.info("socket error")
    pass
else:
    log.info("socket - register extensions")
    scheduler = AsyncIOScheduler()
    log.basicConfig()
    log.getLogger("apscheduler").setLevel(log.DEBUG)
    scheduler.start()
    scheduler.add_job(
        test_function,
        trigger="interval",
        id="test_job",
        replace_existing=True,
        seconds=30,
    )


bot = Bot()
bot.run()
@agronholm
Mirkenan Kazımzade
@Kenan7
I handled them with threads
Alex Grönholm
@agronholm
@Kenan7 where did you set the maximum number of instances?
give me something that lets me see the problem
shahrooz
@shahrooz1397
hello guys
i need to remove and put a value from database at two different time
for example i want to put str(hello) at 8 am and remove it at 10pm
i am noob at apscheduler what should i do
which one of these are suitble for my job: date, cron interval?
Alex Grönholm
@agronholm
@shahrooz1397 you need to do these every day?
shahrooz
@shahrooz1397
@shahrooz1397 you need to do these every day?
yes i do
Alex Grönholm
@agronholm
ok, so cron is your best bet
shahrooz
@shahrooz1397
thanks do you have any example
Alex Grönholm
@agronholm
hour=8 for the first job (put), hour=22 for the second job (remove)
the API documentation for CronTrigger has examples
shahrooz
@shahrooz1397
@agronholm thank you very much
Omer Katz
@thedrow
@agronholm How is it going with 4.0?
Alex Grönholm
@agronholm
I've struggled a lot with the sync/async scheduler and worker interfaces, but I think I've made a breakthrough now
Omer Katz
@thedrow
Is it usable from master?
I'm working on it now
Alex Grönholm
@agronholm
no, not yet
Omer Katz
@thedrow
I just need the async scheduler
Alex Grönholm
@agronholm
I expect to push a commit this week with appropriate changes