<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>No Huddle Offense</title>
	<atom:link href="http://www.nohuddleoffense.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nohuddleoffense.de</link>
	<description>&#34;Individual commitment to a group effort-that is what makes a team work, a company work, a society work, a civilization work.&#34;</description>
	<lastBuildDate>Tue, 08 May 2012 10:47:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Python DTrace consumer and AMQP</title>
		<link>http://www.nohuddleoffense.de/2012/04/01/python-dtrace-consumer-and-amqp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=python-dtrace-consumer-and-amqp</link>
		<comments>http://www.nohuddleoffense.de/2012/04/01/python-dtrace-consumer-and-amqp/#comments</comments>
		<pubDate>Sun, 01 Apr 2012 11:44:18 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Analytics]]></category>
		<category><![CDATA[DTrace]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=975</guid>
		<description><![CDATA[This blog post will lead through an very simple example to show how you can use the Python DTrace consumer and AMQP. The scenario for this example is pretty simple &#8211; let&#8217;s say you want to trace data on one machine and display it on another. Still the data should be up to date &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>This blog post will lead through an very <a href="https://github.com/tmetsch/python-dtrace/tree/master/examples/amqp">simple example</a> to show how you can use the <a href="https://github.com/tmetsch/python-dtrace">Python DTrace consumer</a> and <a href="http://www.amqp.org/">AMQP</a>.</p>
<p>The scenario for this example is pretty simple &#8211; let&#8217;s say you want to trace data on one machine and display it on another. Still the data should be up to date &#8211; so basically whenever a DTrace probe fires the data should be transmitted to the other hosts. This can be done with AMQP.</p>
<p>The examples here assume you have a <a href="http://www.rabbitmq.com">RabbitMQ</a> server running and have <a href="https://github.com/pika/pika">pika</a> installed.</p>
<p>Within this example two Python scripts are involved. One for sending data (<em>send.py</em>) and one for receiving (<em>receive.py</em>). The send.py script will launch the DTrace consumer and gather data for 5 seconds:</p>
<pre class="brush: python; title: ; notranslate">
thr = dtrace.DTraceConsumerThread(SCRIPT, walk_func=walk)
thr.start()
time.sleep(5)
thr.stop()
thr.join()
</pre>
<p>The DTrace consumer is given an callback function which will be called whenever the DTrace probes fire. Within this callback we are going to create a message ad pass it on to the AMQP broker:</p>
<pre class="brush: python; title: ; notranslate">
def walk(id, key, value):
    channel.basic_publish(exchange='', routing_key='dtrace', body=str({key[0]: value}))
</pre>
<p>The channel has previously been initialized (See <a href="http://www.rabbitmq.com/tutorials/tutorial-one-python.html">this</a> tutorial on more details). Now AMQP messages are passed around with up-to-date information from DTrace. All that there is left is implementing a &#8216;receiver&#8217; in <em>receive.py</em>. This is again straight forward and also works using a callback function:</p>
<pre class="brush: python; title: ; notranslate">
def callback(ch, method, properties, body):
    print 'Received: ', data

if __name__ == '__main__':
    channel.basic_consume(callback, queue='dtrace', no_ack=True)
    try:
        channel.start_consuming()
    except KeyboardInterrupt:
        connection.close()
</pre>
<p>Start the <em>receive.py</em> Python script first. Than start the <em>send.py</em> Python script. You can even start multiple <em>send.py</em> scripts on multiple hosts to get an overall view of the system calls made by processes on all machines <img src='http://www.nohuddleoffense.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The <em>send.py</em> script counts system calls and will send AMQP messages as new data arrives. You will see in the output of the <em>receive.py</em> script that data arrives almost instantly:</p>
<pre class="brush: bash; title: ; notranslate">
$ ./receive.py
Received:  python 264
Received:  wnck-applet 5
Received:  metacity 6
Received:  gnome-panel 15
[...]
</pre>
<p>Now you can build life updating visualizations of the data gathered by DTrace.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2012/04/01/python-dtrace-consumer-and-amqp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python DTrace consumer meets the web</title>
		<link>http://www.nohuddleoffense.de/2012/03/29/python-dtrace-consumer-meets-the-web/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=python-dtrace-consumer-meets-the-web</link>
		<comments>http://www.nohuddleoffense.de/2012/03/29/python-dtrace-consumer-meets-the-web/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 16:56:00 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Analytics]]></category>
		<category><![CDATA[DTrace]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SmartOS]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=951</guid>
		<description><![CDATA[I had look at my Python DTrace consumer yesterday night and realized it need a bit an overhaul. I already demoed that you can make some visualization with it &#8211; like life updating callgraphs etc. Still it missed some basic functionality. For example I did only support some DTrace aggregation actions like sum, min, max [...]]]></description>
			<content:encoded><![CDATA[<p>I had look at my <a href="http://tmetsch.github.com/python-dtrace/">Python DTrace consumer</a> yesterday night and realized it need a bit an overhaul. I already demoed that you can make some visualization with it &#8211; like <a href="http://www.nohuddleoffense.de/2011/10/20/forget-static-callgraphs-use-dtrace/" title="Forget static callgraphs – Use Python &#038; DTrace!">life updating callgraphs</a> etc. Still it missed some basic functionality. For example I did only support some DTrace aggregation actions like <em>sum</em>, <em>min</em>, <em>max</em> and <em>count</em>. Now I added support for <em>avg</em>, <em>quantize</em> and <em>lquantize</em>.</p>
<p>Now I just needed to write about 50 LOC to do something nice <img src='http://www.nohuddleoffense.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Those ~50 lines are the implementation of an <a href="http://www.wsgi.org/en/latest/index.html">WSGI</a> app using <a href="http://www.makotemplates.org/">Mako</a> as a template engine. Embedded in the Mako templates are <a href="http://code.google.com/p/google-chartwrapper/">Google Charts</a>. And those charts actually show information coming out of the Python consumer. Now all what is left, is to point my browser to my <a href="http://www.smartos.org">SmartOS</a> machine and get up-to-date graphs! For example a piechart which shows system calls by process:</p>
<div id="attachment_956" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nohuddleoffense.de/wp-content/uploads/2012/03/screen1.png"><img src="http://www.nohuddleoffense.de/wp-content/uploads/2012/03/screen1-300x200.png" alt="Python DTrace consumer" title="screen1" width="300" height="200" class="size-medium wp-image-956" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>Or using <em>quantize</em> I can browse a nice read size distribution &#8211; aka: how much bytes do my processes usual read?:</p>
<div id="attachment_955" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nohuddleoffense.de/wp-content/uploads/2012/03/screen2.png"><img src="http://www.nohuddleoffense.de/wp-content/uploads/2012/03/screen2-300x200.png" alt="Python based DTrace consumer" title="screen2" width="300" height="200" class="size-medium wp-image-955" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>With all this it is also possible to plot graphs on the latency of <a href="http://www.nodejs.org">node.js</a> apps <img src='http://www.nohuddleoffense.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> :</p>
<div id="attachment_973" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nohuddleoffense.de/wp-content/uploads/2012/03/screen3.png"><img src="http://www.nohuddleoffense.de/wp-content/uploads/2012/03/screen3-300x200.png" alt="" title="screen3" width="300" height="200" class="size-medium wp-image-973" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>Again documentation on writing DTrace consumers is almost non-existent. But with some &#8216;inspiration&#8217; from <a href="https://github.com/bcantrill/node-libdtrace">Bryan Cantrill</a> and the <a href="http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libdtrace/common/dt_consume.c">original C based consumer</a> I was able to get it work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2012/03/29/python-dtrace-consumer-meets-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python DTrace consumer on SmartOS</title>
		<link>http://www.nohuddleoffense.de/2012/03/23/python-dtrace-consumer-on-smartos/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=python-dtrace-consumer-on-smartos</link>
		<comments>http://www.nohuddleoffense.de/2012/03/23/python-dtrace-consumer-on-smartos/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 19:31:56 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[DTrace]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SmartOS]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=937</guid>
		<description><![CDATA[As mentioned in previous blog posts (1 2 3) I wrote a Python DTrace consumer a while ago. The cool thing is that you can now trace Python (as provider) and consumer the &#8216;aggregate&#8217; in Python (as consumer) as well . Some screen-shots and suggestions what you can do with it are described on the [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned in previous blog posts (<a title="Python as a DTrace consumer using libdtrace" href="http://www.nohuddleoffense.de/2011/10/07/python-as-a-dtrace-consumer-using-libdtrace/">1</a> <a title="Python as a DTrace consumer – Part 2 walk the aggregate" href="http://www.nohuddleoffense.de/2011/10/08/python-as-a-dtrace-consumer-part-2-walk-the-aggregate/">2</a> <a title="Forget static callgraphs – Use Python &amp; DTrace!" href="http://www.nohuddleoffense.de/2011/10/20/forget-static-callgraphs-use-dtrace/">3</a>) I wrote a <a href="http://www.python.org">Python</a> <a href="http://www.dtrace.org">DTrace</a> consumer a while ago. The cool thing is that you can now trace Python (as provider) and consumer the &#8216;aggregate&#8217; in Python (as consumer) as well <img src='http://www.nohuddleoffense.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . Some screen-shots and suggestions what you can do with it are described on the <a href="http://tmetsch.github.com/python-dtrace/">github page</a>.</p>
<p>I did not have much spare time lately but I got the a chance last night to test my Python based DTrace consumer on <a href="http://www.smartos.org">SmartOS</a>, <a href="http://www.oracle.com/solaris">Solaris 11</a> and <a href="http://www.openindiana.org">OpenIndiana</a> &#8211; and can confirm that it runs on all 3.</p>
<p>To get it up and running on SmartOS you will first need to install some dependencies. Use the 3rd party repositories as described in the <a href="http://wiki.smartos.org/display/DOC/3rd+Party+Software+Repos">SmartOS wiki</a> to get <em>pkg</em> up and running:</p>
<pre class="brush: bash; title: ; notranslate">
pkg install git gcc-44 setuptools-26 gnu-binutils
</pre>
<p>When that is done we will clone the consumer code and install <a href="http://cython.org/">cython</a> (you could however also use <a href="http://docs.python.org/library/ctypes.html">ctypes</a>) using <a href="http://www.pip-installer.org">pip</a>:</p>
<pre class="brush: bash; title: ; notranslate">
easy_install pip
pip install cython
git clone git://github.com/tmetsch/python-dtrace.git
cd python-dtrace/
python setup.py install
</pre>
<p>Now since this is done we can do the obligatory <strong>&#8216;Hello World&#8217;</strong> to get things going:</p>
<div id="attachment_944" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nohuddleoffense.de/wp-content/uploads/2012/03/Screenshot-08-00-27-4b-67-bc-.png"><img class="size-medium wp-image-944 " title="Screenshot-08-00-27-4b-67-bc" src="http://www.nohuddleoffense.de/wp-content/uploads/2012/03/Screenshot-08-00-27-4b-67-bc--300x140.png" alt="" width="300" height="140" /></a><p class="wp-caption-text">Python DTrace consumer on SmartOS (Click to enlarge)</p></div>
<p>For more examples refer to the examples folder within the python-dtrace repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2012/03/23/python-dtrace-consumer-on-smartos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SmartStack = SmartOS + OpenStack (Part 3)</title>
		<link>http://www.nohuddleoffense.de/2012/02/28/smartstack-smartos-openstack-part-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=smartstack-smartos-openstack-part-3</link>
		<comments>http://www.nohuddleoffense.de/2012/02/28/smartstack-smartos-openstack-part-3/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 21:28:55 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[SmartOS]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=924</guid>
		<description><![CDATA[This is the third part os the blog post series. Previous parts can be found here: 1 2 To ensure the proper startup of nova-compute we will register it using SMF &#8211; this will also increase the dependability of the services. To start we will define a properties file for nova-compute &#8211; we will be [...]]]></description>
			<content:encoded><![CDATA[<p>This is the third part os the blog post series. Previous parts can be found here: <a href="http://www.nohuddleoffense.de/2012/02/12/smartstack-smartos-openstack-part-1/" title="SmartStack = SmartOS + OpenStack (Part 1)">1</a> <a href="http://www.nohuddleoffense.de/2012/02/15/smartstack-smartos-openstack-part-2/" title="SmartStack = SmartOS + OpenStack (Part 2)">2</a></p>
<p>To ensure the proper startup of <em>nova-compute</em> we will register it using SMF &#8211; this will also increase the dependability of the services. To start we will define a properties file for nova-compute &#8211; we will be using a glance and rabbitMQ host which run on a different host:</p>
<pre class="brush: bash; title: ; notranslate">
--connection_type=fake
--glance_api_servers=192.168.56.101:9292
--rabbit_host=192.168.56.101
--rabbit_password=foobar
--sql_connection=mysql://root:foobar@192.168.56.101/nova
</pre>
<p>We will store this contents in the file <em>/data/workspace/smartos.cfg</em>. We will also create an XML file with the manifest definition &#8211; it has some dependencies defined:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version='1.0'?&gt;
&lt;!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'&gt;
&lt;service_bundle type='manifest' name='openstack'&gt;
  &lt;service name='openstack/nova/compute' type='service' version='0'&gt;
    &lt;create_default_instance enabled='true'/&gt;
    &lt;single_instance/&gt;
    &lt;dependency name='fs' grouping='require_all' restart_on='none' type='service'&gt;
      &lt;service_fmri value='svc:/system/filesystem/local'/&gt;
    &lt;/dependency&gt;
    &lt;dependency name='net' grouping='require_all' restart_on='none' type='service'&gt;
      &lt;service_fmri value='svc:/network/physical:default'/&gt;
    &lt;/dependency&gt;
    &lt;dependency name='zones' grouping='require_all' restart_on='none' type='service'&gt;
      &lt;service_fmri value='svc:/system/zones:default'/&gt;
    &lt;/dependency&gt;
    &lt;exec_method name='start' type='method' exec='/usr/bin/nohup /data/workspace/nova/bin/nova-compute --flagfile=/data/workspace/smartos.cfg &amp;amp;' timeout_seconds='60'&gt;
      &lt;method_context&gt;
        &lt;method_environment&gt;
          &lt;envvar name=&quot;PATH&quot; value=&quot;/ec/bin/:$PATH&quot;/&gt;
        &lt;/method_environment&gt;
      &lt;/method_context&gt;
    &lt;/exec_method&gt;
    &lt;exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'&gt;
      &lt;method_context/&gt;
    &lt;/exec_method&gt;
   &lt;stability value='Unstable' /&gt;
  &lt;/service&gt;
&lt;/service_bundle&gt;
</pre>
<p>This can be imported using the <em>svccfg</em> command. After doing so we can use al the known commands to verify all is up and running:</p>
<pre class="brush: bash; title: ; notranslate">
[root@08-00-27-e3-a9-19 /data/workspace]# svcs -p openstack/nova/compute
STATE          STIME    FMRI
online         14:04:52 svc:/openstack/nova/compute:default
               14:04:51     3142 python
</pre>
<p>Now up to integrate vmadm&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2012/02/28/smartstack-smartos-openstack-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SmartStack = SmartOS + OpenStack (Part 2)</title>
		<link>http://www.nohuddleoffense.de/2012/02/15/smartstack-smartos-openstack-part-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=smartstack-smartos-openstack-part-2</link>
		<comments>http://www.nohuddleoffense.de/2012/02/15/smartstack-smartos-openstack-part-2/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 10:40:48 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[SmartOS]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=903</guid>
		<description><![CDATA[This is the second post in this series. Part 1 can be found here. After setting up nova on SmartOS you should be able to launch the nova-compute service &#8211; Andy actually managed to get the nova-compute instance up and running: Note that for now we will use a fake RabbitMQ connection. The connection to [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second post in this series. Part 1 can be found <a href="http://www.nohuddleoffense.de/2012/02/12/smartstack-smartos-openstack-part-1/" title="SmartStack = SmartOS + OpenStack (Part 1)">here</a>.</p>
<p>After setting up nova on SmartOS you should be able to launch the <em>nova-compute</em> service &#8211; <a href="http://andy.edmonds.be">Andy</a> actually managed to get the nova-compute instance up and running:</p>
<pre class="brush: bash; title: ; notranslate">
./bin/nova-compute --connection_type=fake --sql_connection=mysql://root:admin@192.168.0.189/nova --fake_rabbit
2012-02-15 10:26:32,205 WARNING nova.virt.libvirt.firewall [-] Libvirt module could not be loaded. NWFilterFirewall will not work correctly.
2012-02-15 10:26:32,374 AUDIT nova.service [-] Starting compute node (version 2012.1-LOCALBRANCH:LOCALREVISION)
2012-02-15 10:26:33,099 INFO nova.rpc [-] Connected to AMQP server on localhost:5672
</pre>
<p>Note that for now we will use a fake RabbitMQ connection. The connection to the MySQL server however is mandatory.</p>
<p>This is the first step in plan to get OpenStack running on SmartOS. Next step will be to look into integration vmadm as a driver in OpenStack. The overall Ideas we have can be found in this <a href="https://docs.google.com/presentation/d/1N2x1itaMc9h7q-6520vuFmmjT0MXrIt1MdfAoGnENDI/edit">slideset</a> on google docs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2012/02/15/smartstack-smartos-openstack-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SmartStack = SmartOS + OpenStack (Part 1)</title>
		<link>http://www.nohuddleoffense.de/2012/02/12/smartstack-smartos-openstack-part-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=smartstack-smartos-openstack-part-1</link>
		<comments>http://www.nohuddleoffense.de/2012/02/12/smartstack-smartos-openstack-part-1/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 15:09:18 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[SmartOS]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=872</guid>
		<description><![CDATA[[Update] &#8211; The first shot didn&#8217;t work &#8211; so I updated this post! This is the first post of hopefully a series of post about getting OpenStack up and running on SmartOS. There is a blueprint for this effort. For this first post we will focus on setting up SmartOS and try to get some [...]]]></description>
			<content:encoded><![CDATA[<p>[<strong>Update</strong>] &#8211; The first shot didn&#8217;t work &#8211; so I updated this post!</p>
<p>This is the first post of hopefully a series of post about getting <a href="http://www.openstack.org">OpenStack</a> up and running on <a href="http://www.smartos.org">SmartOS</a>. There is a <a href="https://blueprints.launchpad.net/nova/+spec/smartos-support">blueprint</a> for this effort. For this first post we will focus on setting up SmartOS and try to get some needed packages up and running.</p>
<p>I used the the following SmartOS iso image which will you &#8211; when booted &#8211; guide you through a small setup routine: <a href="https://download.joyent.com/pub/iso/smartos-20120210T043623Z.iso">smartos-20120210T043623Z.iso</a>. After this you need to configure the pkg repositories as described in this <a href="http://wiki.smartos.org/display/DOC/3rd+Party+Software+Repos">tutorial</a>. I encourage you all to have two discs attached &#8211; One for the zones &#8211; and one for the data. So since the setup routine created the <em>zones</em> pool I will first create a <em>data</em> pool on the second disc:</p>
<pre class="brush: bash; title: ; notranslate">
zpool create data c0t2d0
zfs create data/ec
zfs set mountpoint=/ec data/ec
zfs mount data/ec
cd / &amp;&amp; wget -O- -q http://svn.everycity.co.uk/public/solaris/misc/ \
                    pkg5-smartos-bootstrap-20111221.tar.gz | gtar -zxf-
</pre>
<p>One major dependency is python, gcc and some tools and libs &#8211; and we will also need <a href="http://git-scm.com/">git</a> so we can get the source code of nova later on:</p>
<pre class="brush: bash; title: ; notranslate">
/ec/bin/pkg install pkg:/database/mysql-55/client@5.5.16-0.162 \
                    pkg:/library/python/mysqldb@1.2.3-0.162
/ec/bin/pkg install python26 git setuptools-26 gcc-44 libxslt gnu-binutils
</pre>
<p>Next step will be to create a <em>workspace</em> file-system using ZFS (Optional) &#8211; this will allow me to do rollbacks later on during the porting of OpenStack:</p>
<pre class="brush: bash; title: ; notranslate">
zfs create data/workspace
cd /data/workspace/
</pre>
<p>Let&#8217;s clone nova and install pip:</p>
<pre class="brush: bash; title: ; notranslate">
export PATH=/ec/bin:$PATH
easy_install pip
git clone git://github.com/tmetsch/nova.git
cd nova/tools
export CFLAGS=&quot;-D_XPG6 -std=c99&quot;
pip install -r pip-requires
</pre>
<p>Now let&#8217;s see if we can get the test up and running:</p>
<pre class="brush: bash; title: ; notranslate">
cd ..
./run_tests.sh
</pre>
<p>This will do for the first steps &#8211; I&#8217;ll be going to get the dependencies of nova up and running next &#8211; Will than post the next blog post.</p>
<p><strong>Percent done</strong>: 1%</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2012/02/12/smartstack-smartos-openstack-part-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Coffee instead of snakes &#8211; Openshift fun (2)</title>
		<link>http://www.nohuddleoffense.de/2012/02/08/coffee-instead-of-snakes-openshift-fun-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=coffee-instead-of-snakes-openshift-fun-2</link>
		<comments>http://www.nohuddleoffense.de/2012/02/08/coffee-instead-of-snakes-openshift-fun-2/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 00:24:14 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=861</guid>
		<description><![CDATA[In my last post I demoed how OpenShift can be used to deploy WSGI based Python application. But since OpenShift also supports other languages including Java I wanted to give it a shot. So I developed a very minimalistic application which emulates a RESTful interface. Of course it takes the simplistic &#8211; all time favorite [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post I <a href="http://www.nohuddleoffense.de/2012/02/03/fun-with-openshift/" title="Fun with OpenShift">demoed</a> how <a href="http://openshift.redhat.com">OpenShift</a> can be used to deploy <a href="http://www.wsgi.org">WSGI</a> based <a href="http://www.python.org">Python</a> application. But since OpenShift also supports other languages including Java I wanted to give it a shot.</p>
<p>So I developed a very minimalistic application which emulates a RESTful interface. Of course it takes the simplistic &#8211; all time favorite &#8211; Hello World approach for this. Client can create <em>resources</em>, which when queried will return the obligatory &#8216;Hello &lt;resource name&gt;&#8217;.</p>
<p>To start create a new java application in your OpenShift dashboard. When cloning the git repository &#8211; which was created &#8211; you will notice that you basically get a <em>maven </em>project with some templates in it. Now you can simple use maven to test and develop your application. When done do a <em>git push</em> and your application is ready to go.</p>
<p>The implementation is pretty straight forward:</p>
<pre class="brush: java; title: ; notranslate">
/**
 * Simple REST Hello World Service.
 *
 * @author tmetsch
 *
 */
public class HelloServlet extends HttpServlet {
    [...]
    @Override
    protected final void doGet(final HttpServletRequest req,
            final HttpServletResponse resp) throws ServletException,
            IOException {
            [...]
    }
    [...]
</pre>
<p>So beside from extending the <em>HttpServlet </em>class all you need to do is implement the <em>doGet </em>and <em>doPost </em>methods. When done edit the &#8216;web.xml&#8217; file in the folder <em>src/main/webapp</em>:</p>
<pre class="brush: xml; title: ; notranslate">
[...]
&lt;servlet&gt;
    &lt;servlet-name&gt;HelloWorld&lt;/servlet-name&gt;
    &lt;servlet-class&gt;the.ultimate.test.pkg.HelloServlet&lt;/servlet-class&gt;
&lt;/servlet&gt;
&lt;servlet-mapping&gt;
    &lt;servlet-name&gt;HelloWorld&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/users/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
[...]
</pre>
<p>This will make sure you the application can be found under the right route. If you like you can also add an <em>index.html</em> file in the same folder so people can read a brief introduction when visting the top layer of you application. In my case that would be <a href="http://testus-sample.rhcloud.com">http://testus-sample.rhcloud.com</a> &#8211; The application itself can be found under: <a href="http://testus-sample.rhcloud.com/users/">http://testus-sample.rhcloud.com/users/</a>.</p>
<p>So I like the approach OpenShift takes here with maven. You can simply add you dependencies like jmock, junit etc. and during deployment it is taken care of that everything falls in place. Also if you write Unittest it&#8217;ll also ensure that you&#8217;re application will work &#8211; Non functional apps will not be deployed obviously if you write a Unittest and use maven. It&#8217;s pretty easy to write Unittest for the <em>HttpServlet</em> class if you use a mocking framework like <a href="http://jmock.org/">jmock</a>. You can get the source code at <a href="https://github.com/tmetsch/java-openshift">github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2012/02/08/coffee-instead-of-snakes-openshift-fun-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with OpenShift</title>
		<link>http://www.nohuddleoffense.de/2012/02/03/fun-with-openshift/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fun-with-openshift</link>
		<comments>http://www.nohuddleoffense.de/2012/02/03/fun-with-openshift/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 19:57:04 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[OCCI]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=844</guid>
		<description><![CDATA[I&#8217;ve been playing around with OpenShift for the past hour. More specifically OpenShift Express which allows you to quickly develop apps Java, Ruby, PHP, Perl and Python and run them in the &#8216;Cloud&#8217;. As a first exercise I wanted to check that I was able to get a simple Task board up and running. A [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with <a href="https://openshift.redhat.com/">OpenShift</a> for the past hour. More specifically OpenShift Express which allows you to quickly develop apps Java, Ruby, PHP, Perl and Python and run them in the &#8216;Cloud&#8217;.</p>
<p>As a first exercise I wanted to check that I was able to get a simple Task board up and running. A good tutorial to create such a simple application with <a href="http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/index.html">Pyramid</a> can be found <a href="http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/single_file_tasks/single_file_tasks.html">here</a>.</p>
<p>After signing into OpenShift you can create a new application in the dashboard. Make sure that before doing so you have your <em>namespace</em> setup and your <em>public ssh</em> key configured in OpenShift. After creating the application a <a href="http://git-scm.com/">git</a> repository is created for you. Simple clone this so you have a local working copy on your machine.</p>
<p>Now have a look inside you local working copy. You will find the directories <em>data</em>, <em>libs</em>, <em>wsgi</em> and some files like a <em>README</em> and the python setuptools related <em>setup.py</em>. Let&#8217;s start with editing the <em>setup.py</em> file:</p>
<pre class="brush: python; title: ; notranslate">
from setuptools import setup

setup(name='A simple TODO Application to test OpenShift Features.',
      version='1.0',
      description='An OpenShift App',
      author='Thijs Metsch',
      author_email='thijs.metsch@opensolaris.org',
      install_requires=['pyramid'],
      classifiers=[
                     'Operating System :: OS Independent',
                     'Programming Language :: Python',
                    ],
     )
</pre>
<p>Please note the install_required parameter. Using this parameter will ensure that during deployment of you app the necessary requirements get installed &#8211; in this case Pyramid.</p>
<p>The following steps are pretty straight forward. The file application in the <em>wsgi</em> directory is as the name states a simple <a href="http://www.wsgi.org">WSGI</a> app. What we need to do is edit this file and let it call the todo app:</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/python

import os

virtenv = os.environ['APPDIR'] + '/virtenv/'
os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib/python2.6/site-packages')
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
    execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
    pass

from todo import application
</pre>
<p>Please note that the file has no &#8216;.py&#8217; extension. </p>
<p>Now we are ready to create the finally application. Please have a look at this <a href="http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/single_file_tasks/single_file_tasks.html">tutorial</a> as the code will almost be identical.</p>
<p>Create a file todo.py and follow the tutorial as described. Make sure you application runs locally. Put the &#8216;*.mako&#8217; files in the subdirectory <em>static </em>under the <em>wsgi </em>directory. You can place the schema.sql file in the data directory. We will be using a sqlite database which will also be place in there.</p>
<p>The final step is to alter the <em>todo.py</em> file and remove the <em>__main__</em> part. Instead we will introduce the following application function:</p>
<pre class="brush: python; title: ; notranslate">
here = os.environ['OPENSHIFT_APP_DIR']

def application(environ, start_response):
    '''
    A WSGI application.

    Configure pyramid, add routes and finally serve the app.

    environ -- the environment.
    start_response -- the response object.
    '''
    settings = {}
    settings['reload_all'] = True
    settings['debug_all'] = True
    settings['mako.directories'] = os.path.join(here, 'static')
    settings['db'] = os.path.join(here, '..', 'data', 'tasks.db')

    session_factory = UnencryptedCookieSessionFactoryConfig('itsaseekreet')

    config = Configurator(settings=settings, session_factory=session_factory)

    config.add_route('list', '/')
    config.add_route('new', '/new')
    config.add_route('close', '/close/{id}')

    config.add_static_view('static', os.path.join(here, 'static'))

    config.scan()

    return config.make_wsgi_app()(environ, start_response)
</pre>
<p>When done we can push the code to the repository. When done you can visit you application at the given URL.</p>
<p>With this I&#8217;ve been able to create the app <a href="http://todo-sample.rhcloud.com/">http://todo-sample.rhcloud.com/</a> and I also deployed my <a href="http://www.occi-wg.org">OCCI</a> example service: <a href="http://occi-sample.rhcloud.com/">http://occi-sample.rhcloud.com/</a>. As you can see pretty straight forward &#038; fast and of course fun!</p>
<p>What would be fun is to create a simple unittesting framework for OpenShift. For now you can find the code pieces at <a href="https://github.com/tmetsch/openshift-todo">github</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2012/02/03/fun-with-openshift/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Forget static callgraphs &#8211; Use Python &amp; DTrace!</title>
		<link>http://www.nohuddleoffense.de/2011/10/20/forget-static-callgraphs-use-dtrace/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=forget-static-callgraphs-use-dtrace</link>
		<comments>http://www.nohuddleoffense.de/2011/10/20/forget-static-callgraphs-use-dtrace/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 09:11:00 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[DTrace]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=826</guid>
		<description><![CDATA[Forget about static analyzed callgrahs! No more running the code closing it and then looking at the callgraph. With DTrace you can attach yourself to any (running) process on the (running/production) system and get life up to date information about what the programm is doing. No need to restart the application or anything. This works [...]]]></description>
			<content:encoded><![CDATA[<p>Forget about static analyzed callgrahs! No more running the code closing it and then looking at the callgraph. With <a href="http://www.dtrace.org">DTrace</a> you can attach yourself to any (running) process on the (running/production) system and get life up to date information about what the programm is doing. No need to restart the application or anything. This works for most programming languages which have DTrace providers (like C, Java and Python <img src='http://www.nohuddleoffense.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ). All you need to know is the pid.</p>
<p>Based on the information you get from DTrace (using the <a href="http://www.nohuddleoffense.de/2011/10/07/python-as-a-dtrace-consumer-using-libdtrace/" title="Python as a DTrace consumer using libdtrace">Python consumer</a>) you can draw life updating callgraphs of what is currently happening in the program. Not only is it possible to look at the callgraph but you can also look at the time it took to reach a certain piece of code to analyze bottle necks and the flow of the program:</p>
<pre class="brush: bash; title: ; notranslate">
$ pgrep python # get the pid of the process you want to trace
123456
$ ./callgraph.py 123456 # trace the program and create a callgraph
</pre>
<p>So if you would have the following Python code:</p>
<pre class="brush: python; title: ; notranslate">
class A(object):

    def sayHello(self):
        return 'I am A'

class B(object):

    def __init__(self):
        self.a = A()

    def sayHello(self):
        return self.a.sayHello()

if __name__ == '__main__':
    print B().sayHello()
</pre>
<p>You would get the following life generated callgraph &#8211; the GUI can start, stop and restart tracing and get live updates as the DTrace probes fires:</p>
<div id="attachment_840" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nohuddleoffense.de/wp-content/uploads/2011/10/Screenshot-Python-DTrace-Call-graph-1.png"><img src="http://www.nohuddleoffense.de/wp-content/uploads/2011/10/Screenshot-Python-DTrace-Call-graph-1-300x120.png" alt="" title="Screenshot-Python DTrace - Call graph-1" width="300" height="120" class="size-medium wp-image-840" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>The following screenshot was taken while looking into the printer manager:</p>
<div id="attachment_841" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nohuddleoffense.de/wp-content/uploads/2011/10/Screenshot-Python-DTrace-Call-graph-2.png"><img src="http://www.nohuddleoffense.de/wp-content/uploads/2011/10/Screenshot-Python-DTrace-Call-graph-2-300x295.png" alt="" title="Screenshot-Python DTrace - Call graph-2" width="300" height="295" class="size-medium wp-image-841" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>DTrace for the win!</p>
<p>[Updated] Updated the screenshots.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2011/10/20/forget-static-callgraphs-use-dtrace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python traces Python using DTrace</title>
		<link>http://www.nohuddleoffense.de/2011/10/19/python-traces-python-using-dtrace/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=python-traces-python-using-dtrace</link>
		<comments>http://www.nohuddleoffense.de/2011/10/19/python-traces-python-using-dtrace/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 10:16:20 +0000</pubDate>
		<dc:creator>coach</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[DTrace]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.nohuddleoffense.de/?p=815</guid>
		<description><![CDATA[Another example of how to use Python as a DTrace consumer. This little program traces a Python program while is runs and shows you the flow of the code. The output is displayed in a Treeview (An indent mean that python called another function &#8211; Stepping back means that the function returned) and when double [...]]]></description>
			<content:encoded><![CDATA[<p>Another example of how to use <a title="Python as a DTrace consumer using libdtrace" href="http://www.nohuddleoffense.de/2011/10/07/python-as-a-dtrace-consumer-using-libdtrace/">Python as a DTrace consumer</a>. This little program traces a Python program while is runs and shows you the flow of the code. The output is displayed in a Treeview (An indent mean that python called another function &#8211; Stepping back means that the function returned) and when double clicking the source code is displayed (Would be nice to open <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305336">pydev</a> as well).</p>
<div id="attachment_816" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nohuddleoffense.de/wp-content/uploads/2011/10/Screenshot-Python-Flow-Tracer.png"><img class="size-medium wp-image-816" title="Screenshot-Python Flow Tracer" src="http://www.nohuddleoffense.de/wp-content/uploads/2011/10/Screenshot-Python-Flow-Tracer-300x165.png" alt="" width="300" height="165" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>Another example of Python as a DTrace consumer: This small GUI gives an up to date view of the number of syscalls made by an executable. Since this GUI is a live up to date view you can watch the circles appear, grow and become smaller again <img src='http://www.nohuddleoffense.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div id="attachment_820" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nohuddleoffense.de/wp-content/uploads/2011/10/screenshot.png"><img class="size-medium wp-image-820" title="screenshot" src="http://www.nohuddleoffense.de/wp-content/uploads/2011/10/screenshot-300x197.png" alt="" width="300" height="197" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p style="text-align: center;">
<p>Now on to other things&#8230;maybe creating live animated callgraphs as your program runs? <img src='http://www.nohuddleoffense.de/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.nohuddleoffense.de/2011/10/19/python-traces-python-using-dtrace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

