4

While building an Atlasboard Job, I would like to control where and when data is pushed to the widget.

  1. I could not find where the "interval" config parameter is documented - my understanding is that the job is scheduled each interval ms.

  2. I would like to take control over when my job updates the widget. I therefore did a small test:

    setInterval(function() {
        x = x+1;
        jobCallback(null, {title: config.widgetTitle + "  - "+x});
    }, 10000);
    

At first I was happy as it seem to have worked but than I noticed the log messages:

[dashboard: xxx] [job: xxx] 14:04:27.93 <warn> WARNING!!!!: job_callback executed more than once for job xxx in dashboard xxx (scheduler.js)

[dashboard: xxx] [job: xxx] 14:04:27.96 <warn> WARNING!!!!: job_callback executed more than once for job xxx in dashboard xxx (scheduler.js)

[dashboard: xxx] [job: xxx] 14:04:37.94 <warn> WARNING!!!!: job_callback executed more than once for job xxx in dashboard xxx (scheduler.js)

I might add that after few more minutes the job seem to replicate itself and global parameters seem to not keep their global value between job instances - such that soon after my single 'recurring job' becomes ten jobs, than 100 etc.

Is there a way to gain better control over when the data is pushed to the widget? Is there better documentation than https://bitbucket.org/atlassian/atlasboard and http://atlasboard.bitbucket.org/ ?

davidhadas
  • 2,333
  • 21
  • 17

1 Answers1

3

I found out the following during my search and looking into the jobWorker code (I could not find any documentation anywhere).

There is a pushUpdate member function that was added to the jobWorker - it appears as if it is best used during the Job onInit() - in this way we assure that it is activated only once!

onInit: function (config, dependencies) {
   var jobWorker = this;
   var x = 0;
   setInterval(function() {
       x = x+1;
       jobWorker.pushUnpdate({title: config.widgetTitle + "  - "+x);
   }, 10000);
}

Note that if you take control over the scheduling of the updates, there is no need to implement a Job onRun() - meaning that no scheduler will be activated for your Job.

davidhadas
  • 2,333
  • 21
  • 17