mutant icon indicating copy to clipboard operation
mutant copied to clipboard

Add worker context information

Open tjchambers opened this issue 9 years ago • 0 comments

When running mutant in concurrent mode (multiple workers) it is sometimes useful to insulate the workers activities from each other in accessing resources. Examples:

  • Distinct in memory caches
  • Separate databases to prevent deadlock and rollback to savepoint conflicts
  • Distinct temporary directories

Many of these can be handled internally by application of the worker's process id in resource naming - this is easily accessible.

Some may be easier to support if sme minor information were accessible about the worker, such as the workers relative number (1-8 for instance in -j8 setting). With such access to information a developer could select a specific database (db1 through db8) or Rails environment (test1 through test8) to insulate the activities and reduce concurrent conflict while minimizing overhead.

Minimizing overhead could come in the form of pre-establishing a suitable small number of pre-prepared databases, or the lazy establishment of the databases prior to inception of a run.

The main criteria is to have it be accessible to the developer early enough in the test environment to make use of it, and to be lightweight enough as to not be required to be used unless the insulation was appropriate/necessary.

tjchambers avatar Sep 02 '15 14:09 tjchambers