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
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
you don't want it in the state it's in now on my laptop
Omer Katz
@thedrow
Do you accept interval=0?
Alex Grönholm
@agronholm
no?
why
Omer Katz
@thedrow
Because I was wondering if I can run something in a loop using APScheduler.