Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 15 18:39
    agronholm commented #207
  • Jun 15 18:06
    srPuebla commented #207
  • Jun 12 06:40
    chen-ABC closed #517
  • Jun 11 12:41
    chen-ABC edited #517
  • Jun 11 12:39
    chen-ABC opened #517
  • Jun 08 01:38
    fangqian closed #516
  • Jun 08 01:38
    fangqian commented #516
  • Jun 07 15:43
    agronholm commented #516
  • Jun 07 13:08
    fangqian commented #516
  • Jun 07 13:07
    fangqian commented #516
  • Jun 07 12:49
    agronholm commented #516
  • Jun 07 12:23
    fangqian commented #516
  • Jun 07 09:57
    agronholm edited #516
  • Jun 07 09:33
    fangqian opened #516
  • May 28 19:47
    Nayyaroddeen commented #515
  • May 28 19:47
    Nayyaroddeen commented #515
  • May 28 18:33
    agronholm commented #515
  • May 28 18:30
    agronholm commented #515
  • May 28 18:29
    agronholm edited #515
  • May 28 17:25
    Nayyaroddeen opened #515
Forest Johnson
@ForestJohnson
but return False does filter them out
maybe I will simply return False if the current configured log level is not DEBUG
thanks Alex Cheers!!!! :beers:
Alex Grönholm
@agronholm
:thumbsup:
cecemel
@cecemel
Hello, I encountered a "skipped: maximum number of running instances reached". The job should still be running , is there any way I can get information about this specific job (e.g. how long it has been running, what is was doing if there are any other things going on)
Alex Grönholm
@agronholm
not via the apscheduler api, sorry
you can log these things in the target function itself of course
cecemel
@cecemel
ok thanks!
It's weird state we ended up in, because normally this job is ultra stable (ran before for months). But anyway... Thanks. Looking forward to the timeout feature in APscheduler 4.0, no pressure :-)
cecemel
@cecemel
Just an extra question: We use the BackgroundScheduler, the way it locks job, I assume it is fully in memory? There is no lockfile or anything created that might be a 'residu' when the whole service running the scheduler restarts? (its a docker based service, if a jobs crash on unexpected exception, the service crashes and gets restarted automatically)
Alex Grönholm
@agronholm
no need for lock files as everything is memory (unless you use a persistent job store)
@cecemel
Mirkenan Kazımzade
@Kenan7
any way to control cron jobs? if it executed or not, if not executed retry
Alex Grönholm
@agronholm
@Kenan7 you can do that yourself with a try...except loop
maybe use a library like tenacity to do progressive back-off
Mirkenan Kazımzade
@Kenan7
where do I put try except? it's a cron job added by add_job method
Mirkenan Kazımzade
@Kenan7
@agronholm
Alex Grönholm
@agronholm
@Kenan7 in the function you scheduled
José Flores
@FloresFactorB_twitter
hello, somene know how get the failed jobs?
Alex Grönholm
@agronholm
@FloresFactorB_twitter I assume you mean you want to get notified when a job fails (this can happen any number of times depending on how many times the job is run)
add a listener to the scheduler
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