multi-tasks 3.1.4 → 3.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +25 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -161,6 +161,12 @@ multiTasks({
161
161
  maxTaskRetries: 2,
162
162
  });
163
163
 
164
+ ```
165
+
166
+ ### Event broadcast
167
+
168
+ ```javascript
169
+
164
170
  //Example6, broadcast events between workers with helper.emit/helper.setListener
165
171
  multiTasks({
166
172
  initialTasks: alltasks,
@@ -199,15 +205,30 @@ multiTasks({
199
205
 
200
206
  ### Resuming
201
207
 
202
- If the execution is interrupted (e.g. a power outage), resume it by pointing to the task foldernothing else is needed, the config (including `processTask`) is restored from `task_config.json`:
208
+ If the execution is interrupted (e.g. a power outage), the simplest way to resume is to just re-run the same code`multiTasks(config)` detects the existing task folder and auto-resumes, re-running only the stuck tasks:
203
209
 
204
210
  ```javascript
205
211
 
206
- multiTasks.resume({ taskFolder: `/myworks/my_scan_tasks/my-task` }); //taskFolder: the full path of the existing task folder
212
+ //same command, same config as the interrupted run that's all
213
+ multiTasks(config);
214
+
215
+ ```
216
+
217
+ Or point `initialTasks` at the task folder — same effect:
218
+
219
+ ```javascript
220
+
221
+ multiTasks({ ...config, initialTasks: `/myworks/my_scan_tasks/my-task` });
207
222
 
208
223
  ```
209
224
 
210
- Re-running `multiTasks(config)` (or pointing `initialTasks` at the folder) auto-resumes too; passed config wins over the snapshot.
225
+ Or resume from the task folder alone the config (including `processTask`) is restored from `task_config.json`:
226
+
227
+ ```javascript
228
+
229
+ multiTasks.resume({ taskFolder: `/myworks/my_scan_tasks/my-task` }); //taskFolder: the full path of the existing task folder
230
+
231
+ ```
211
232
 
212
233
  **Note:** revived functions must be **self-contained** (no outer-scope variables; `require(...)` inside the body) — otherwise pass them again, they always win:
213
234
 
@@ -242,6 +263,7 @@ Unlike `retry_fails` (which re-runs only the failed tasks), `restart` re-runs **
242
263
 
243
264
  ### Changelog:
244
265
 
266
+ - 3.1.5 Update README
245
267
  - 3.1.4 Rewrite `multiTasks.resume`, `multiTasks.retry_fails` and `multiTasks.restart`
246
268
  - 3.1.3 Update README
247
269
  - 3.1.2 Update README
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multi-tasks",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "Multi-process task scheduling based on Node.js cluster, with crash resume and failed-task restart support",
5
5
  "main": "index.js",
6
6
  "files": [