Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 16 15:05
    Dzeri96 commented #297
  • May 16 15:00
    agronholm commented #297
  • May 16 14:57
    Dzeri96 commented #297
  • May 16 14:50
    agronholm commented #297
  • May 16 14:48
    Dzeri96 commented #297
  • May 16 14:39
    agronholm commented #297
  • May 16 14:38
    Dzeri96 commented #297
  • May 09 18:06
    pre-commit-ci[bot] opened #625
  • May 09 18:06

    pre-commit-ci[bot] on pre-commit-ci-update-config

    [pre-commit.ci] pre-commit auto… (compare)

  • May 05 17:15
    agronholm commented #465
  • May 04 11:50
    p-fernandes commented #465
  • May 04 11:49
    pfernandesviz commented #465
  • May 04 11:49
    pfernandesviz commented #465
  • Apr 27 09:32
    agronholm labeled #624
  • Apr 27 09:32
    agronholm unlabeled #624
  • Apr 27 09:32
    agronholm closed #624
  • Apr 27 09:32
    agronholm commented #624
  • Apr 27 09:24
    jayt1001 labeled #624
  • Apr 27 09:24
    jayt1001 opened #624
  • Apr 25 22:01

    agronholm on master

    Updated build status badge in R… (compare)

Alex Grönholm
@agronholm
like I said, with OrTrigger
make two CronTrigger instances and combine them with OrTrigger
lalaipo
@lalaipo
there is no docs about it?
lalaipo
@lalaipo
i use search it keeps loading
Alex Grönholm
@agronholm
yes
lalaipo
@lalaipo
image.png
am i right?
Alex Grönholm
@agronholm
no, you're supposed to use OrTrigger, not AndTrigger
lalaipo
@lalaipo
ah okay
lalaipo
@lalaipo
image.png
any ideas?
Alex Grönholm
@agronholm
what's the problem?
what are you trying to accomplish?
Vioshim
@Vioshim
Hello people, I've been testing the master branch, and realized that AsyncIOScheduler isn't there, is that module getting removed, deprecated or something?
Alex Grönholm
@agronholm
@Krangelj there are two schedulers now, AsyncScheduler and SyncScheduler
you want to use AsyncScheduler
Vioshim
@Vioshim
Oh I see, all right I'll try to check how that one works, seems it doesn't use .start()
Alex Grönholm
@agronholm
I suggest you look at the tests because the docs haven't been updated yet
Vioshim
@Vioshim

Made some small changes in my code and now it works as usual, basically add_schedule rather than add_job along with not having to make a .start()

But, thanks it worked.

Alex Grönholm
@agronholm
:thumbsup:
Vioshim
@Vioshim
image.png

Morning

also btw, is there a way to use an AsyncScheduler without using async with ?

I was randomly play testing and discovered that this is apparently the only way to replicate old .start() behavior

Alex Grönholm
@agronholm
it is currently the only way – if you have a convincing case against it, please present it so I can take that into account in the design
Vioshim
@Vioshim

I see, well I work on a discord bot (chat bot), in which it executes itself in a different loop, then in commands, we usually add events to make the bot keep executing those Scheduler functions without interrupting the main execution, hence why in my code I can't use the async with due to it being functions that make callbacks to existing elements.

For example, in the older Apscheduler, this is how I used to do stuff there

Alex Grönholm
@agronholm
where are you starting the scheduler?
Vioshim
@Vioshim
I'll fix the pic, it has some issues ^^;
Alex Grönholm
@agronholm
(btw that if condition can't work right...)
Vioshim
@Vioshim
ye that
image.png
Alex Grönholm
@agronholm
no matter what, the scheduler start will be asynchronous
regardless of whether its use as an async context manager is enforced
so this won't work
Vioshim
@Vioshim
Ye Ik, I was referring about how it used to be done in the past, that's why I was recommending adding a start() asynchronous which works and allows to add/execute functions without it occurring in aenter
Alex Grönholm
@agronholm
yeah but if you do that, what's preventing you from using it as an async context manager?
Vioshim
@Vioshim

Well, mostly by the fact that I can't add schedulers or execute them within an async context manager, due to the main loop executing and making function calls in order to add the scheduled tasks

• Bot runs
• Scheduler executing
• Bot's commands invoke .add_schedule() within functions, and I can't really keep a while True loop open in a command in order to keep a Scheduler executing ^^;

Alex Grönholm
@agronholm
why not keep a task open for that then?
Vioshim
@Vioshim

Well yeah, and that's what I'm doing atm with the

scheduler.__aenter__()

Doing that keeps it open until I use .stop()

Alex Grönholm
@agronholm
do you have your entire project in a public repo?
Vioshim
@Vioshim
No, however I can make a small test repo to show it
Alex Grönholm
@agronholm
that might be helpful
Vioshim
@Vioshim
Awesome, in that case I'll brb, thanks for the help & support btw
Alex Grönholm
@agronholm
:ok_hand:
Vioshim
@Vioshim

Alright here it is

I made the repo by making a small bot example which replies to a message from an user 10 seconds after

https://github.com/Krangelj/ScheduleBot_test.git

Alex Grönholm
@agronholm
ok the fundamental problem here is that the Bot class was not designed with async programming in mind
much like the old AsyncIOScheduler
@Krangelj if I understand correctly, the async aspect of Bot is just an implementation detail, yes?
Vioshim
@Vioshim

Well, according to discord py, it is intended to be

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

In which the async aspect of the bot, is mostly about how it works and how it handles API events

Alex Grönholm
@agronholm
is it possible to run the bot in an asyncio task?