コード例 #1
0
ファイル: commands.py プロジェクト: tw7649116/TS
    def run(self):
        self.parse_command_line()

        # Instantiate class with proper environment
        if not self.instance:
            self.instance = self.cls()
        plugin = self.instance

        if self.options.inspect:
            from ion.plugin.info import PluginInfo
            print PluginInfo.from_instance(plugin)
            return self.EXIT_SUCCESS

        if self.options.bctable_columns:
            from ion.plugin.barcodetable_columns import available_columns
            print json.dumps(available_columns(), indent=1)
            return

        if self.options.runmode == "launch":
            return plugin.launch_wrapper(dry_run=self.options.dry_run)

        if self.options.runmode == "block":
            if not self.options.block:
                LOG.fatal("Block runmode requires --block identifier")
                return self.EXIT_ERROR
            return plugin.block(self.options.block)
コード例 #2
0
ファイル: commands.py プロジェクト: biocyberman/TS
    def run(self):
        self.parse_command_line()

        # Instantiate class with proper environment
        if not self.instance:
            self.instance = self.cls()
        plugin = self.instance

        if self.options.inspect:
            from ion.plugin.info import PluginInfo
            print PluginInfo.from_instance(plugin)
            return self.EXIT_SUCCESS

        if self.options.bctable_columns:
            from ion.plugin.barcodetable_columns import available_columns
            print json.dumps(available_columns(), indent=1)
            return

        if self.options.runmode == "launch":
            return plugin.launch_wrapper(dry_run=self.options.dry_run)

        if self.options.runmode == "block":
            if not self.options.block:
                LOG.fatal("Block runmode requires --block identifier")
                return self.EXIT_ERROR
            return plugin.block(self.options.block)
コード例 #3
0
ファイル: tasks.py プロジェクト: methylnick/TS
def get_info_from_script(name, script, context=None):
    from ion.plugin.loader import cache
    from ion.plugin.info import PluginInfo
    mod = cache.load_module(name, script)
    cls = cache.get_plugin(name)
    if not cls:
        return None
    plugin = cls()
    ## TODO plugin = cls(**context)
    info = PluginInfo.from_instance(plugin)
    return info
コード例 #4
0
ファイル: tasks.py プロジェクト: Jorges1000/TS
def get_info_from_script(name, script, context=None):
    from ion.plugin.loader import cache
    from ion.plugin.info import PluginInfo
    mod = cache.load_module(name, script)
    cls = cache.get_plugin(name)
    if not cls:
        return None
    plugin = cls()
    ## TODO plugin = cls(**context)
    info = PluginInfo.from_instance(plugin)
    return info
コード例 #5
0
ファイル: test_plugins.py プロジェクト: Brainiarc7/TS
def check_plugin(cls):
    assert(cls.name)
    #assert(cls.__name__ ==  cls.name)
    #assert(cls.__version__)
    #assert(cls.version)

    p = cls()
    #assertIsInstance(p, IonPlugin, msg='Plugin not instance of IonPlugin')
    assert isinstance(p, IonPlugin)
    log.info("Plugin Instance: %s", p)
    j = PluginInfo.from_instance(p)
    assert j
コード例 #6
0
ファイル: test_plugins.py プロジェクト: dkeren/TS
def check_plugin(cls):
    assert (cls.name)
    #assert(cls.__name__ ==  cls.name)
    #assert(cls.__version__)
    #assert(cls.version)

    p = cls()
    #assertIsInstance(p, IonPlugin, msg='Plugin not instance of IonPlugin')
    assert isinstance(p, IonPlugin)
    log.info("Plugin Instance: %s", p)
    j = PluginInfo.from_instance(p)
    assert j
コード例 #7
0
def check_plugin(cls):
    p = cls()
    if not p:
        return
    logger.info("Plugin Instance: %s", p)
    info = PluginInfo.from_instance(p)
    assert info
    assert info.version
    infojson = str(info)
    assert infojson
    infodict = json.loads(infojson)
    assert infodict['version']

    logger.debug("Plugin info:\n%s ", infojson)
コード例 #8
0
ファイル: test_plugin_loader.py プロジェクト: BENMFeng/TS
def check_plugin(cls):
    p = cls()
    if not p:
        return
    logger.info("Plugin Instance: %s", p)
    info = PluginInfo.from_instance(p)
    assert info
    assert info.version
    infojson = str(info)
    assert infojson
    infodict = json.loads(infojson)
    assert infodict['version']

    logger.debug("Plugin info:\n%s ", infojson)
コード例 #9
0
ファイル: tasks.py プロジェクト: biocyberman/TS
def get_info_from_script(name, script, context=None, add_to_store=True):
    from ion.plugin.loader import cache
    from ion.plugin.info import PluginInfo
    mod = cache.load_module(name, script, add_to_store)

    # if the load module command returned a None object, then lets raise an exception based on what happened
    if not mod:
        if name in cache.module_errors:
            raise cache.module_errors[name]
        else:
            raise Exception("Error loading the module.")

    cls = cache.get_plugin(name)
    if not cls:
        raise Exception("The python module loaded but no classes which extend 'IonPlugin' registered themselves with the framework.")
    plugin = cls()
    return PluginInfo.from_instance(plugin)
コード例 #10
0
def get_info_from_script(name, script, context=None, add_to_store=True):
    from ion.plugin.loader import cache
    from ion.plugin.info import PluginInfo
    mod = cache.load_module(name, script, add_to_store)

    # if the load module command returned a None object, then lets raise an exception based on what happened
    if not mod:
        if name in cache.module_errors:
            raise cache.module_errors[name]
        else:
            raise Exception("Error loading the module.")

    cls = cache.get_plugin(name)
    if not cls:
        raise Exception(
            "The python module loaded but no classes which extend 'IonPlugin' registered themselves with the framework."
        )
    plugin = cls()
    return PluginInfo.from_instance(plugin)