Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 21 11:31
    agronholm closed #563
  • Oct 21 11:31
    agronholm locked #563
  • Oct 21 11:31
    agronholm unlabeled #563
  • Oct 21 11:31
    agronholm closed #564
  • Oct 21 11:31
    agronholm locked #564
  • Oct 21 11:29
    nitishxp labeled #564
  • Oct 21 11:29
    nitishxp opened #564
  • Oct 21 08:37
    ShivKJ labeled #563
  • Oct 21 08:37
    ShivKJ opened #563
  • Oct 14 18:46
    agronholm commented #562
  • Oct 14 18:46
    agronholm closed #562
  • Oct 14 18:02
    TCVZ labeled #562
  • Oct 14 18:02
    TCVZ opened #562
  • Oct 14 15:59
    agronholm closed #560
  • Oct 14 15:59
    agronholm locked #560
  • Oct 14 15:57
    agronholm labeled #560
  • Oct 14 15:56
    alxfed opened #560
  • Oct 13 09:43
    agronholm commented #559
  • Oct 13 09:40
    radiantone opened #559
  • Oct 13 09:38
    radiantone edited #558
Alex Grönholm
@agronholm
or does it insist on running its own event loop?
Vioshim
@Vioshim

Well, bot.run is gonna be deprecated,

bot.start(token) is a coroutine which requires a asyncio.run

but right now bot.run(token) == asyncio.run(bot.start(token))

Alex Grönholm
@agronholm
then it's all good
you just need to use that syntax instead
do you know what to do?
Vioshim
@Vioshim

Well, I kinda do but I mean, right now, using each syntax doesn't truly make a difference on the main.py

The Apscheduler part it's the one at cogs/daily_question.py which has the .__aenter__() approach

Alex Grönholm
@agronholm
you can start the scheduler in main.py
Vioshim
@Vioshim
Oh interesting, but wouldn't it close if I do async with?
Alex Grönholm
@agronholm
bot.start() will block indefinitely, won't it?
Vioshim
@Vioshim

Ye it should,

But Oh yeah, that's a quite interesting approach, and possibly I can get to add that scheduler as an attribute to the bot class in order to access it in commands,

thanks for the help.

Marco Antonio
@mgrazianoc
image.png
whats up fols
folks*
im learning just now this incredible library
but im having some difficulties to understand some concepts
one of them is about scheduled jobs and what one job must need to be scheduled
in this example I made on main loop of asyncio, one job what scheduled to happend soon, while other 60 of them would happen every minute after a while
the idea was to just see how the library talks to postgres
the times were all correct, the table TEST were created on the database, but none of the tasks were stored there, which got me confused
Marco Antonio
@mgrazianoc
as tasks comes to the scheduler, shouldn't it immediately save it on the database?
Marco Antonio
@mgrazianoc
not only that, when print_jobs is called, it says "no scheduled jobs"
using debug mode, i think i got a clue of what is happening: "INFO:apscheduler.scheduler:Added job "simple_job" to job store "default""
it sent to default store when i should sent it to my store, hmmm
Marco Antonio
@mgrazianoc
I now suspect it has something to do with being async?
Alex Grönholm
@agronholm
@mgrazianoc if you don't specify the store to save it to, it goes to default
if you want all jobs to go to postgres, you should name it default
Alex Grönholm
@agronholm
also I'm not seeing you start an asyncio event loop anywhere
if you don't want an asyncio event loop, why use AsyncIOScheduler?
Marco Antonio
@mgrazianoc
oh, thanks for the reply
there's a call of asyncio below the print, asyncio.get_event_loop().run_forever()
for some odd reason, I thought that naming it "postgres" would do the job, but it does makes sense to save it as default, since we are ovewriting it
i'm gonna test it today
this library is really good
Marco Antonio
@mgrazianoc
it worked, thanks. Now I understand wthat the documentation means about "non-serialized", you can't pass the scheduler to a job
Aleksandr Lobanov
@anklav24
image.png
Hi, how can I see id of jobs in get_jobs messages?
Alex Grönholm
@agronholm
messages?
what are you talking about?
Aleksandr Lobanov
@anklav24
I wanna see id when I use get_jobs or print_jobs.
Alex Grönholm
@agronholm
well you get whole job objects when you call get_jobs()
so just access the id attribute of each job
as for print_jobs(), I remember talking about that with someone
definitely something I will consider with apscheduler 4
Dave Eargle
@deargle
Hi, what is the expected behavior for jobs that are added tentatively, if the app shuts down without the scheduler ever starting? I'm also noticing that tentatively scheduled jobs cannot be serialized (getstate) because they don't necessarily have misfire_grace_time set.
I can open a github report for the second one, unless it's expected behavior
Also, to elaborate, I think I'm seeing that tentatively-added jobs disappear if the process ends -- they aren't tentatively added to any datastore, they're just added in-memory
Perhaps the workaround would be -- if the goal is to add jobs without ever running them within a given process, then start the scheduler but in a paused state, so that jobs get added to a datastore.
Dave Eargle
@deargle
my situation is that I'm trying to integrate apscheduler into a flask app which is sometimes multithreaded. If it's multithreaded, I don't want apscheduler to try to run jobs, but I do want users to be able to view scheduled jobs.
Aleksandr Lobanov
@anklav24
image.png