Comments (8)
Yes
from console-parallelization.
You could alter the code to ensure a child process is used even for --processes 1
(currently if only 1 thread is found, it will use the current process instead of spawning a child one)
But IIRC, there is the run{Before,After}Batch()
which can help to clean some state (e.g. clearing the repositories)
from console-parallelization.
@theofidry Thanks for the fast reply 🙂
Using the run{Before,After}Batch()
methods is unfortunately not an option. I'm using the command to run a replay of projections in an EventSourcing system and on execution time don't know which repositories are used within the projection handlers. That's why I thought of the child processes as this would automatically clear all used resources.
With altering the code you mean overwriting executeMasterProcess
, copying everything over and adapt to always use the child process method? That would have been my backup plan 🙂 But if there is no other way, that I will need to do this. Do you think this would make a useful feature for this package? Something like an optional --always-use-child-process
argument to trigger this behaviour?
from console-parallelization.
I was more thinking of a PR to change the behaviour to use a child process when giving --processes 1
. That would be simpler and more consistent than introducing a new option just for this case
from console-parallelization.
@theofidry Ah ok, doesn't that change the current behaviour? If someone is using --processes 1
it it's the same as not setting it. With an update the behaviour would change. I don't know if there is a relevant usage set of users which this configuration.
But I wouldn't mind. If it's ok to you, I would prepare a pull request tomorrow.
from console-parallelization.
Technically it is a BC, but since it's quite an edge and arguably a bug (you do specify a process: why doesn't it spawn a child?) I think it could pass in 1.1.0
from console-parallelization.
Great, then I will try to provide a pull request tomorrow. Is it enough to provide an additional test like test_it_can_run_the_command_with_multiple_processes
?
from console-parallelization.
Closed by #15
from console-parallelization.
Related Issues (20)
- Roadmap? HOT 1
- Better solution for the "item" - argument? HOT 2
- Pipe breaks when quotes are used in input options
- Plans for v2 HOT 1
- Auto-detect the number of processes
- Always use a sub-process; add no-parallel option HOT 1
- Add options to change the segment size or batch size on the fly
- Add stop-on-failure option
- Configuration calculation may result in an exception if there is no items
- [2.x] Some resources are missing HOT 4
- Limit the exit code to 255
- Incorrect error message HOT 1
- Make it easier to override getParallelExecutableFactory()
- Add a utility decorator logger
- Add a logger to log the item handling to an arbitrary logger HOT 1
- Error when $_SERVER['PWD'] is not set HOT 7
- Documentation for ::getParallelExecutableFactory HOT 3
- Error when the server script name is an absolute path HOT 4
- Consider run before/last segment API
- Make the item argument name configurable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from console-parallelization.