def _get_runners_dir():
    runner_loader = RunnersLoader()
    runner_dir = os.path.join(CURRENT_DIR, '../st2/contrib/runners')

    runner_types = runner_loader.get_runners([runner_dir])

    return runner_types
Exemplo n.º 2
0
def register_runners(runner_dirs=None,
                     experimental=False,
                     fail_on_failure=True):
    """ Register runners
    """
    LOG.debug('Start : register runners')
    runner_count = 0
    runner_loader = RunnersLoader()

    if not runner_dirs:
        runner_dirs = content_utils.get_runners_base_paths()

    runners = runner_loader.get_runners(runner_dirs)

    for runner, path in runners.iteritems():
        LOG.info('Runner "%s"' % (runner))
        runner_manifest = os.path.join(path, MANIFEST_FILE_NAME)
        meta_loader = MetaLoader()
        runner_types = meta_loader.load(runner_manifest)
        for runner_type in runner_types:
            runner_count += register_runner(runner_type, experimental)

    LOG.debug('End : register runners')

    return runner_count
Exemplo n.º 3
0
def register_runners(runner_dir=None, experimental=False, fail_on_failure=True):
    """ Register runners
    """
    LOG.debug('Start : register runners')
    runner_count = 0
    runner_loader = RunnersLoader()

    if runner_dir:
        assert isinstance(runner_dir, list)

    if not runner_dir:
        runner_dirs = content_utils.get_runners_base_paths()

    runners = runner_loader.get_runners(runner_dirs)

    for runner, path in runners.iteritems():
        LOG.info('Runner "%s"' % (runner))
        runner_manifest = os.path.join(path, MANIFEST_FILE_NAME)
        meta_loader = MetaLoader()
        runner_types = meta_loader.load(runner_manifest)
        for runner_type in runner_types:
            runner_count += register_runner(runner_type, experimental)

    LOG.debug('End : register runners')

    return runner_count
def _get_runners_dir():
    runner_loader = RunnersLoader()
    runner_dir = os.path.join(CURRENT_DIR, '../st2/contrib/runners')

    runner_types = runner_loader.get_runners([runner_dir])

    return runner_types
Exemplo n.º 5
0
    def __init__(self, use_pack_cache=True, fail_on_failure=False):
        """
        :param use_pack_cache: True to cache which packs have been registered in memory and making
                                sure packs are only registered once.
        :type use_pack_cache: ``bool``

        :param fail_on_failure: Throw an exception if resource registration fails.
        :type fail_on_failure: ``bool``
        """
        self._use_pack_cache = use_pack_cache
        self._fail_on_failure = fail_on_failure

        self._meta_loader = MetaLoader()
        self._pack_loader = ContentPackLoader()
        self._runner_loader = RunnersLoader()