Auto-tools/Projects/Pulse actions: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(deployment notes)
m (minor)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Description =
Pulse Actions has two python workers listening to pulse messages from Treeherder in order to take actions
for sheriffs (from the TH UI) and based on jobs failing.
In order to disable any of the workers:
* Add --dry-run to the appropiate worker on [https://github.com/mozilla/pulse_actions/blob/master/Procfile Procfile]
* Push the change to the 'heroku' branch (not master)
* The change will be autodeployed
= Info =
= Info =
* Source code: https://github.com/adusca/pulse_actions
* Source code: https://github.com/mozilla/pulse_actions
* Running on: Heroku
* Running on: Heroku
* Logs on:
* Logs on:
Line 8: Line 17:
*** Click on PaperTrail icon
*** Click on PaperTrail icon


= Deployments =
= Reverting a deployment =
git push heroku
* Visit the [https://dashboard.heroku.com/apps/pulse-actions/activity|activity] page.
* Choose the revision you want to roll back to and click "Rollback to here"


= Test locally =
= Test locally =
Line 16: Line 26:
** export PULSE_USER
** export PULSE_USER
** export PULSE_PW
** export PULSE_PW
* Test against treeherder.allizom.org (TODO: add notes to test against local Treeherder)
* We're going to be listening for the pulse stream of the staging version of Treeherder
** Ask someone in #treeherder to make your account be of a sheriff role
** Ask someone in #treeherder to make your account be of a sheriff role (since only sheriffs can trigger actions)
* Start one of the workers which listens to specified pulse exchanges and routing keys
* Start one of the workers which listens to the specified pulse exchanges and routing keys
  # valid topics are the keys in [https://github.com/adusca/pulse_actions/blob/master/pulse_actions/run_time_config.json run_time_config.json]
** valid topics are the keys in [https://github.com/mozilla/pulse_actions/blob/master/pulse_actions/run_time_config.json run_time_config.json]
  python pulse_actions/worker.py --topic-base topic
** the ones ending with "stage" will listen to TH's staging version
** Use '''--dry-run''' to avoid actually scheduling anything
  python pulse_actions/worker.py --topic-base topic-stage --dry-run


= Alerts =
= Alerts =
Line 35: Line 47:
** For contributors, speak with armenzg to add you to the Papertrail add-on
** For contributors, speak with armenzg to add you to the Papertrail add-on
* Pulse:
* Pulse:
 
** Visit pulse guardian and create your credentials


= Credentials =
= Credentials =
Line 57: Line 69:
* Team alias address: auto-tools
* Team alias address: auto-tools
* Brief description:
* Brief description:
** Pulse_actions listens to various [https://github.com/adusca/pulse_actions/blob/master/pulse_actions/run_time_config.json pulse exchanges] and takes various scheduling actions through BuildApi.
** Pulse_actions listens to various [https://github.com/mozilla/pulse_actions/blob/master/pulse_actions/run_time_config.json pulse exchanges] and takes various scheduling actions through BuildApi.
* What to do in case of issues: Send an email to auto-tools and ask someone to stop it until point of contact can look into it.
* What to do in case of issues: Send an email to auto-tools and ask someone to stop it until point of contact can look into it.
* Impact: If you disable pulse_actions:
* Impact: If you disable pulse_actions:
** sheriffs will not be able to backfill jobs (and other actions) from Treeherder
** sheriffs will not be able to backfill jobs (and other actions) from Treeherder
*** Re-opening trees would take longer
*** Re-opening trees would take longer
** We will not have automated backfilling
** developers/sheriffs would not be able to add missing jobs to pushes
*** Re-opening trees would take longer
 
= Taskcluster scopes =
In the future, we will be using TaskCluster to schedule tasks.
 
These are the scopes which I have needed in the past:
* queue:create-task:*
* queue:define-task:*
* queue:route:*
* scheduler:create-task-graph
* scheduler:extend-task-graph
 
Scopes needed because of tasks already defined in-tree:
* docker-worker:cache:*
* docker-worker:capability:*
* docker-worker:image:*

Latest revision as of 20:19, 7 March 2016

Description

Pulse Actions has two python workers listening to pulse messages from Treeherder in order to take actions for sheriffs (from the TH UI) and based on jobs failing.

In order to disable any of the workers:

  • Add --dry-run to the appropiate worker on Procfile
  • Push the change to the 'heroku' branch (not master)
  • The change will be autodeployed

Info

Reverting a deployment

  • Visit the [1] page.
  • Choose the revision you want to roll back to and click "Rollback to here"

Test locally

  • Setup your Pulse credentials
    • If you don't have a pulse client visit [2] and create a user
    • export PULSE_USER
    • export PULSE_PW
  • We're going to be listening for the pulse stream of the staging version of Treeherder
    • Ask someone in #treeherder to make your account be of a sheriff role (since only sheriffs can trigger actions)
  • Start one of the workers which listens to the specified pulse exchanges and routing keys
    • valid topics are the keys in run_time_config.json
    • the ones ending with "stage" will listen to TH's staging version
    • Use --dry-run to avoid actually scheduling anything
python pulse_actions/worker.py --topic-base topic-stage --dry-run

Alerts

Accounts

  • Papertrail:
    • For employees, you can request a corp account to all Papertrail apps
    • For contributors, speak with armenzg to add you to the Papertrail add-on
  • Pulse:
    • Visit pulse guardian and create your credentials

Credentials

For pulse_actions to work we need set these environment variables:

  • Buildapi - LDAP credentials (LDAP_PW/LDAP_USER)
  • TaskCluster - TaskCluster client credentials (TASKCLUSTER_CLIENT_ID/TASKCLUSTER_ACCESS_TOKEN)
  • Pulse - Pulse user credentials (PULSE_PW/PULSE_USER)
  • Papertrail - API Token (PAPERTRAIL_API_TOKEN)

To run locally you will need to set all up as env variables. You won't need to add the Papertail token.

Workflow

Pulse actions.png

This workflow was created with Gliffy: http://www.gliffy.com/go/publish/8686299

Support

In case the service is causing issues:

  • Point of contact: armenzg
  • Team alias address: auto-tools
  • Brief description:
    • Pulse_actions listens to various pulse exchanges and takes various scheduling actions through BuildApi.
  • What to do in case of issues: Send an email to auto-tools and ask someone to stop it until point of contact can look into it.
  • Impact: If you disable pulse_actions:
    • sheriffs will not be able to backfill jobs (and other actions) from Treeherder
      • Re-opening trees would take longer
    • developers/sheriffs would not be able to add missing jobs to pushes

Taskcluster scopes

In the future, we will be using TaskCluster to schedule tasks.

These are the scopes which I have needed in the past:

  • queue:create-task:*
  • queue:define-task:*
  • queue:route:*
  • scheduler:create-task-graph
  • scheduler:extend-task-graph

Scopes needed because of tasks already defined in-tree:

  • docker-worker:cache:*
  • docker-worker:capability:*
  • docker-worker:image:*