Refactor application entry point
Summary:
This change puts in a method the code to run the application.
This avoids to define "app" at a global scope.
Test Plan:
- Run the script, fire a notification
- pylint notifications
Reviewers: dereckson
Differential Revision: http://devcentral.nasqueron.org/D298