Граф коммитов

9 Коммитов

Автор SHA1 Сообщение Дата
Yoann Schneider cfb19a5ef8
Bug 1823654 - Mostly use double quotes (#7900)
* Enable quote style verifications from Black

* Actually exclude migrations folders
2024-01-31 16:59:20 +01:00
Cameron Dawson 1250108abe
Upgrade pip dev packages (#6742)
* Upgrade pip dev packages
* Fix formatting with black
2020-08-31 11:01:43 -07:00
Armen Zambrano G 9de99b4711 Bug 1395254 - Consume Taskcluster Pulse messages from standard queue exchanges
Currently, Treeherder consumes Pulse messages from an intermediary service called `taskcluster-treeherder`.
Such service needs to be shut down and its functionality imported into Treeherder.

In order to do this we need to switch to the standard Taskcluster exchanges as defined in here:
https://docs.taskcluster.net/docs/reference/platform/queue/exchanges

On a first pass we are only including the code from `taskcluster-treeherder` without changing
much of Treeherder's code. The code is translated from Javascript to Python and only some minor
code changes were done to reduce the difficulty on porting the code without introducing bugs.
Internally, on this first pass, we will still have an intermediary data structure representing
what `taskcluster-treeherder` is emitting, however, we will stop consuming the messages
from it and be able to shut it down.

Instead of consuming from one single exchange we will be consuming multiple ones. Each one representing
a different kind of task (e.g. pending vs running).

In order to test this change you need to open 5 terminal windows and follow these steps:

* On the first window run `docker-compose up`
* On the next three windows `export PULSE_URL="amqp://foo:bar@pulse.mozilla.org:5671/?ssl=1"` and run the following commands:
      * `docker-compose run -e PULSE_URL backend ./manage.py pulse_listener_jobs`
      * `docker-compose run -e PULSE_URL backend ./manage.py pulse_listener_tasks`
      * `docker-compose run -e PULSE_URL backend ./manage.py pulse_listener_pushes`
* On the last window run `docker-compose run backend celery -A treeherder worker -B --concurrency 5`
* Open on your browser `http://localhost:5000`

This is just a summary from [the docs](https://treeherder.readthedocs.io/pulseload.html).

= ETL management commands =
This change also introduces two ETL management command that can be executed like this:

== Ingest push and tasks ==

This script can ingest into Treeherder all tasks associated to a push.
It uses Python's asyncio to speed up the ingestion of tasks.

```bash
./manage.py ingest_push_and_tasks
```

== Update Pulse test fixtures ==

```bash
./manage.py update_pulse_test_fixtures
```

This command will read 100 Taskcluster Pulse messages, process them and store them as test fixtures
under these two files: `tests/sample_data/pulse_consumer/taskcluster_{jobs,metadata}.json`

Following this work would be to get rid of the intermediary job representation ([bug 1560596](https://bugzilla.mozilla.org/show_bug.cgi?id=1560596) which will
clean up some of the code and some of the old tests.

= Extra script =
Script that permits comparing pushes from two different Treeherder instances.

```
usage: Compare a push from a Treeherder instance to the production instance.
       [-h] [--host HOST] --revision REVISION [--project PROJECT]

optional arguments:
  -h, --help           show this help message and exit
  --host HOST          Host to compare. It defaults to localhost
  --revision REVISION  Revision to compare
  --project PROJECT    Project to compare. It defaults to mozilla-central
```

= Other changes =

Other changes included:

* Import `taskcluster-treeherder`'s validation to ensure we're not fed garbage.
* Change `yaml.load(f)` for `yaml.load(f, Loader=yaml.FullLoader)`. Read [this](https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation) for details
* Introduce `taskcluster` and `taskcluster-urls` as dependencies
* The test `test_retry_missing_revision_never_succeeds` makes no sense because
we make Json validation on the Pulse message
2019-07-29 09:42:57 -04:00
Armen Zambrano G 7f04a91af7 Revert "Bug 1395254 - Consume Taskcluster jobs from standard queue exchanges (#5042)"
This reverts commit 75dc375a93.
2019-07-23 16:24:13 -04:00
Armen Zambrano 75dc375a93
Bug 1395254 - Consume Taskcluster jobs from standard queue exchanges (#5042)
* Bug 1395254 - Consume Taskcluster Pulse messages from standard queue exchanges

Currently, Treeherder consumes Pulse messages from an intermediary service called `taskcluster-treeherder`.
Such service needs to be shut down and its functionality imported into Treeherder.

In order to do this we need to switch to the standard Taskcluster exchanges as defined in here:
https://docs.taskcluster.net/docs/reference/platform/queue/exchanges

On a first pass we are only including the code from `taskcluster-treeherder` without changing
much of Treeherder's code. The code is translated from Javascript to Python and only some minor
code changes were done to reduce the difficulty on porting the code without introducing bugs.
Internally, on this first pass, we will still have an intermediary data structure representing
what `taskcluster-treeherder` is emitting, however, we will stop consuming the messages
from it and be able to shut it down.

Instead of consuming from one single exchange we will be consuming multiple ones. Each one representing
a different kind of task (e.g. pending vs running).

In order to test this change you need to open 4 terminal windows and follow these steps:

* On the first two windows `export PULSE_URL="amqp://foo:bar@pulse.mozilla.org:5671/?ssl=1"` and run the following commands:
  * `docker-compose run -e PULSE_URL backend ./manage.py pulse_listener_jobs`
  * `docker-compose run -e PULSE_URL backend ./manage.py pulse_listener_pushes`
* On the third window run `docker-compose run backend celery -A treeherder worker -B --concurrency 5`
* On the last window run `docker-compose up`
* Open on your browser `http://localhost:5000`

This is just a summary from [the docs](https://treeherder.readthedocs.io/pulseload.html).

= ETL management commands =
This change also introduces two ETL management command that can be executed like this:

== Ingest push and tasks ==

This script can ingest into Treeherder all tasks associated to a push.
It uses Python's asyncio to speed up the ingestion of tasks.

```bash
./manage.py ingest_push_and_tasks
```

== Update Pulse test fixtures ==

```bash
./manage.py update_pulse_test_fixtures
```

This command will read 100 Taskcluster Pulse messages, process them and store them as test fixtures
under these two files: `tests/sample_data/pulse_consumer/taskcluster_{jobs,metadata}.json`

Following this work would be to get rid of the intermediary job representation ([bug 1560596](https://bugzilla.mozilla.org/show_bug.cgi?id=1560596) which will
clean up some of the code and some of the old tests.

= Other changes =

Other changes included:

* Import `taskcluster-treeherder`'s validation to ensure we're not fed garbage.
* Change `yaml.load(f)` for `yaml.load(f, Loader=yaml.FullLoader)`. Read [this](https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation) for details
* Introduce `taskcluster` and `taskcluster-urls` as dependencies
* The test `test_retry_missing_revision_never_succeeds` makes no sense because
we make Json validation on the Pulse message
2019-07-23 13:14:18 -04:00
Ed Morley 4102fd4494 Update isort from 4.2.5 to 4.2.14
The new version treats whitespace slightly differently, and also
counts `concurrent.futures` as a stdlib (since it is in Python 3,
even though we have to use the `futures` package). However I'm fine
with not overriding the latter for simplicity and given we'll be
switching to Python 3 at some point in the future.
2017-06-06 19:20:32 +01:00
Cameron Dawson 825913ece4 Bug 1244325 - adjust the pulse job YAML schema to accommodate task cluster needs 2016-02-22 13:39:53 -08:00
Ed Morley 571c57af71 Bug 1192957 - Mass-update python import style using isort
To fix pre-existing deviations from the style that will be enforced on
Travis in the next commit.
2015-10-02 17:55:29 +01:00
Cameron Dawson 35fb130951 Bug 1169320 - Tests against the JobLoader 2015-10-01 15:50:12 -07:00