aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject incubator-aurora git commit: Updates so client will run in PyCharm.
Date Fri, 16 Jan 2015 22:25:18 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 1346c4f79 -> 056c35b16


Updates so client will run in PyCharm.


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/056c35b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/056c35b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/056c35b1

Branch: refs/heads/master
Commit: 056c35b169874023760edca4fcc222c1ad21d8b1
Parents: 1346c4f
Author: Joshua Cohen <jcohen@twopensource.com>
Authored: Thu Jan 15 11:49:53 2015 -0800
Committer: Bill Farner <wfarner@apache.org>
Committed: Fri Jan 16 14:23:36 2015 -0800

----------------------------------------------------------------------
 docs/developing-aurora-client.md                |  52 +++++++++++++++++++
 docs/images/debug-client-test.png               | Bin 0 -> 314161 bytes
 docs/images/debugging-client-test.png           | Bin 0 -> 308280 bytes
 examples/vagrant/clusters.json                  |   8 +++
 examples/vagrant/provision-dev-cluster.sh       |  11 +---
 .../python/apache/aurora/client/cli/__init__.py |   5 +-
 6 files changed, 65 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/056c35b1/docs/developing-aurora-client.md
----------------------------------------------------------------------
diff --git a/docs/developing-aurora-client.md b/docs/developing-aurora-client.md
index a7253d2..7734bd1 100644
--- a/docs/developing-aurora-client.md
+++ b/docs/developing-aurora-client.md
@@ -35,3 +35,55 @@ If you have changed you would like to test in your local cluster, you'll
rebuild
     vagrant ssh -c 'aurorabuild client'
 
 Once this completes, the `aurora` command will reflect your changes.
+
+Running/Debugging the Client in PyCharm
+=======================================
+
+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'
+
+### Running/Debugging Tests
+
+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:
+
+<a href="images/debug-client-test.png"><img src="images/debug-client-test.png" width="697"
height="444" /></a>
+
+If you've set a breakpoint, you can see the run will now stop and let you debug:
+
+<a href="images/debugging-client-test.png"><img src="images/debugging-client-test.png"
width="697" height="444" /></a>
+
+### Running/Debugging the Client
+
+Actually running and debugging the client is unfortunately a bit more complex. You'll need
to create
+a Run configuration:
+
+* Go to Run → Edit Configurations
+* Click the + icon to add a new configuration.
+* Choose python and name the configuration 'client'.
+* Set the script path to `/your/path/to/aurora/src/main/python/apache/aurora/client/cli/client.py`
+* Set the script parameters to the command you want to run (e.g. `job status <job key>`)
+* Expand the Environment section and click the ellipsis to add a new environment variable
+* Click the + at the bottom to add a new variable named AURORA_CONFIG_ROOT whose value is
the
+  path where the your cluster configuration can be found. For example, to talk to the scheduler
+  running in the vagrant image, it would be set to `/your/path/to/aurora/examples/vagrant`
(this
+  is the directory where our example clusters.json is found).
+* You should now be able to run and debug this configuration!
+
+

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/056c35b1/docs/images/debug-client-test.png
----------------------------------------------------------------------
diff --git a/docs/images/debug-client-test.png b/docs/images/debug-client-test.png
new file mode 100644
index 0000000..8b67a10
Binary files /dev/null and b/docs/images/debug-client-test.png differ

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/056c35b1/docs/images/debugging-client-test.png
----------------------------------------------------------------------
diff --git a/docs/images/debugging-client-test.png b/docs/images/debugging-client-test.png
new file mode 100644
index 0000000..df7b7e3
Binary files /dev/null and b/docs/images/debugging-client-test.png differ

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/056c35b1/examples/vagrant/clusters.json
----------------------------------------------------------------------
diff --git a/examples/vagrant/clusters.json b/examples/vagrant/clusters.json
new file mode 100644
index 0000000..287a618
--- /dev/null
+++ b/examples/vagrant/clusters.json
@@ -0,0 +1,8 @@
+[{
+  "name": "devcluster",
+  "zk": "192.168.33.7",
+  "scheduler_zk_path": "/aurora/scheduler",
+  "auth_mechanism": "UNAUTHENTICATED",
+  "slave_run_directory": "latest",
+  "slave_root": "/var/lib/mesos"
+}]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/056c35b1/examples/vagrant/provision-dev-cluster.sh
----------------------------------------------------------------------
diff --git a/examples/vagrant/provision-dev-cluster.sh b/examples/vagrant/provision-dev-cluster.sh
index 7af4b52..40c1659 100755
--- a/examples/vagrant/provision-dev-cluster.sh
+++ b/examples/vagrant/provision-dev-cluster.sh
@@ -63,16 +63,7 @@ function install_mesos {
 
 function install_cluster_config {
   mkdir -p /etc/aurora
-  cat > /etc/aurora/clusters.json <<EOF
-[{
-  "name": "devcluster",
-  "zk": "192.168.33.7",
-  "scheduler_zk_path": "/aurora/scheduler",
-  "auth_mechanism": "UNAUTHENTICATED",
-  "slave_run_directory": "latest",
-  "slave_root": "/var/lib/mesos"
-}]
-EOF
+  ln -sf /home/vagrant/aurora/examples/vagrant/clusters.json /etc/aurora/clusters.json
 }
 
 function install_ssh_config {

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/056c35b1/src/main/python/apache/aurora/client/cli/__init__.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/__init__.py b/src/main/python/apache/aurora/client/cli/__init__.py
index a595948..2e99677 100644
--- a/src/main/python/apache/aurora/client/cli/__init__.py
+++ b/src/main/python/apache/aurora/client/cli/__init__.py
@@ -55,7 +55,10 @@ EXIT_API_ERROR = 10
 EXIT_UNKNOWN_ERROR = 20
 
 
-__version__ = pkg_resources.resource_string(__name__, '.auroraversion')
+try:
+  __version__ = pkg_resources.resource_string(__name__, '.auroraversion')
+except IOError:
+  __version__ = 'Unknown'
 
 
 class Context(object):


Mime
View raw message