提交 1de986fa 编写于 作者: Z zhutianyi

workscheduler

Signed-off-by: Nzhutianyi <zhutianyi2@huawei.com>
上级 dc2ff74b
...@@ -39,14 +39,7 @@ Instructs the **WorkSchedulerService** to add the specified task to the executio ...@@ -39,14 +39,7 @@ Instructs the **WorkSchedulerService** to add the specified task to the executio
isRepeat: false, isRepeat: false,
isPersisted: true, isPersisted: true,
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "MyExtension", abilityName: "MyExtension"
parameters: {
mykey0: 2222,
mykey1: "ssssssssssssssssssssssssss",
mykey2: true,
mykey3: 1.5,
mykey4: 213749534591254587511
}
} }
var res = workScheduler.startWork(workInfo); var res = workScheduler.startWork(workInfo);
console.info("workschedulerLog res:" + res); console.info("workschedulerLog res:" + res);
...@@ -82,14 +75,7 @@ Instructs the **WorkSchedulerService** to stop the specified task. ...@@ -82,14 +75,7 @@ Instructs the **WorkSchedulerService** to stop the specified task.
isRepeat: false, isRepeat: false,
isPersisted: true, isPersisted: true,
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "MyExtension", abilityName: "MyExtension"
parameters: {
mykey0: 2222,
mykey1: "ssssssssssssssssssssssssss",
mykey2: true,
mykey3: 1.5,
mykey4: 213749534591254587511
}
} }
var res = workScheduler.stopWork(workInfo, false); var res = workScheduler.stopWork(workInfo, false);
console.info("workschedulerLog res:" + res); console.info("workschedulerLog res:" + res);
...@@ -286,7 +272,7 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -286,7 +272,7 @@ Checks whether the last execution of the specified task timed out. This API uses
``` ```
## WorkInfo ## WorkInfo
Provides detailed information about the task. The constraint of WorkInfo reference [Work Scheduler Overview](../../task-management/work-scheduler-overview.md) Provides detailed information about the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
......
...@@ -34,8 +34,6 @@ function isLastWorkTimeOut(workId: number): Promise<boolean>;| Checks whether th ...@@ -34,8 +34,6 @@ function isLastWorkTimeOut(workId: number): Promise<boolean>;| Checks whether th
**Table 2** WorkInfo parameters **Table 2** WorkInfo parameters
> **Explanation:** The constraint of WorkInfo reference [Work Scheduler Overview](./work-scheduler-overview.md)
API|Description|Type API|Description|Type
---------------------------------------------------------|-----------------------------------------|--------------------------------------------------------- ---------------------------------------------------------|-----------------------------------------|---------------------------------------------------------
workId | Work ID. Mandatory.|number workId | Work ID. Mandatory.|number
...@@ -50,7 +48,6 @@ storageRequest|Storage status.| StorageRequest ...@@ -50,7 +48,6 @@ storageRequest|Storage status.| StorageRequest
isRepeat|Whether the task is repeated.| boolean isRepeat|Whether the task is repeated.| boolean
repeatCycleTime |Repeat interval.| number repeatCycleTime |Repeat interval.| number
repeatCount |Number of repeat times.| number repeatCount |Number of repeat times.| number
parameters |Parameters carried| {[key: string]: any}
**Table 3** Work Scheduler callbacks **Table 3** Work Scheduler callbacks
...@@ -88,14 +85,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -88,14 +85,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
isRepeat: false, isRepeat: false,
isPersisted: true, isPersisted: true,
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "MyExtension", abilityName: "MyExtension"
parameters: {
mykey0: 2222,
mykey1: "ssssssssssssssssssssssssss",
mykey2: true,
mykey3: 1.5,
mykey4: 213749534591254587511
}
} }
var res = workScheduler.startWork(workInfo); var res = workScheduler.startWork(workInfo);
console.info("workschedulerLog res:" + res); console.info("workschedulerLog res:" + res);
...@@ -113,14 +103,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -113,14 +103,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
isRepeat: false, isRepeat: false,
isPersisted: true, isPersisted: true,
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "MyExtension", abilityName: "MyExtension"
parameters: {
mykey0: 2222,
mykey1: "ssssssssssssssssssssssssss",
mykey2: true,
mykey3: 1.5,
mykey4: 213749534591254587511
}
} }
var res = workScheduler.stopWork(workInfo, false); var res = workScheduler.stopWork(workInfo, false);
console.info("workschedulerLog res:" + res); console.info("workschedulerLog res:" + res);
......
...@@ -11,17 +11,6 @@ If your application needs to execute a non-real-time task, for example, data lea ...@@ -11,17 +11,6 @@ If your application needs to execute a non-real-time task, for example, data lea
The use of the Work Scheduler must comply with the following restrictions and rules: The use of the Work Scheduler must comply with the following restrictions and rules:
- **Timeout**: The Work Scheduler callback can run only within the specified period of time. After the timeout, the callback automatically stops. - **Timeout**: The Work Scheduler callback can run only within the specified period of time. After the timeout, the callback automatically stops.
- **Execution frequency**:The system will perform hierarchical control on the work scheduler according to the bundle activity of the application, and limit the execution frequency of work scheduler.
Application group | Execution frequency constraint
--------------------|-------------------------
active group | minimum interval 2 hours
daily used group | minimum interval 4 hours
fixed group | minimum interval 24 hours
rare used group | minimum interval 48 hours
restricted group | forbidden
unused group | forbidden
- **WorkInfo setting** - **WorkInfo setting**
(1) **workId**, **bundleName**, and **abilityName** are mandatory. **bundleName** must be set to the name of the current application. Otherwise, the verification will fail. (1) **workId**, **bundleName**, and **abilityName** are mandatory. **bundleName** must be set to the name of the current application. Otherwise, the verification will fail.
...@@ -29,5 +18,3 @@ unused group | forbidden ...@@ -29,5 +18,3 @@ unused group | forbidden
(2) At least one condition must be set. (2) At least one condition must be set.
(3) The repeat interval must be at least 20 minutes and must work with the Always repeat pattern or repeat times. (3) The repeat interval must be at least 20 minutes and must work with the Always repeat pattern or repeat times.
(4) Parameters support type include number, string and bool.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册