parallel_machine
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "parallel_machine", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Javascript library for distributing tasks over many keys, limiting parallelism for each.", | ||
@@ -13,4 +13,4 @@ "keywords": [ | ||
"license": "MIT", | ||
"main": "src/index.js", | ||
"typings": "src/index.d.ts", | ||
"main": "build/src/index.js", | ||
"typings": "build/src/index.d.ts", | ||
"typescript": { | ||
@@ -17,0 +17,0 @@ "definition": "parallel_machine.d.ts" |
@@ -16,3 +16,3 @@ # parallel_machine | ||
```javascript | ||
import * as parallel_machine from "parallel_machine"; | ||
var parallel_machine = require("parallel_machine"); | ||
@@ -19,0 +19,0 @@ tables = [ |
@@ -0,1 +1,3 @@ | ||
import { ProgressTracker } from "./queue"; | ||
export type TaskExecutor<T> = (task: T, callback: (Error?: any) => void) => void; | ||
@@ -9,1 +11,13 @@ export type TaskDescriptor<T> = (task: T) => string; | ||
export type QUEUE_DRAINED = "queue_drained"; | ||
export interface IParallelMachineOptions<T> { | ||
// Function which for each task returns it's key (i.e. hostname) | ||
taskDescriptor: TaskDescriptor<T>; | ||
// Async function that executes an action on the target task, calling back once done. | ||
executor: TaskExecutor<T>; | ||
// Up to how many tasks for a given `key` to execute at a time. | ||
keyParallelism: number; | ||
// How many tasks to execute overall. Null or missing means unlimited. | ||
overallParallelism?: number | null; | ||
progressTracker?: ProgressTracker<T>; | ||
} |
@@ -1,17 +0,5 @@ | ||
import { TaskDescriptor, TaskExecutor } from "./common"; | ||
import { AsyncTaskQueue, ProgressTracker, TaskQueue } from "./queue"; | ||
import { IParallelMachineOptions, TaskDescriptor, TaskExecutor } from "./common"; | ||
import { AsyncTaskQueue } from "./queue"; | ||
export interface IParallelMachineOptions<T> { | ||
// Function which for each task returns it's key (i.e. hostname) | ||
taskDescriptor: TaskDescriptor<T>; | ||
// Async function that executes an action on the target task, calling back once done. | ||
executor: TaskExecutor<T>; | ||
// Up to how many tasks for a given `key` to execute at a time. | ||
keyParallelism: number; | ||
// How many tasks to execute overall. Null or missing means unlimited. | ||
overallParallelism?: number | null; | ||
progressTracker?: ProgressTracker<T>; | ||
} | ||
export default function parallel_machine<T>( | ||
function parallel_machine<T>( | ||
tasks: T[], | ||
@@ -33,1 +21,3 @@ options: IParallelMachineOptions<T>, | ||
} | ||
export = parallel_machine; |
import { expect } from "chai"; | ||
import _ = require("lodash"); | ||
import * as _ from "lodash"; | ||
import "mocha"; | ||
import parallel_machine from "../src"; | ||
import parallel_machine = require("../src"); | ||
import { TaskDescriptor, TaskExecutor } from "../src/common"; | ||
@@ -7,0 +7,0 @@ |
@@ -8,2 +8,3 @@ { | ||
"sourceMap": true, | ||
"outDir": "build", | ||
"listFiles": true, | ||
@@ -10,0 +11,0 @@ "declaration": true |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
647473
45
21219
1