Group Abstract Group Abstract

Message Boards Message Boards

Problem with ScheduledTask timespec in Mathematica 12.0

POSTED BY: Jonathan Kinlay
4 Replies
POSTED BY: Neil Singer

Jonathan,

Please report this to support. They are very responsive to bug reports.

Either send email to support@wolfram.com or go to

https://www.wolfram.com/support/contact/email/?topic=feedback

Regards,

Neil

POSTED BY: Neil Singer
Posted 6 years ago

As I pointed out in the original post, ScheduledTask works if you use Now in the timesec, but not if you use a date in date object or datelist format.

So that issue remains unresolved and ScheduledTask does not work as advertised with LocalSubmit.

However, it does appear to work with SessionSubmit, which is fine as a workaround, although it would be nice if WR would fix this problem in an upcoming release.

POSTED BY: Updating Name
Posted 6 years ago

I was able to replicate your issue, and think the problem is LocalSubmit, which initiates a new subkernel (which may be your intention). If you switch to SessionSubmit, you should be ok.

startTime = TimeObject[{18, 20, 0}];
endTime = TimeObject[{18, 22, 0}];
sessionStart = DateObject[Today, startTime];
sessionEnd = DateObject[Today, endTime];

obj = SessionSubmit[ScheduledTask[DateString[], {sessionStart, Quantity[1, "Minutes"], sessionEnd}],
HandlerFunctions -> <|"ResultReceived" -> Print|>,
HandlerFunctionsKeys -> "EvaluationResult"]

Task Created Evaluation Result

I'm guessing LocalSubmit needs specific HandlerFunctions and/or HandlerFunctionsKeys to work properly, or perhaps some other kernel initialization.

Update: I've been able to get LocalSubmit work in the manner you expected. I added an end to the timespec, but it also works without it.

obj = LocalSubmit[
  ScheduledTask[
   DateObject[], {Now, Quantity[1, "Minutes"], 
    Now + Quantity[2, "Minutes"]}],
  HandlerFunctions -> <|"ResultReceived" -> Print|>,
  HandlerFunctionsKeys -> "EvaluationResult"
  ]

LocalSubmit output

POSTED BY: Cary Munves
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard