Giter Site home page Giter Site logo

soyuka / relieve Goto Github PK

View Code? Open in Web Editor NEW
48.0 5.0 4.0 599 KB

Ease the implementation of multi processing accross your microservices

Home Page: http://soyuka.github.io/relieve/

JavaScript 100.00%
process workers task child-process microservice failsafe

relieve's Introduction

Relieve Test Coverage Code Climate Build Status Build status

The goal of this library is to ease the implementation of multi processing accross your existing microservices. Relieve aims to give a reusable design pattern using process forks. It also eases communication with child processes with an high-level abstraction.

For example, with a CallableTask:

//task.js
//just export a module in the child process
module.exports = {
  print: (str) => {
    console.log(str)
  },
  data: () => {
    //return some async data
    return Promise.resolve({foo: 'bar'})
  }
}

Then from your master, just call the task:

//worker.js
var CallableTask = require('relieve/tasks/CallableTask')
var task = new CallableTask('task.js')

task.start()
.then(() => {
  task.call('print', 'hello world')
  return task.get('data')
})
.then(d => {
  //d is {foo: 'bar'}
})

The design pattern

Relieve is based on a design pattern containing:

  • A Worker
  • One or more tasks

The task can be used without a Worker, but the Worker helps managing workflows.

Task

The task will implement a child process using fork. It'll make sure that there is an ipc channel open so that Workers and Tasks can communicate. There are different tasks implementations:

  • Fork Task - simply transforms a ChildProcess.fork in a Task
  • Script Task - wraps a script path in a container that is managed through ChildProcess.fork. It gives the ability to start, restart or kill a Task
  • Callable Task - this is a Script Task with convenience methods to call or get script methods remotely

Tutorials:

Worker

Different kind of Workers for different use cases. Every Worker takes one or more tasks and handles them.

  • Worker - it's a basic worker. Helps sending a message to every task.
  • QueueWorker - process tasks one after the other, or in concurrency. Waits for a Task to exit before it consider's it as done.
  • CloudWorker - does not wait for tasks to exit and process them through a Strategy (ie: RoundRobin)

Tutorials:

Tools

  • Containers - easy way to add ipc methods for your tasks
  • Interfaces - extends how the tasks are managed (FailSafe, Logger)

Links

relieve's People

Contributors

dependabot[bot] avatar soyuka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

relieve's Issues

CloudWorker and QueueWorker share tasks

// DB
    this.worker = relieve.workers.CloudWorker({});
    const task = new CallableTask(path.resolve(__dirname, 'database_task.js'), {restart: true});
    task.name = 'db';
    this.worker.add(task);
//RUNNER
    this.worker = relieve.workers.QueueWorker({ concurrency: 4 });
    if (this.worker.tasks.db) {
      // true!!??
    }

Issues running tests on the various packages.

Hello!

I wanted to see if this package works properly by running it's test suite and, some tests do work, some do not. Here is the whole output I got.

I noticed that the packages all require through relieve/.... Maybe I oversaw how to set up the testing somewhere?

Kind regards,
Ingwie

C:\Users\ingwi\AppData\Local\Temp\node\relieve>npm i
added 136 packages from 109 contributors and audited 202 packages in 1.832s
found 4 high severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

C:\Users\ingwi\AppData\Local\Temp\node\relieve>npm test

> [email protected] test C:\Users\ingwi\AppData\Local\Temp\node\relieve
> lerna run test

Lerna v2.0.0-beta.38

> [email protected] test C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-logger
> mocha --exit



  RelieveLogger
    √ should create log file and close stream on exit
    √ should append to log file
    √ should rotate delay
    √ should not rotate delay
    √ should rotate size
    √ should not rotate size


  6 passing (15ms)



