cancel
Showing results for 
Search instead for 
Did you mean: 

How to do Dynamic Job Scheduling in HANA SPS-7?

Former Member
0 Kudos

Hi,

I'm working on job scheduling with HANA SPS-7 version. I watched the videos uploaded on the SAP HANA Academy and also followed the steps mentioned in the HANA Developer guide. I'm trying to schedule jobs dynamically by calling xsjs which has code for adding job schedules. For better understanding the code snippet of the called xsjs looks like:

var schedule = new $.jobs.Job({

  uri : "scheduleJob.xsjob", sqlcc : "schedule.xssqlcc"

});

var jobId = schedule.schedules.add({

  "description" : "add job from code",

  "xscron" : "* * * * * * 59",

  "parameter" : {

  "jobId" : "100"

  }

});

When I call this xsjs, job gets added in the "_SYS_XS"."JOB_SCHEDULES" table. However, The job doesn't get scheduled and entry is not coming to the "_SYS_XS"."JOB_LOG" table.

Interestingly, when I go to the XS Admin tool and just click on save button The same job which I created dynamically gets scheduled and i can see job logs.

Could anyone please guide what I should do for achieving a fully dynamic scheduling of jobs through xsjs call (without the need of going to the XS Admin tool) ?

Regards,

Thanisha.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanisha,

Did you make any progress on this?

I am trying the same thing. I think that the Job needs to be activated through the Admin GUI once and then you can change the schedule.....

Kind regards,

Fred

Former Member
0 Kudos

Hi,

The issue for dynamic scheduling is solved in rev 71 of SPS7. However, you need to activate the job from the XSAdmin UI or you could update the _SYS_XS.JOBS table.

Hope this helps.

Regards,

Thanisha.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Thanisha,

I've faced with the similar issue and my findings:

Jobs are not scheduled in case of updating the status in the _SYS_XS.JOBS table directly  (no new records added to "_SYS_XS"."JOB_LOG" table).

So, seems the only way to trigger job execution is to activate it via admin console explicitly.

In additional, I found one more strange behaviour...in some conditions job are not triggered even if it activated via admin console and there is a corresponding record inside "_SYS_XS"."JOB_LOG" table.

So, just nothing happens and there is no any new records created in  "_SYS_XS"."JOB_LOG" table after PLANNED_TIME is passed...

The HANA version we are working on is fullversion: 1.00.72.00 Build 0388670-1510

Regards,

Alexander

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Here is the source code I use in my demo.  It works fine in my system. 

function performSchedule(){

  var body = '';

  var myjob = new $.jobs.Job({uri:"/playground/sp7/jobs/demoXSJS.xsjob",

                         sqlcc:"/playground/sp7/services/jobs.xssqlcc"});

  // add

  var id = myjob.schedules.add({

      description: "Added at runtime, run every 1 second",

      xscron: "* * * * * * 0:59/01"

      });

  body = 'Job ' + id + ' has been scheduled';

  $.response.contentType = "text/html";

  $.response.setBody(body);

  $.response.status = $.net.http.OK;

}

Are you xsjob and xssqlcc really in the repository root?

Perhaps there is something wrong with the parameter import?  Do you see anything in the xsengine or index server trace?  You might have to enter a support ticket for this as I don't see anything obviously wrong with your code.

Former Member
0 Kudos

Hi Thomas,

 

Thanks for your reply. I tried and checked the things you
mentioned about.

  • I tried after removing the parameter from every
    place.
  • I gave full paths along with the xsjob and xssqlcc
    file.
  • I also checked the xsengine and index server
    traces.

However, nothing seems to work for me and I’m in the same
scenario as before. And just for information if that could help, I am working
with the SPS 7 version: 1.00.70.00.386119.

 

I should probably open a ticket. As I’m unaware of the exact
component, etc. against which I should open a ticket, it would be great if you
could please guide me with the component name and the concerned person (if
possible).

 

Regards,

Thanisha.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Component is BC-DB-HDB-XS.