Coder Social home page Coder Social logo

ci-queue's Introduction

CI::Queue

Gem Version Tests

Distribute tests over many workers using a queue.

Why a queue?

One big problem with distributed test suites, is test imbalance. Meaning that one worker would spend 10 minutes while all the others are done after 1 minute. There are algorithms available to balance perfectly your workers, but in practice your test performance tend to vary, and it's easier to consider tests as work unit in a queue and let workers pop them as fast as possible.

Another advantage is that if you lose workers along the way, using a queue the other workers can pick up the job, making you resilient to failures.

How does it work?

Each workers first participate in a leader election, the elected leader will then populate the queue with the list of tests to run. Once the queue is initialized, all workers including the leader will reserve tests and work them on until the queue is empty.

If a worker were to die, its reserved work load will be put back into the queue to be picked up by it's surviving siblings.

Additionally, a separate process can be started to centralize the error reporting, that process will wait for the queue to be empty before exiting.

What are requeues?

When working on big test suites, it's not uncommon for a few tests to fail intermittently, either because they are inherently flaky, or because they are sensitive to other tests modifying some global state (leaky tests).

In this context, it is useful to have mitigation measures so that these intermittent failures don't cause unrelated builds to fail until the root cause is addressed.

This is why ci-queue optionally allows to put failed tests back into the queue to retry them on another worker, to ensure the failure is consistent.

Installation and usage

Two implementations are provided, please refer to the respective documentations:

Redis Requirements

ci-queue expects the Redis server to have an eviction policy of allkeys-lru.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/ci-queue.

License

The code is available as open source under the terms of the MIT License.

ci-queue's People

Contributors

byroot avatar chrisbr avatar casperisfine avatar wvanbergen avatar rwstauner avatar zarifmahfuz avatar doodzik avatar nikita8 avatar solackerman avatar sander-m avatar richardnuno avatar dazworrall avatar dylanahsmith avatar dougedey-shopify avatar shioyama avatar jules2689 avatar esnunes avatar serioushaircut avatar gmalette avatar bor1s avatar erikwright avatar stephsachrajda avatar schneems avatar sergray avatar sam-killgallon avatar nachiket87 avatar kim76 avatar imnotjames avatar gregnavis avatar george-ma avatar

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.