sap-btp-job-scheduling

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SAP BTP Job Scheduling Service

SAP BTP Job Scheduling Service

Related Skills

相关技能

  • sap-dependency-security: Use for secure dependency and workflow hardening when your job scheduling microservices maintain npm/CLI dependency stacks
  • sap-dependency-security:当您的作业调度微服务维护npm/CLI依赖栈时,可使用该技能进行安全依赖与工作流加固

Table of Contents

目录

Overview

概述

SAP Job Scheduling Service is a runtime-agnostic platform service for defining and managing one-time and recurring jobs or Cloud Foundry tasks on SAP BTP. It operates across multiple hyperscalers (AWS, Azure, GCP) without requiring application modifications.
Last Verified: 2025-11-27
SAP Job Scheduling Service是一个与运行时无关的平台服务,用于在SAP BTP上定义和管理一次性、周期性作业或Cloud Foundry任务。它可在多个 hyperscaler(AWS、Azure、GCP)上运行,无需修改应用程序。
最后验证时间:2025-11-27

When to Use This Skill

何时使用本技能

Use this skill when:
  • Setting up Job Scheduling Service on Cloud Foundry or Kyma runtime
  • Creating and managing jobs via REST API or dashboard
  • Configuring schedules using cron, date/time, or human-readable formats
  • Implementing asynchronous job execution for long-running processes
  • Securing action endpoints with OAuth 2.0 and XSUAA
  • Integrating with SAP Cloud ALM or Alert Notification Service
  • Developing multitenant applications with tenant-aware job scheduling
  • Troubleshooting job execution issues and schedule failures
  • Using the Node.js client library (@sap/jobs-client)
在以下场景中使用本技能:
  • 在Cloud Foundry或Kyma运行时设置Job Scheduling Service
  • 通过REST API或控制台创建和管理作业
  • 使用cron、日期/时间或自然语言格式配置调度
  • 为长时间运行的流程实现异步作业执行
  • 使用OAuth 2.0和XSUAA保护动作端点
  • 与SAP Cloud ALM或Alert Notification Service集成
  • 开发具备租户感知作业调度能力的多租户应用
  • 排查作业执行问题与调度失败情况
  • 使用Node.js客户端库**@sap/jobs-client**

Quick Decision Tree

快速决策树

What Task?

任务类型?

Setup & Configuration
├─ Initial setup prerequisites → references/setup-guide.md
├─ Create service instance
│  ├─ BTP Cockpit → references/setup-guide.md#cockpit
│  ├─ CF CLI → references/setup-guide.md#cf-cli
│  └─ Kyma Dashboard → references/setup-guide.md#kyma
└─ Configure XSUAA scopes → references/security.md

Job Management
├─ Create jobs → references/rest-api.md#create-job
├─ Configure schedules → references/rest-api.md#schedules
├─ Run logs & monitoring → references/rest-api.md#run-logs
└─ Dashboard operations → references/operations.md#dashboard

Schedule Configuration
├─ One-time vs recurring → references/concepts.md#schedule-types
├─ Cron format → references/concepts.md#cron-format
├─ Date/time formats → references/concepts.md#date-formats
└─ Human-readable → references/concepts.md#human-readable

Asynchronous Execution
├─ Async mode flow → references/concepts.md#async-mode
├─ Callback implementation → references/rest-api.md#update-run-log
└─ CF tasks → references/concepts.md#cf-tasks

Security & Authentication
├─ OAuth 2.0 setup → references/security.md#oauth
├─ XSUAA configuration → references/security.md#xsuaa
└─ Credential rotation → references/security.md#rotation

Integrations
├─ SAP Cloud ALM → references/integrations.md#cloud-alm
└─ Alert Notification → references/integrations.md#alert-notification

Troubleshooting
├─ Common errors → references/troubleshooting.md#errors
├─ FAQ → references/troubleshooting.md#faq
└─ Support: BC-CP-CF-JBS

