4
$\begingroup$

I would like to create a ScheduledTask that evaluates at the same time everyday. Such as, evaluate function at 1:00 am everyday. The "Daily" timespec in ScheduledTask doesn't allow me to control the time when function evaluates everyday.

I have tried, as an example, to print something whenever the second of the day is 5.

SessionSubmit[ScheduledTask[Print["1"], DateObject[{_, _, _, _, _, 5}]]]

I get error

SessionSubmit::sched: $Failed is not an association containing recognized scheduling time specification.

Either the pattern is wrong or I am approaching this in the wrong way?

$\endgroup$
  • 1
    $\begingroup$ I think it is a valid form of time specification as said in the detailed information, so I suspect this is a bug of Mathematica... At least an improperly written documentation. I would dig a bit into the source code and try to figure something out... $\endgroup$ – Wjx Mar 31 '18 at 12:45
  • 1
    $\begingroup$ It seems that the the processing of different type of time specification is by function Tasks`InterpretTimeSpec. However, this feature is not included in all 11 valid definitions of it... So probably this is a feature that's not yet implemented or missed out. #facepalm# $\endgroup$ – Wjx Mar 31 '18 at 12:52
  • $\begingroup$ Thank you! Thought I was going crazy. I’m getting frustrated that this stuff is all too common when using Mathematica. They have made strides over the years but so much more to polish. I will submit a bug report. $\endgroup$ – Ray Troy Mar 31 '18 at 17:42
  • 1
    $\begingroup$ Yup, they are always adding new functionalities but always ignoring that there's still bugs to fix as well! $\endgroup$ – Wjx Apr 3 '18 at 2:11
  • $\begingroup$ Whether that works or not -- I would suggest to not use Mathematica for such a task. It will only work if you manage to keep the Mathematica process which runs this alive for many days. That can be achieved but it is not really something that Mathematica was made for (and it eats a license permanently!). I think if you use more standard ways of the operating system you use to run scheduled tasks and start a new mathematica process for what you need to do once a day that probably will give you a more reliable and maintainable solution to your problem... $\endgroup$ – Albert Retey Apr 8 '18 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.