How to use the dax.XnatUtils 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 / bin / Xnat_tools / XnatPatchAssessors.py View on Github external
dax_settings = dax.DAX_Settings()
    logger = setup_info_logger()
    parser = configure_parser()
    parsed_args = parser.parse_args()
    logger.info('testing logger')

    #argument checks do their own logging
    if not check_arguments(logger, parsed_args):
        exit(-1)

    if not dax_settings.is_cluster_valid(logger):
        exit(-1)

    launcher = bin.read_settings(parsed_args.settings, logger, exe='patch assessors')

    with XnatUtils.get_interface(launcher.xnat_host, launcher.xnat_user,
                                 launcher.xnat_pass) as intf:
        print 'intf=', intf

        print 'launcher process dict=', launcher.project_process_dict

        project_list = set(launcher.project_process_dict.keys())
        if parsed_args.projects:
            for p in project_list:
                if p not in project_list:
                    msg = "project {} is not in the list of projects defined in {} ({})"
                    logger.warning(msg.format(p, parsed_args.settings, project_list))

        for p in project_list:
            project_processors = launcher.project_process_dict.get(p, None)
            if project_processors is None:
                logger.info("Procject '{}' has no processors - skipping")
github VUIIS / dax / dax / processors.py View on Github external
def _deserialize_inputs(self, assessor):
        return json.loads(
            XnatUtils.parse_assessor_inputs(assessor.attrs.get('inputs')))
github VUIIS / dax / dax / bin.py View on Github external
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 / spiders.py View on Github external
def check_executable(self, executable, name, version_opt='--version'):
        """Method to check the executable.

        :param executable: executable path
        :param name: name of Executable
        :return: Complete path to the executable
        """
        if executable == name:
            if not XnatUtils.executable_exists(executable):
                raise SpiderError("Executable '%s' not found on your computer."
                                  % name)
        else:
            executable = os.path.abspath(executable)
            if not executable.endswith(name):
                if os.path.isdir(executable):
                    executable = os.path.join(executable, name)
                else:
                    msg = "Error for executable path '%s': Wrong name."
                    raise SpiderError(msg % executable)
            if not os.path.isfile(executable):
                msg = "Executable '%s' not found"
                raise SpiderError(msg % executable)

        self.get_exe_version(executable, version_opt)
        return executable
github VUIIS / dax / dax / processor_parser.py View on Github external
ProcessorParser.parse_inputs(yaml_source)

        self.variables_to_inputs = ProcessorParser.parse_variables(self.inputs)

        self.csess = None
        self.artefacts = None
        self.artefacts_by_input = None
        self.parameter_matrix = None
        self.assessor_parameter_map = None

        self.xsitype = yaml_source['attrs'].get('xsitype', 'proc:genProcData')

        if proctype:
            self.proctype = proctype
        else:
            self.proctype = XnatUtils.get_proctype(
            yaml_source['inputs']['default']['spider_path'])[0]