Version History & Updates
└─ What's New (2021-2025) → references/changelog.md
设置与配置
├─ 初始设置前提条件 → references/setup-guide.md
├─ 创建服务实例
│  ├─ BTP控制台 → references/setup-guide.md#cockpit
│  ├─ CF CLI → references/setup-guide.md#cf-cli
│  └─ Kyma控制台 → references/setup-guide.md#kyma
└─ 配置XSUAA权限范围 → references/security.md

作业管理
├─ 创建作业 → references/rest-api.md#create-job
├─ 配置调度 → references/rest-api.md#schedules
├─ 运行日志与监控 → references/rest-api.md#run-logs
└─ 控制台操作 → references/operations.md#dashboard

调度配置
├─ 一次性vs周期性 → references/concepts.md#schedule-types
├─ Cron格式 → references/concepts.md#cron-format
├─ 日期/时间格式 → references/concepts.md#date-formats
└─ 自然语言格式 → references/concepts.md#human-readable

异步执行
├─ 异步模式流程 → references/concepts.md#async-mode
├─ 回调实现 → references/rest-api.md#update-run-log
└─ CF任务 → references/concepts.md#cf-tasks

安全与认证
├─ OAuth 2.0设置 → references/security.md#oauth
├─ XSUAA配置 → references/security.md#xsuaa
└─ 凭证轮换 → references/security.md#rotation

集成
├─ SAP Cloud ALM → references/integrations.md#cloud-alm
└─ 告警通知 → references/integrations.md#alert-notification

故障排查
├─ 常见错误 → references/troubleshooting.md#errors
├─ FAQ → references/troubleshooting.md#faq
└─ 支持组件:BC-CP-CF-JBS

版本历史与更新
└─ 新功能(2021-2025)→ references/changelog.md

Core Concepts

核心概念

Job

作业

A collection of schedules with an action endpoint. Jobs invoke a configured URL at specified times synchronously (short operations) or asynchronously (long processes).
包含多个调度与一个动作端点的集合。作业会在指定时间同步(短操作)或异步(长流程)调用配置的URL。

Schedule

调度

A one-time or recurring entity within a job. Supports multiple formats (cron, date/time, human-readable) and has three lifecycle states: SCHEDULED → RUNNING → COMPLETED.
作业内的一次性或周期性实体。支持多种格式(cron、日期/时间、自然语言),拥有三个生命周期状态:SCHEDULED → RUNNING → COMPLETED。

Action Endpoint

动作端点

An HTTP/REST endpoint exposed by your application that the service invokes when schedules trigger. Must be OAuth 2.0 protected in production.
应用暴露的HTTP/REST端点,服务会在调度触发时调用该端点。生产环境中必须通过OAuth 2.0保护。

Cloud Foundry Task

Cloud Foundry任务

An app or script that runs independently in its own container. Always executes asynchronously with configurable memory allocation.
在独立容器中运行的应用或脚本。始终以异步方式执行,可配置内存分配。

Service Constraints

服务约束

ConstraintValue
Minimum schedule interval5 minutes
Synchronous request timeout15 seconds
Asynchronous timeout (default)30 minutes (configurable up to 7 days)
POST request body limit100 KB
Run log retention15 days
Service SLA~20 minutes from scheduled time
约束项取值
最小调度间隔5分钟
同步请求超时15秒
异步超时(默认)30分钟(可配置至最多7天)
POST请求体限制100 KB
运行日志保留时长15天
服务SLA调度时间后约20分钟内执行

Quick Reference Tables

快速参考表

Schedule Formats

调度格式

