How to use the dax.processors.load_from_yaml function in dax

To help you get started, we’ve selected a few dax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VUIIS / dax / dax / bin.py View on Github external
raise DaxError('File %s does not exists.' % filepath)

    if filepath.endswith('.py'):
        test = imp.load_source('test', filepath)
        try:
            #print('evaling:' + _tmp.format(os.path.basename(filepath)[:-3]))
            return eval(_tmp.format(os.path.basename(filepath)[:-3]))
        except AttributeError as e:
            #print('attribute error', str(e))
            pass

        err = '[ERROR] Module or processor NOT FOUND in the python file {}.'
        logger.error(err.format(filepath))

    elif filepath.endswith('.yaml'):
        return processors.load_from_yaml(
            XnatUtils, filepath, args, singularity_imagedir)

    return None
github VUIIS / dax / dax / dax_tools_utils.py View on Github external
if filepath.endswith('yaml'):
        doc = utilities.read_yaml(filepath)

        if 'projects' in list(doc.keys()):
            try:
                return bin.read_yaml_settings(filepath, LOGGER)
            except AutoProcessorError:
                print('[ERROR]')
                exc_type, exc_value, exc_traceback = sys.exc_info()
                traceback.print_exception(exc_type, exc_value, exc_traceback,
                                          limit=2, file=sys.stdout)
        else:
            # So far only auto processor:
            try:
                return processors.load_from_yaml(XnatUtils, filepath)
            except AutoProcessorError:
                print('[ERROR]')
                exc_type, exc_value, exc_traceback = sys.exc_info()
                traceback.print_exception(exc_type, exc_value, exc_traceback,
                                          limit=2, file=sys.stdout)
    elif filepath.endswith('.py') or is_python_file(filepath):
        test = imp.load_source('test', filepath)
        # Check if processor file
        try:
            return eval('test.{}()'.format(test.__processor_name__))
        except AttributeError:
            pass

        # Check if it's a settings file.py
        try:
            return test.myLauncher