Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 29 22:34
    agronholm commented #705
  • Jan 29 22:33
    santhanam87 labeled #705
  • Jan 29 22:33
    santhanam87 opened #705
  • Jan 27 14:08
    pre-commit-ci[bot] synchronize #704
  • Jan 27 14:07
    cfytrok opened #704
  • Jan 21 09:18
    jatinwatts commented #445
  • Jan 16 20:08

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

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

  • Jan 16 20:08
    pre-commit-ci[bot] opened #702
  • Jan 16 17:38
    ohayak synchronize #701
  • Jan 16 17:30
    ohayak opened #701
  • Jan 11 12:45
    wonjerry closed #700
  • Jan 11 12:45
    wonjerry commented #700
  • Jan 11 11:03
    agronholm commented #700
  • Jan 11 11:02
    agronholm commented #700
  • Jan 11 09:47
    wonjerry opened #700
  • Jan 11 09:47
    wonjerry labeled #700
  • Jan 11 08:27
    Pad0y labeled #699
  • Jan 11 08:27
    Pad0y opened #699
  • Jan 11 06:40
    xiazhibin closed #696
  • Jan 07 09:22
    agronholm closed #698
gorgeousharrison
@gorgeousharrison
the scheduler portion of the code
Alex Grönholm
@agronholm
do it elsewhere
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