Message Boards Message Boards

Cloud dashboard generation, how to get more speed

Posted 9 years ago

I have a dashboard consisting of 6 to 8 pictures. This dashboard is generated based on 2 values for amplitude and phase. So after entering the 2 args and pressing submit in a webform I would like to see the result immediately. Should look something like this:

enter image description here

It takes my desktop 8 seconds to generate and the cloud kernel much more. If I parallelize generating the dashboard graphs it takes 0.5 sec. But parallelize seems to be not possible in the cloud. So I need a new strategy.

My solution is to create a webpage that refreshes itself every second. The graphs are now separate files generated (and uploaded) in sequence and picked up, when available, by the refreshing webpage.

lets show some code with 4 pics:

aa := Plot[Sin[x], {x, -4, 4}]
CloudExport[aa, "SVG", "/apic.svg"];
bb := Plot[Log[x], {x, 0, 4}]
CloudExport[bb, "SVG", "/bpic.svg"];
cc := p4[25] (*code not included*)
CloudExport[cc, "SVG", "/cpic.svg"];
dd := sector[24] (*code not included*)
CloudExport[dd, "SVG", "/dpic.svg"];

Now CloudDeploy the self refreshing framework of 4 pics:

CloudDeploy[
 Delayed[
  "<center>" <> ExportString[
    Grid[
     {
      {Style["Dashboard Generated on request", Gray, 23], 
       SpanFromLeft},
      {CloudImport[CloudObject["/apic.svg"], "Text"],
       CloudImport[CloudObject["/bpic.svg"], "Text"]},
      {CloudImport[CloudObject["/cpic.svg"], "Text"],
       CloudImport[CloudObject["/dpic.svg"], "Text"]}
      }
     ], "HTMLFragment"] <> "</center>"
  , "Text",
  UpdateInterval -> 1]
 , "/dashb"]

This works as intended. When new pictures are loaded into the wolfram cloud they appear in the page.

The main issue is that in this example the whole webpage refreshes. It would be nice if only the graph files are reloaded because their timestamp changed indicating a newly uploaded file. Is some mechanism available to prevent all unchanged graphs to be redrawn.

There is the option of using a jpeg format to eliminate the vector rendering with SVG files. Nevertheless all 4 pictures keep reloading continuously.

any options how to handle local triggers to refresh?

I can't think of any easy way to only reload changed files. I'd suggest using some Javascript to fetch the images every second instead of refreshing the page.

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

Group Abstract Group Abstract