Created
October 12, 2015 21:43
-
-
Save twobraids/1dd042b118233cd2361b to your computer and use it in GitHub Desktop.
socorro apps as crontabber apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from crontabber.base import BaseCronApp | |
from crontabber.mixins import as_backfill_cron_app | |
from configman import Namespace, class_converter | |
@as_backfill_cron_app | |
class SocorroAppAsCrontabberApp(BaseCronApp): | |
required_config = Namespace() | |
required_config.add_option( | |
'socorro_application_class', | |
default='socorro.collector.crashmover_app.CrashMoverApp', | |
doc='fully qualified Python path to a Socorro App Class', | |
from_string_converter=class_converter | |
) | |
def __init__(self, config, job_information): | |
super(SocorroAppAsCrontabberApp, self).__init__( | |
config, | |
job_information | |
) | |
class SocorroClassWrapper(config.socorro_application_class): | |
@classmethod | |
def run(klass, config_path=None, values_source_list=None): | |
app_to_run = klass(config) | |
return app_to_run.main() | |
SocorroClassWrapper.__name__ = \ | |
config.socorro_application_class.__name__ | |
self.socorro_app_class = SocorroClassWrapper | |
def run(self, date): | |
self.config.date_for_run = date | |
self.socorro_app_class.run( | |
self.socorro_app_class, | |
config | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment