Example #1
0
def start_enrichment_plugin_agent():
    """
    The entry point for the Enrichment Plugin Agent

    This method creates a Panoptes Context and the Celery Instance for the Enrichment Plugin Agent

    Returns:
        None
    """
    global panoptes_context, celery

    try:
        panoptes_context = PanoptesEnrichmentAgentContext()
    except Exception as e:
        sys.exit(u'Could not create a Panoptes Context: %s' % (str(e)))

    logger = panoptes_context.logger
    logger.info(u'Attempting to start Celery application')

    celery_config = PanoptesCeleryConfig(
        const.ENRICHMENT_PLUGIN_AGENT_CELERY_APP_NAME)

    try:
        celery = PanoptesCeleryInstance(panoptes_context, celery_config).celery
    except Exception as exp:
        sys.exit(u'Could not instantiate Celery application: %s' % str(exp))
    else:
        logger.info(u'Started Celery application: %s' % celery)
Example #2
0
 def setUp(self):
     self.my_dir, self.panoptes_test_conf_file = get_test_conf_file()
     self._panoptes_context = PanoptesContext(self.panoptes_test_conf_file,
                                              key_value_store_class_list=[PanoptesTestKeyValueStore],
                                              create_message_producer=False, async_message_producer=False,
                                              create_zookeeper_client=True)
     self._celery_config = PanoptesCeleryConfig(app_name="Polling Plugin Test")
     self._scheduler = PanoptesPluginScheduler(self._panoptes_context, "polling", "Polling", self._celery_config, 1,
                                               _callback)
Example #3
0
 def setUp(self):
     self.my_dir, self.panoptes_test_conf_file = get_test_conf_file()
     self._panoptes_context = PanoptesContext(self.panoptes_test_conf_file,
                                              key_value_store_class_list=[PanoptesTestKeyValueStore],
                                              create_message_producer=False, async_message_producer=False,
                                              create_zookeeper_client=True)
     self._celery_config = PanoptesCeleryConfig(app_name=u"Polling Plugin Test")
     self._scheduler = PanoptesPluginScheduler(
         panoptes_context=self._panoptes_context,
         plugin_type=u"polling",
         plugin_type_display_name=u"Polling",
         celery_config=self._celery_config,
         lock_timeout=1,
         plugin_scheduler_task=_callback
     )