> [email protected] test C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve
> mocha



  utils
    defineNameProperty
      √ should register name getter/setter
      √ should get default name
      √ should fail setting name twice

  strategies
    Strategy
      √ should add some values
      √ should get the next value
      √ should get the next value
      √ should get the next value
      √ should get test1
      √ should get nothing
      √ should remove strategy

  task
    ForkTask
      √ should throw because ipc is not available
      √ should create a new without constructor
      √ should create a new task
      √ should get message through task (46ms)
      √ should not be available because child has been killed
    ScriptTask
      √ should fail creating a new ScriptTask
      √ should create a new ScriptTask (59ms)
      √ should reject starting again
      √ should restart (64ms)
      √ should reject start
      √ should kill
      √ should create an autorestart task (62ms)
      √ should register event before starting (58ms)
      √ should send a message to the task and resolve promise when message has been delivered
      √ should fail sending a message if the task is not started
      √ should start a task with arguments (59ms)
      √ should start a task with complex arguments (57ms)
      √ should add one interface
      √ should not add invalid interface
      √ should stop and not restart (63ms)
      √ should still be an autorestart task (63ms)
    CallableTask
      √ should create a new CallableTask (59ms)
      √ should create an autorestart callable task (63ms)
      √ should create a new CallableTask without constructor (59ms)
      √ should call a function
      √ should have register an emiting interval
      √ should stop the interval
      √ should get the value
      √ should get the args
      √ should throw an get error event
      √ should create a new CallableTask with a different Container (59ms)
      √ should kill the task
      √ should be monitorable (60ms)

  worker
    Worker
      √ should add a task
      √ should add a second task and get them all
      √ should send a message to every task
      √ should remove task
      √ should send SIGINT to tasks
      √ should not be able to set tasks
    QueueWorker
      √ should fail adding a ForkTask
      √ should add and remove a task
      √ should add three tasks
      √ should start one task (264ms)
      √ should start every task in series (523ms)
      √ should start every tasks in concurrency
    CloudWorker
      √ should fail adding a ForkTask
      √ should add and remove a task
      √ should add and run two tasks (62ms)
      √ should add and start a third one (58ms)
      √ should receive one answer
      √ should get one answer
      √ should call
      √ should exit worker
      √ should reject the promise because task is not callable (59ms)


  64 passing (2s)


NpmUtilities.execInDir        ("run test", [], "C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe")
Error: Command failed: npm run test
C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:1163
      else throw err
           ^

