Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 06 11:52

    agronholm on master

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

  • Dec 06 11:52

    agronholm on pre-commit-ci-update-config

    (compare)

  • Dec 06 11:52
    agronholm closed #677
  • Dec 05 19:20
    pre-commit-ci[bot] synchronize #677
  • Dec 05 19:20
    pre-commit-ci[bot] edited #677
  • Dec 05 19:20

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

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

  • Nov 28 20:01
    pre-commit-ci[bot] synchronize #677
  • Nov 28 20:01
    pre-commit-ci[bot] edited #677
  • Nov 28 20:01

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

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

  • Nov 21 17:39
    euri10 opened #681
  • Nov 20 11:55
    agronholm commented #680
  • Nov 20 05:38
    cepheidev edited #680
  • Nov 20 05:38
    cepheidev edited #680
  • Nov 20 05:37
    cepheidev labeled #680
  • Nov 20 05:37
    cepheidev opened #680
  • Nov 18 09:51
    euri10 closed #679
  • Nov 18 09:44
    euri10 opened #679
  • Nov 16 17:12
    agronholm commented #362
  • Nov 16 13:54
    rafrafek commented #362
  • Nov 14 19:17
    pre-commit-ci[bot] synchronize #677
gorgeousharrison
@gorgeousharrison
ok
one argument that migh be missing is the number of max instance, i want the next day to override the past one
Alex Grönholm
@agronholm
meaning?
gorgeousharrison
@gorgeousharrison
so it calulates the indicator from 9 am to 9 am the next day, ends the job and starts a fresh one
Alex Grönholm
@agronholm
if it works 24 hours a day, with the same parameters, what do you need a scheduler for?
gorgeousharrison
@gorgeousharrison
alex, i may be extremely green at coding, but i have a very precise thing i need the code to do: run a function periodically on any decided period. so right now im just starting the basic, which is get the fucntion to run everyday at 9. i want to be able to run the same function every 2 days at 5pm for instance
Alex Grönholm
@agronholm
I just want to understand what you are trying to do, and that seems to change every time I ask
gorgeousharrison
@gorgeousharrison
it does not. its just one simple thing.
Alex Grönholm
@agronholm
so you keep saying, but this is the first time I'm hearing about "every 2 days at 5 pm"
is that the actual end goal here?
at any rate, you should move the scheduling code out of the target function
gorgeousharrison
@gorgeousharrison
no. the goal is the function to execute from different start times at different intervals. those are parameters i intend to change.
ok im im doing that now
Alex Grönholm
@agronholm
what determines the start times in the end?
gorgeousharrison
@gorgeousharrison
i do
Alex Grönholm
@agronholm
I mean, do you just hard code them or do you fetch the values programmatically?
gorgeousharrison
@gorgeousharrison
for one strategy iwant it to start the job at 9 am, for another i want it start at 5pm
Alex Grönholm
@agronholm
"every 2 days at 5 pm" requires CalendarIntervalTrigger which is only available in apscheduler 4, still in alpha
gorgeousharrison
@gorgeousharrison
right now im trying to return the function starting anytime i chos
Alex Grönholm
@agronholm
I don't recommend that for general use
you can however approximate it with CronTrigger
gorgeousharrison
@gorgeousharrison
this is pretty much what ive been trying. lets consider 24hr intervals, that i can pick any time of the day to start the function
Alex Grönholm
@agronholm
24 hour intervals are easy
(assuming you don't actually mean exactly 24 hour intervals, but 23 or 25 are okay too)
gorgeousharrison
@gorgeousharrison
yes, for now that is all i need
Alex Grönholm
@agronholm
for that you already have the answer
gorgeousharrison
@gorgeousharrison
Thank you so much for your help Alex
Alex Grönholm
@agronholm
:ok_hand:
Wintreist
@Wintreist
image.png
image.png
image.png
image.png
Hello, the scheduler is not working) And I do not know why, the work is carried out in parallel with the asynchronous bot for telegram.
I started the logger, but it also shows that nothing is happening
Alex Grönholm
@agronholm
try starting the scheduler in the same event loop as where your main program is running
make a new function if you need to, and start the scheduler there
asyncio support in apscheduler 3 is a bit iffy
coldsnap90
@coldsnap90
hi guys im new here i had a question
when i add this job, and do the job check
scheduler.add_job(jobstore='default',func=blah1,trigger = 'interval',args=[data,x], id=f'7',start_date=f'{date} 2022-11-30',end_date=f'{date} 2022-11-30',minutes =time,max_instances =5)
on gets_jobs() next_run_time is equal to None
but when i do this
scheduler.add_job(jobstore='default',func=blah1,trigger = 'interval',args=[data,x], id=f'7',start_date='2022-11-30 12:00:00',end_date='2022-11-30 02:00:00',minutes =time,max_instances =5) it shows the jobs next run time
the date in the fstring is actually the time just made an error here
name: 2, trigger: interval[0:15:00], next run: 2022-11-30 17:31:00-08:00, handler: <function blah1 at 0x00000203BA86F640>
name: 1, trigger: interval[0:15:00], next run: None, handler: <function blah at 0x00000203BA894CA0>
coldsnap90
@coldsnap90
can the start_date , end_date not take a formatted string? and any suggestions on what to do
coldsnap90
@coldsnap90
nvm so dumb figured it out
Wintreist
@Wintreist
image.png
1 reply
I tried it, but it still doesn't work(
Joe Ziminski
@JoeZiminski
Hi, I have a question about how the background scheduler works. Our application either takes commands by CLI or initialise by python API, but it doesn't spin its own event loop or run in the background. If my understanding of the docs is correct, once the CLI script or python instance is closed, the scheduler will close. Is this correct / are there any workarounds to run the scheduler for long periods (e.g. months, years) in a background process, running at startup etc?
5 replies