FormatExampleUse Case
Cron
* * * * 10:12 0,30 0
Every 30 min between 10:00-12:00
Date/Time
2025-10-20T04:30:00Z
ISO-8601 one-time execution
Human-readable
tomorrow at 4pm
Natural language scheduling
repeatInterval
2 hours
,
5 minutes
Recurring at fixed intervals
repeatAt
4.40pm
,
18:40
Daily at specific time
格式示例使用场景
Cron
* * * * 10:12 0,30 0
10:00-12:00之间每30分钟执行一次
日期/时间
2025-10-20T04:30:00Z
ISO-8601格式的一次性执行
自然语言
tomorrow at 4pm
自然语言调度
repeatInterval
2 hours
,
5 minutes
固定间隔周期性执行
repeatAt
4.40pm
,
18:40
每日指定时间执行

Cron Format (7 fields)

Cron格式(7字段)

Year Month Day DayOfWeek Hour Minute Second
*    *     *   *         *    *      *
FieldValuesSpecial
Year4-digit (2025)* = any
Month1-12*/a = every a-th
Day-31 to 31negative = from end
DayOfWeekmon, tue, wed...a.y = a-th occurrence
Hour0-23a:b = range
Minute0-59a:b/c = step in range
Second0-59a,b,c = multiple values
Year Month Day DayOfWeek Hour Minute Second
*    *     *   *         *    *      *
字段取值范围特殊符号
Year4位数字(如2025)* = 任意值
Month1-12*/a = 每a个单位执行一次
Day-31至31负数 = 从月末倒数
DayOfWeekmon, tue, wed...a.y = 第a次出现的周几
Hour0-23a:b = 范围区间
Minute0-59a:b/c = 区间内按步长执行
Second0-59a,b,c = 多个取值

Schedule Lifecycle States

调度生命周期状态

PhaseStatesDescription
SCHEDULEDSCHEDULEDQueued for future run
RUNNINGTRIGGERED, ACK_RECVD, ACK_NOT_RECVDExecuting
COMPLETEDSUCCESS, ERROR, REQUEST_ERROR, UNKNOWNFinished
阶段状态描述
SCHEDULEDSCHEDULED已排队等待未来执行
RUNNINGTRIGGERED, ACK_RECVD, ACK_NOT_RECVD执行中
COMPLETEDSUCCESS, ERROR, REQUEST_ERROR, UNKNOWN已完成

HTTP Methods for Jobs

作业HTTP方法

MethodEndpointPurpose
POST
/scheduler/jobs
Create job
GET
/scheduler/jobs
List all jobs
GET
/scheduler/jobs/{id}
Get job details
PUT
/scheduler/jobs/{id}
Update job
DELETE
/scheduler/jobs/{id}
Delete job
方法端点用途
POST
/scheduler/jobs
创建作业
GET
/scheduler/jobs
列出所有作业
GET
/scheduler/jobs/{id}
获取作业详情
PUT
/scheduler/jobs/{id}
更新作业
DELETE
/scheduler/jobs/{id}
删除作业

Best Practices

最佳实践

Scheduling Optimization

调度优化

Avoid Peak Times:
  • ❌ 0th or 30th second of any minute
  • ❌ 0th, 30th, or multiples of 5 minutes
  • ❌ Top of each hour
  • ❌ Midnight UTC (busiest time)
Use Irregular Times:
  • 01:12:17
    instead of
    01:00:00
  • 01:38:37
    instead of
    01:30:00
避开峰值时段:
  • ❌ 任何分钟的第0或30秒
  • ❌ 第0、30分钟或5分钟倍数的时间点
  • ❌ 每小时整点
  • ❌ UTC午夜(最繁忙时段)
使用非规则时间:
  • ✅ 使用
    01:12:17
    而非
    01:00:00
  • ✅ 使用
    01:38:37
    而非
    01:30:00

Asynchronous Jobs