Error: Cannot find module 'relieve/tasks/ScriptTask'
Require stack:
- C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\end2end.js
- C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\index.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\one-and-dones.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\options.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\bin\mocha
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\end2end.js:2:20)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\index.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:311:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:308:14)
    at Mocha.run (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:849:10)
    at Object.exports.singleRun (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run-helpers.js:108:16)
    at exports.runMocha (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run-helpers.js:143:13)
    at Object.exports.handler (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run.js:305:3)
    at Object.runCommand (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\lib\command.js:242:26)
    at Object.parseArgs [as _parseArgs] (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:1087:28)
    at Object.parse (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:566:25)
    at Object.exports.main (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\cli.js:68:6)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\bin\mocha:133:29)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe\\test\\end2end.js',
    'C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe\\test\\index.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\mocha.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\cli\\one-and-dones.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\cli\\options.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\bin\\mocha'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `mocha -b test/index.js --exit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ingwi\AppData\Roaming\npm-cache\_logs\2020-02-05T10_27_13_929Z-debug.log

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:321:20)
    at maybeClose (internal/child_process.js:1026:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

> [email protected] test C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe
> mocha -b test/index.js --exit


NpmUtilities.runScriptInDir   ("test", [], "C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe")
Error: Command failed: npm run test
C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:1163
      else throw err
           ^

Error: Cannot find module 'relieve/tasks/ScriptTask'
Require stack:
- C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\end2end.js
- C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\index.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\one-and-dones.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\options.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\bin\mocha
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\end2end.js:2:20)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\index.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:311:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:308:14)
    at Mocha.run (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:849:10)
    at Object.exports.singleRun (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run-helpers.js:108:16)
    at exports.runMocha (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run-helpers.js:143:13)
    at Object.exports.handler (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run.js:305:3)
    at Object.runCommand (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\lib\command.js:242:26)
    at Object.parseArgs [as _parseArgs] (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:1087:28)
    at Object.parse (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:566:25)
    at Object.exports.main (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\cli.js:68:6)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\bin\mocha:133:29)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe\\test\\end2end.js',
    'C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe\\test\\index.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\mocha.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\cli\\one-and-dones.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\cli\\options.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\bin\\mocha'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `mocha -b test/index.js --exit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ingwi\AppData\Roaming\npm-cache\_logs\2020-02-05T10_27_13_929Z-debug.log

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:321:20)
    at maybeClose (internal/child_process.js:1026:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

> [email protected] test C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe
> mocha -b test/index.js --exit



> [email protected] test C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe
> mocha -b test/index.js --exit


Errored while running npm script 'test' in 'relieve-failsafe'
Error: Command failed: npm run test
C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:1163
      else throw err
           ^

Error: Cannot find module 'relieve/tasks/ScriptTask'
Require stack:
- C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\end2end.js
- C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\index.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\one-and-dones.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\options.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\bin\mocha
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\end2end.js:2:20)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\index.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:311:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:308:14)
    at Mocha.run (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:849:10)
    at Object.exports.singleRun (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run-helpers.js:108:16)
    at exports.runMocha (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run-helpers.js:143:13)
    at Object.exports.handler (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run.js:305:3)
    at Object.runCommand (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\lib\command.js:242:26)
    at Object.parseArgs [as _parseArgs] (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:1087:28)
    at Object.parse (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:566:25)
    at Object.exports.main (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\cli.js:68:6)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\bin\mocha:133:29)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe\\test\\end2end.js',
    'C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe\\test\\index.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\mocha.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\cli\\one-and-dones.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\cli\\options.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\bin\\mocha'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `mocha -b test/index.js --exit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ingwi\AppData\Roaming\npm-cache\_logs\2020-02-05T10_27_13_929Z-debug.log

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:321:20)
    at maybeClose (internal/child_process.js:1026:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
Errored while running RunCommand.execute
Error: Command failed: npm run test
C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:1163
      else throw err
           ^

Error: Cannot find module 'relieve/tasks/ScriptTask'
Require stack:
- C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\end2end.js
- C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\index.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\one-and-dones.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\options.js
- C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\bin\mocha
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\end2end.js:2:20)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Local\Temp\node\relieve\packages\relieve-failsafe\test\index.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:311:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:308:14)
    at Mocha.run (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:849:10)
    at Object.exports.singleRun (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run-helpers.js:108:16)
    at exports.runMocha (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run-helpers.js:143:13)
    at Object.exports.handler (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\run.js:305:3)
    at Object.runCommand (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\lib\command.js:242:26)
    at Object.parseArgs [as _parseArgs] (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:1087:28)
    at Object.parse (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\node_modules\yargs\yargs.js:566:25)
    at Object.exports.main (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\lib\cli\cli.js:68:6)
    at Object.<anonymous> (C:\Users\ingwi\AppData\Roaming\npm\node_modules\mocha\bin\mocha:133:29)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe\\test\\end2end.js',
    'C:\\Users\\ingwi\\AppData\\Local\\Temp\\node\\relieve\\packages\\relieve-failsafe\\test\\index.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\mocha.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\cli\\one-and-dones.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\lib\\cli\\options.js',
    'C:\\Users\\ingwi\\AppData\\Roaming\\npm\\node_modules\\mocha\\bin\\mocha'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `mocha -b test/index.js --exit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ingwi\AppData\Roaming\npm-cache\_logs\2020-02-05T10_27_13_929Z-debug.log

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:321:20)
    at maybeClose (internal/child_process.js:1026:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
npm ERR! Test failed.  See above for more details.

What changed from 1 to 2?

This snippet of code worked on 1.0.3 and stopped working on v2 (findAvailableWorker returns CallableTask instance) worker.get('result') returns Promise

What breaking changes are made from 1.0.3 to 2.0.0?

let parse = item => Rx.Observable
  .just(1)
  .do(() => console.log('parse', item))
  .flatMap(() => findAvailableWorker())
  .do(worker => worker.call('parse', item))
  .flatMap(worker => worker.get('result'))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.