8
$\begingroup$

cross-posted on the Wolfram Community forum

I am trying to deploy a ScheduledTask that monitors the state of a google spread sheet every hour. I want the object to display the content (which should be static), but instead upon deployment, it creates an object which redirects me to a notepad in my Wolfram Development Platform account that allows me to add information (but cannot execute). Here is a look at my code:

This imports the contents of the google doc:

Clear@url
Clear@csv
(url = "https://path-to-google-doc/export?format=csv") //
Import[#, "CSV", CharacterEncoding -> "UTF8"] & //
Flatten@# & //
(csv = #) & //
Dataset@# &

Which results in an output that takes the form: Dataset[{....}].

To create the ScheduledTask, I have tried:

Clear@obj
obj = ScheduledTask[{Now, csv}, "Hourly"](*creates a scheduled task that monitors the information in the doc every hour*)//
CloudDeploy[#, Permissions -> "Public"] &

Again, this results in a redirect to my development platform account (that is only accessible to me and not anyone else) and not to a static web object which displays the contents of the google doc. I am pretty new to using the Wolfram Cloud, but it feels a lot like a black box, which makes debugging pretty difficult because I am never sure where the issue truly lies; my thought is to wrap the scheduled task in an APIFunction, but I am not sure how to go about doing that, since there is no specific association I am looking to make for the information in the csv file. Is this the right way to go about this? How can I utilize APIFunction if I don't have an explicit set of rules I am looking to make?

Update: I've tried including the line of code before CloudDeploy of RunScheduledTask[#]& as well as StartScheduledTask[#]&. When deployed, this results in a static web object like I'd wanted, but the former gives me this, and the latter gives me this. Again, I don't like that I can't really see what's going on in the Cloud that results in it failing.

$\endgroup$
  • $\begingroup$ To run a scheduled task you will apparently need a $100/month Producer account. I'd guess that there isn't anyone answering questions on StackExchange who has access to such an account. On the other hand, a Producer account comes with both email and phone Wolfram support. $\endgroup$ – Christopher Haydock Jul 15 '16 at 19:20
  • $\begingroup$ @ChristopherHaydock Good point, and one that I hadn't realized. I always like to ask the community first before emailing directly, you never know if your solution can help someone else later on; do you think I'd have a better chance of this being addressed in the Wolfram Community forums? $\endgroup$ – Lame-Ov2.0 Jul 15 '16 at 19:46
  • 1
    $\begingroup$ Yes, your solution certainly will be of interest to all Wolfram Development Platform users, especially because it helps to establish the case for upgrading to a Producer account verses using an external service. See also this advice about cross-posting. $\endgroup$ – Christopher Haydock Jul 15 '16 at 20:08
2
$\begingroup$

I am not sure how many of y'all have been keeping up with the Community discussion, but there are some key updates I wanted to summarize here:

  1. ScheduledTask does not store values; it is essentially a block of code that produces a result which it then discards. AutoRefreshed works better wrt deployment of tasks to the Wolfram Cloud because AutoRefreshed objects will store a value and repeatedly update it according to the given schedule.
  2. Functions like RunScheduledTask and StartScheduledTask do not perform on Cloud objects like you would expect them to, and will likely be deprecated. (Personally, as a result of the current technical discussion, I also think that the added flexibility of AutoRefreshed will result in it becoming the de facto function in place of ScheduledTask).
  3. GenerateHTTPResponse is a good function to use if you are unable/do not want to CloudDeploy, but would like to see if it is at least possible, because it simulates the behavior of the Wolfram Cloud server
$\endgroup$
  • $\begingroup$ Wolfram Development Platform pricing lists scheduled tasks, which presumably include AutoRefreshed, at the $100/month Producer price point. Have you upgraded your account to this level? $\endgroup$ – Christopher Haydock Jul 22 '16 at 18:15
  • $\begingroup$ @ChristopherHaydock yes, the company I work for uses their own Private Cloud, so we should have all these features I am trying to make use of $\endgroup$ – Lame-Ov2.0 Jul 22 '16 at 18:53
  • $\begingroup$ OK great! Are you working with Wolfram support on a solution to the AuotRefreshed problem that you mention in your most recent Wolfram Community post? $\endgroup$ – Christopher Haydock Jul 22 '16 at 19:59
  • $\begingroup$ @ChristopherHaydock yes, I am! The solution that support suggested is very similar to the piece of code that Dylan posted, which acts as a nice template to get started with. $\endgroup$ – Lame-Ov2.0 Jul 22 '16 at 22:03
  • $\begingroup$ After you get something working I assume that you will post your code on the Wolfram Community, where I agree with Andrew de Laix that even big fans of Postfix notation and pure functions should eliminate the Postfix and keep the number of pure functions to an absolute minimum. I look forward to reading about your solution! $\endgroup$ – Christopher Haydock Jul 22 '16 at 22:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.