The client is written in Python, and uses the Pants build tool.
The client uses a configuration file that specifies available clusters. More information about the contents of this file can be found in the Client Cluster Configuration documentation. Information about how the client locates this file can be found in the Client Commands documentation.
Building and testing the client code are both done using Pants. The relevant targets to know about are:
./pants binary src/main/python/apache/aurora/client/cli:aurora
./pants test src/test/python/apache/aurora/client/cli:all
For manually testing client changes against a cluster, we use Vagrant.
To start a virtual cluster, you need to install Vagrant, and then run vagrant up
for the root of
the aurora workspace. This will create a vagrant host named “devcluster”, with a mesos master, a set
of mesos slaves, and an aurora scheduler.
If you have changed you would like to test in your local cluster, you’ll rebuild the client:
vagrant ssh -c 'aurorabuild client'
Once this completes, the aurora
command will reflect your changes.
It’s possible to use PyCharm to run and debug both the client and client tests in an IDE. In order to do this, first run:
build-support/python/make-pycharm-virtualenv
This script will configure a virtualenv with all of our Python requirements. Once the script completes it will emit instructions for configuring PyCharm:
Your PyCharm environment is now set up. You can open the project root
directory with PyCharm.
Once the project is loaded:
- open project settings
- click 'Project Interpreter'
- click the cog in the upper-right corner
- click 'Add Local'
- select 'build-support/python/pycharm.venv/bin/python'
- click 'OK'
After following these instructions, you should now be able to run/debug tests directly from the IDE by right-clicking on a test (or test class) and choosing to run or debug:
If you’ve set a breakpoint, you can see the run will now stop and let you debug:
Actually running and debugging the client is unfortunately a bit more complex. You’ll need to create a Run configuration:
/your/path/to/aurora/src/main/python/apache/aurora/client/cli/client.py
job status <job key>
)/your/path/to/aurora/examples/vagrant
(this
is the directory where our example clusters.json is found).