XS Job File Keyword Options

The XS job file .xsjob uses a number of keywords to define the job that must be run at a scheduled interval.

Example

The XS Job ( .xsjob) File
{
    "description": "Read stock value",
    "action": "yahoo:yahoo.xsjs::readStock",
    "schedules": [
       {
          "description": "Read current stock value",
          "signature_version": 1,
          "xscron": "* * * * * * 59",
          "parameter": {
             "stock": "SAP.DE"
             }
       }
    ]
}
description
 {
     "description": "Read stock value",   
} 

The description keyword enables you define a text string used to provide context when the XS job is displayed for maintenance in the SAP HANA XS Administration Tool. The text string is used to populate the Description field in the SCHEDULED JOB tab.

action
 {
     "action": "myapps.finance.yahoo:yahoo.xsjs::readStock",
}
 
The  action keyword enables you to define the function to run as part of the XS job, for example, an XS JavaScript or an SQLScript. The following syntax is required:  “action” : <package.path>:<XSJS_Service>.xsjs::<functionName>.
NoteIf you want to use the action to call an SQLScript, replace the name of the XSJS service in the example, with the corresponding SQLScript name.
schedules
 {
     "schedules": [
       {
          "description": "Read current stock value",
          "xscron": "* * * * * * 59",
          "parameter": {
             "stock": "SAP.DE"
             }
       }
    ] 
}

The schedules keyword enables you define the details of the XS job you want to run. Use the following additional keywords to provide the required information:

  • description (optional)

    Short text string to provide context

  • xscron

    Uses cron-like syntax to define the schedule at which the job runs

  • parameter (optional)

    Defines any values to be used as input parameters by the (XSJS or SQLScript) function called as part of the job

signature_version
 {
     "signature_version": 1,
}

The signature_version keyword enables you manage the version “signature” of an XS job. You change the XS job version if, for example, the parameter signature of the job action changes; that is, an XS job accepts more (or less) parameters, or the types of parameters differ compared with a previous version of an XS job. On activation in theSAP HANA Repository, the signature of an XS job is compared to the previous one and, if the job’s signature has changed, any job schedules created at runtime will be deactivated.

NoteThe default value for  signature_version is 0 (zero).

Deactivation of any associated runtime job schedules prevents the schedules from silently failing (no information provided) and enables you to adjust the parameters and reactivate the job schedules as required, for example, using the enhanced XS JS API for schedules. Schedules defined in a design-time XS Job artifact are replaced with the schedules defined in the new version of the XS job artifact.

TipMinor numbers (for example,  1.2) are not allowed; the job scheduler interprets  1.2 as  12.
xscron
 {
     "schedules": [
       {
          "description": "Read current stock value",
          "xscron": "* * * * * * 59",
          "parameter": {
             "stock": "SAP.DE"
             }
       }
    ] 
} 

The xscron keyword is used in combination with the schedules keyword. The xscron keyword enables you to define the schedule at which the job runs. As the name suggests, the xscron keyword requires a cron-like syntax.

The following table explains the order of the fields (*) used in the “xscron” entry of the .xsjob file and lists the permitted value in each field.

Table 1: xscron Syntax in the XS Job File
xscron Field (* from left to right) Meaning and Permitted Value
Year 4-digit, for example, 2013
Month 1 to 12
Day -31 to 31
DayofWeek mon,tue,wed,thu,fri,sat,sun
Hour 0 to 23
Minute 0 to 59
Second 0 to 59
NoteUsing the asterisk (*) as a wild card in the seconds field can lead to some unexpected consequences, if the scheduled job takes less than 59 seconds to complete; namely, the scheduled job restarts on completion. If the scheduled job is very short (for example,10 seconds long), it restarts repeatedly until the specified minute ends.

To prevent short-running jobs from restarting on completion, schedule the job to start at a specific second in the minute. For example, * * * * * */5 20 indicates that the scheduled job should run every five minutes and, in addition, at the 20th second in the specified minute. The job starts at precisely 20 seconds into the specified minute and runs only once.

The following table illustrates the syntax allowed to define expressions in the “xscron” entry of the .xsjob file.

Table 2:
Expression Where used... Value
* Anywhere Any value
*/a Anywhere Any a-th value
a:b Anywhere Values in range a to b
a:b/c Anywhere Every c-th value between a and b
a.y DayOfWeek On the a-th occurrence of the weekday y (a = -5 to 5)
a,b,c Anywhere a or b or c
parameter
 {
     "schedules": [
       {
          "description": "Read current stock value",
          "xscron": "* * * * * * 59",
          "parameter": {
             "stock": "SAP.DE",
             "share": "BMW.DE"
             }
       }
    ] 
} 

The optional parameter keyword is used in combination with the schedules keyword. The parameter keyword defines values to be used as input parameters by the XSJS function called as part of the job. You can list as many parameters as you like, separated by a comma (,) and using the JSON-compliant syntax quotations (“”).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值