异步作业

  1. Return 202 Accepted immediately - Don't block the request
  2. Store request headers -
    x-sap-job-id
    ,
    x-sap-job-schedule-id
    ,
    x-sap-job-run-id
    ,
    x-sap-scheduler-host
  3. Update run log on completion - Single API call with final status
  4. Handle timeouts - Default 30 min, configurable up to 7 days
  1. 立即返回202 Accepted - 不要阻塞请求
  2. 存储请求头 -
    x-sap-job-id
    ,
    x-sap-job-schedule-id
    ,
    x-sap-job-run-id
    ,
    x-sap-scheduler-host
  3. 执行完成后更新运行日志 - 单次API调用提交最终状态
  4. 处理超时 - 默认30分钟,可配置至最多7天

One-Time Schedules

一次性调度

  • Use only for testing/validation
  • Auto-deactivate after execution
  • Use
    "time": "now"
    for immediate execution
  • 仅用于测试/验证场景
  • 执行后自动停用
  • 使用
    "time": "now"
    实现立即执行

Authentication Quick Start

认证快速入门

Standard Plan (OAuth 2.0)

标准方案(OAuth 2.0)

bash
undefined
bash
undefined

Get access token

获取访问令牌

curl -X POST "<uaa_url>/oauth/token"
-H "Authorization: Basic $(echo -n '<clientid>:<clientsecret>' | base64)"
-d "grant_type=client_credentials"
curl -X POST "<uaa_url>/oauth/token"
-H "Authorization: Basic $(echo -n '<clientid>:<clientsecret>' | base64)"
-d "grant_type=client_credentials"

Use token in API calls

在API调用中使用令牌

curl -X GET "https://jobscheduler-rest.<landscape>/scheduler/jobs"
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
undefined
curl -X GET "https://jobscheduler-rest.<landscape>/scheduler/jobs"
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
undefined

xs-security.json Configuration

xs-security.json配置

json
{
  "xsappname": "<app-name>",
  "scopes": [{
    "name": "$XSAPPNAME.JOBSCHEDULER",
    "description": "Job Scheduler Scope",
    "grant-as-authority-to-apps": ["$XSSERVICENAME(<jobscheduler-instance>)"]
  }]
}
json
{
  "xsappname": "<app-name>",
  "scopes": [{
    "name": "$XSAPPNAME.JOBSCHEDULER",
    "description": "Job Scheduler Scope",
    "grant-as-authority-to-apps": ["$XSSERVICENAME(<jobscheduler-instance>)"]
  }]
}

Create Job Example

创建作业示例

json
POST /scheduler/jobs
{
  "name": "myJob",
  "description": "Process daily reports",
  "action": "https://myapp.cfapps.eu10.hana.ondemand.com/api/process",
  "active": true,
  "httpMethod": "POST",
  "schedules": [{
    "active": true,
    "description": "Daily at 6 AM",
    "repeatAt": "6.00am",
    "startTime": {"date": "2025-01-01", "format": "YYYY-MM-DD"}
  }]
}
json
POST /scheduler/jobs
{
  "name": "myJob",
  "description": "Process daily reports",
  "action": "https://myapp.cfapps.eu10.hana.ondemand.com/api/process",
  "active": true,
  "httpMethod": "POST",
  "schedules": [{
    "active": true,
    "description": "Daily at 6 AM",
    "repeatAt": "6.00am",
    "startTime": {"date": "2025-01-01", "format": "YYYY-MM-DD"}
  }]
}

Node.js Client Library

Node.js客户端库

Requirements: Node.js 14.x or later
bash
npm install @sap/jobs-client@1.8.6
javascript
const JobSchedulerClient = require('@sap/jobs-client');
const scheduler = new JobSchedulerClient.Scheduler();

// Create job
scheduler.createJob({ url: vcapServices.jobscheduler[0].credentials.url }, {
  name: 'myJob',
  action: 'https://myapp.../process',
  active: true,
  httpMethod: 'GET',
  schedules: [{ cron: '* * * * 0 0 0', active: true }]
}, (err, result) => { /* handle */ });
要求:Node.js 14.x或更高版本
bash
npm install @sap/jobs-client@1.8.6
javascript
const JobSchedulerClient = require('@sap/jobs-client');
const scheduler = new JobSchedulerClient.Scheduler();

