As a quick fix I just added the "next_run_time" argument to the queue_task
function and it's working:
scheduler.queue_task(
test,
pargs=[],
pvars={},
start_time = datetime.datetime(2016, 7, 29, 0, 0),
next_run_time = datetime.datetime(2016, 7, 29, 0, 0),
stop_time = None, #datetime
timeout = 120, #seconds
prevent_drift=False,
immediate=False,
repeats = 1,
retry_failed = 0
)
Le jeudi 28 juillet 2016 10:06:39 UTC+2, schnee a écrit :
>
> A simple example:
>
> scheduler = Scheduler(db, utc_time=False)
>
> def test():
> print("test")
> return True
>
>
> scheduler.queue_task(
> test,
> pargs=[],
> pvars={},
> start_time = datetime.datetime(2016, 7, 29, 0, 0),
> stop_time = None, #datetime
> timeout = 120, #seconds
> prevent_drift=False,
> immediate=False,
> repeats = 1,
> retry_failed = 0
> )
>
> Le mardi 26 juillet 2016 16:20:05 UTC+2, Niphlod a écrit :
>>
>> I'd say too "lets see the scheduler_run and scheduler_task table" for an
>> example task. the logic behind picking tasks is the same without
>> differences on Win and Linux, and if you use queue_task it's even more
>> likely that there will be no differences between recent and not-so-recent
>> scheduler versions.
>>
>> On Monday, July 25, 2016 at 8:12:44 PM UTC+2, Dave S wrote:
>>>
>>>
>>>
>>> On Monday, July 25, 2016 at 10:50:25 AM UTC-7, cam schn wrote:
>>>>
>>>> Hello everyone.
>>>>
>>>> I am trying to schedule a task to run only once at a specific time. I
>>>> am using the "start_time" argument in the function queue_task of the
>>>> scheduler as below:
>>>>
>>>> scheduler.queue_task(
>>>> mytask,
>>>> pargs=[],
>>>> pvars= dict(a=2, b=3),
>>>> stop_time = None,
>>>> start_time = request.now + timed(seconds=300),
>>>> timeout = 60,
>>>> repeats = 1,
>>>> period = 60,
>>>> retry_failed = 0
>>>> )
>>>>
>>>> It's working fine on Linux, but on Windows my task is getting executed
>>>> right away, without any delay.
>>>> Does anyone tackle the same problem and got a solution?
>>>>
>>>> Thanks!
>>>>
>>>
>>> I haven't tried it on Windows myself (but I'm pretty sure someone here
>>> has this experience).
>>>
>>> However, can you grab the relevant entries from the task_run table, and
>>> post them here? (Obfuscate IPs and such, of course)
>>> Include the results from both Winders (which version? 7, 8.1, Svr2012?)
>>> and from Linux.
>>>
>>> /dps
>>>
>>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.