Grails Events and Profiling
I had to debug an issue today where my integration tests were bleeding into my functional tests by way of the database. After some fiddling and googling I ran into this, setting-grails-functional-test-database. Which left me curious about what other events were available to listen for in _Events.groovy. So I ran git grep 'event(' in grails-core. There did not seem to be many events of interest to catch, but I did notice some similar code calling;
profile(name) { /* block of code */ }Which I thought was interesting and so I went searching for how to enable that, and low and behold, adding
-Dgrails.script.profile=true to a grails command will spit out a host of profiling information, particularly about startup. It also does a nice job of painting what the overall load order of your application is, possibly even clearer then setting debug 'grails' in Config.groovy.
Just as a rough reference I decided to see if I could shell out a unique list of valid events. It’s funny how unix grows on you, I had never used a columns command before, but it seemed likely so I tried col<tab> and sure enough both column and columns existed.
$ git grep 'event(' |\
ruby -pe '$_.sub!(/.+event\(.(\w+).+/){$1.sub(/Start|End/,"*")}' |\
sort -u | egrep -v 'ventName|A' | column -c 72
ConfigureTomcat PackagePlugin* TestCase*
CreatedFile Packaging* TestCompile*
CreateWar* PluginLoad* TestFailure
Doc* PluginUninstalled TestPhase*
DocSkip SetClasspath TestPhases*
Exiting Stats* TestProduceReports
GenerateController* StatusError TestSuite*
GenerateViews* StatusFinal WebXml*
InstallPlugin* StatusUpdate
IntegrateWithInit Test*
Note that this is only the list of events directly specified by a string at the point of call for event. I also made the list shorter by appending * to any event that had both a Start or End version.
Typo Upgrade + Various
I just upgraded to the trunk of typo again. Unfortuneatly it appears that broke my quote controller, which was why the site was down for a few days. However I think now my quotes code is slightly more robust. I still need to figure out a nice way to include it within the typo database instead of in db/quotes.yml.
On other fronts, I appear to be job hunting at the moment, though prospects for the summer at least seem to relatively good. The “where I am going to live for summer/fall” and “how I am going to graduate with a masters in december” problems both seem to have much less clear solutions at the moment. Not certain about fall employment either, though that is slightly less of a concern.
I aquired a fun new toy last week, a brand new Canon Digital Rebel XT, so hopefully some nice shots from that will be forthcoming presently.
I finally did some digital housekeeping I had meant to due for ages while procrastinating on various assignments. I reorganized all of my unix home directory dotfiles so they all live inside of a directory that is checked out of a SVN repository. Moving to a new box now involves a simple checkout of the code and running the setup.sh file to set up the symbolic links. It also exports a dotfile called .site-config into the home directory which exports information on where all the dotfiles are symlinked from. This allows me to let various auxiliary dotfiles remain inside of the source controlled directory. It also allows other programs like emacs to grab the location from the environment. I used to have a setup similar to this in which I just checked out the home directory itself, but that approach results in a number of annoying issues, chiefly namespace clobbering. When I get everything further along perhaps I will post it as an example. Most documentation one finds seems to describe how they setup there different dotfiles, but not how they manage them between hosts.
It’s probably one of those things that works best for the person that created it, but I would be curious to see how others have managed to solve this problem.