// 创建作业
scheduler.createJob({ url: vcapServices.jobscheduler[0].credentials.url }, {
  name: 'myJob',
  action: 'https://myapp.../process',
  active: true,
  httpMethod: 'GET',
  schedules: [{ cron: '* * * * 0 0 0', active: true }]
}, (err, result) => { /* 处理逻辑 */ });

Rate Limits

速率限制

Limit TypeResponse CodeHeader
Client limit exceeded429
retry-after
(seconds)
Absolute limit exceeded503
throttling
(milliseconds)
Limits stack - both can apply simultaneously.
限制类型响应码响应头
客户端限制超出429
retry-after
(秒)
绝对限制超出503
throttling
(毫秒)
限制会叠加 - 两种限制可能同时生效。

Service Behavior

服务行为

Outage Recovery

中断恢复

Outage DurationBehavior
< 20 minutesAll missed executions run immediately
>= 20 minutesOnly last missed execution runs
中断时长行为
< 20分钟所有错过的执行立即运行
>= 20分钟仅运行最后一次错过的执行

Auto-Deactivation Triggers

自动停用触发条件

  • One-time schedule executed
  • No valid future dates exist
  • Job/schedule endTime reached
  • Action endpoint unreachable for 10+ days
  • 一次性调度已执行
  • 无有效未来执行日期
  • 作业/调度的endTime已到达
  • 动作端点连续10天以上无法访问

Reference Files

参考文件

Detailed Guides Available

可用详细指南

  1. references/concepts.md - Schedule types, formats, lifecycle, async mode, multitenancy
  2. references/rest-api.md - Complete REST API reference with all endpoints
  3. references/setup-guide.md - Prerequisites, service instance creation
  4. references/security.md - OAuth 2.0, XSUAA scopes, credential rotation
  5. references/integrations.md - Cloud ALM, Alert Notification Service
  6. references/troubleshooting.md - FAQ, error scenarios, monitoring
  7. references/operations.md - Dashboard, backup/restore, service behavior
  8. references/changelog.md - Version history, feature updates (2021-2025)
  1. references/concepts.md - 调度类型、格式、生命周期、异步模式、多租户
  2. references/rest-api.md - 完整REST API参考,包含所有端点
  3. references/setup-guide.md - 前提条件、服务实例创建
  4. references/security.md - OAuth 2.0、XSUAA权限范围、凭证轮换
  5. references/integrations.md - Cloud ALM、Alert Notification Service集成
  6. references/troubleshooting.md - FAQ、错误场景、监控
  7. references/operations.md - 控制台、备份/恢复、服务行为
  8. references/changelog.md - 版本历史、功能更新(2021-2025)

Templates Available

可用模板

  1. templates/job-creation.json - Job creation request template
  2. templates/xs-security.json - XSUAA configuration template
  1. templates/job-creation.json - 作业创建请求模板
  2. templates/xs-security.json - XSUAA配置模板

Common Pitfalls

常见陷阱

Setup:
  • ❌ Missing XSUAA binding before Job Scheduling binding
  • ❌ Not granting scopes via
    grant-as-authority-to-apps
  • ❌ Using HTTP instead of HTTPS for action endpoints
Scheduling:
  • ❌ Using Linux cron format (service uses SAP cron)
  • ❌ Scheduling at peak times (00:00, 00:30, etc.)
  • ❌ Forgetting UTC timezone (only supported timezone)
Async Jobs:
  • ❌ Not returning 202 Accepted immediately
  • ❌ Forgetting to call Update Run Log API
  • ❌ Multiple status updates instead of single final update
Multitenancy:
  • ❌ Using
    tenantId
    filter with SaaS tenant tokens (returns 400)
  • ❌ Missing Job Scheduling as application dependency
设置阶段:
  • ❌ 在绑定Job Scheduling之前未绑定XSUAA
  • ❌ 未通过
    grant-as-authority-to-apps
    授予权限范围
  • ❌ 动作端点使用HTTP而非HTTPS
调度阶段:
  • ❌ 使用Linux cron格式(服务使用SAP cron格式)
  • ❌ 在峰值时段调度(如00:00、00:30等)
  • ❌ 忘记使用UTC时区(仅支持该时区)
异步作业:
  • ❌ 未立即返回202 Accepted
  • ❌ 忘记调用更新运行日志API
  • ❌ 多次更新状态而非单次提交最终状态
多租户场景:
  • ❌ 使用SaaS租户令牌时添加
    tenantId
    筛选器(会返回400错误)
  • ❌ 未将Job Scheduling列为应用依赖

External Resources

外部资源

SAP Documentation

SAP文档

Support

支持

  • Component: BC-CP-CF-JBS
  • SAP Trust Center: Platform status verification
  • Guided Answers: Self-service troubleshooting
  • 组件:BC-CP-CF-JBS
  • SAP信任中心:平台状态验证
  • 引导式答案:自助故障排查

Updates and Maintenance

更新与维护

Source: SAP BTP Job Scheduling Service Documentation
To Update This Skill:
  1. Check GitHub repository for documentation updates
  2. Review What's New section for changes
  3. Update affected reference files
  4. Update templates if configurations changed
  5. Update "Last Verified" date
Quarterly Review Recommended: Check for updates every 3 months
Next Review: 2026-02-27
来源:SAP BTP Job Scheduling Service文档
更新本技能步骤
  1. 检查GitHub仓库获取文档更新
  2. 查看“新功能”部分了解变更
  3. 更新受影响的参考文件
  4. 若配置变更则更新模板
  5. 更新“最后验证时间”
建议季度审核:每3个月检查一次更新
下次审核时间:2026-02-27

Bundled Resources

捆绑资源

Reference Files

参考文件

  1. references/concepts.md - Schedule types, formats, lifecycle, async mode, multitenancy (12K lines)
  2. references/rest-api.md - Complete REST API reference with all endpoints (20K lines)
  3. references/setup-guide.md - Prerequisites, service instance creation (9K lines)
  4. references/security.md - OAuth 2.0, XSUAA scopes, credential rotation (11K lines)
  5. references/integrations.md - Cloud ALM, Alert Notification Service (8K lines)
  6. references/troubleshooting.md - FAQ, error scenarios, monitoring (9K lines)
  7. references/operations.md - Dashboard, backup/restore, service behavior (8K lines)
  8. references/changelog.md - Version history, feature updates (2021-2025) (9K lines)
  1. references/concepts.md - 调度类型、格式、生命周期、异步模式、多租户(12000行)
  2. references/rest-api.md - 完整REST API参考,包含所有端点(20000行)
  3. references/setup-guide.md - 前提条件、服务实例创建(9000行)
  4. references/security.md - OAuth 2.0、XSUAA权限范围、凭证轮换(11000行)
  5. references/integrations.md - Cloud ALM、Alert Notification Service集成(8000行)
  6. references/troubleshooting.md - FAQ、错误场景、监控(9000行)
  7. references/operations.md - 控制台、备份/恢复、服务行为(8000行)
  8. references/changelog.md - 版本历史、功能更新(2021-2025)(9000行)

Templates

模板

  1. templates/job-creation.json - Job creation request template with examples
  2. templates/xs-security.json - XSUAA configuration template for OAuth scopes

License: GPL-3.0 Maintainer: Eduard Jiglau | hello@sap-ai-skills.com | sap-ai-skills.com | https://github.com/secondsky/sap-skills
  1. templates/job-creation.json - 带示例的作业创建请求模板
  2. templates/xs-security.json - OAuth权限范围的XSUAA配置模板

许可证:GPL-3.0 维护者:Eduard Jiglau | hello@sap-ai-skills.com | sap-ai-skills.com | https://github.com/secondsky/sap-skills