def _load_presets(self): preset_xml = op.join(op.dirname(self.job_dir), "preset.xml") preset_json = op.join(op.dirname(self.job_dir), "preset.json") if not op.isfile(preset_xml) and not op.isfile(preset_json): raise SkipTest("No presets JSON or XML found") if op.isfile(preset_json): return parse_pipeline_preset_json(preset_json) elif op.isfile(preset_xml): return parse_pipeline_preset_xml(preset_xml)
def get_task_and_workflow_options(testkit_cfg): parsed_cfg = config_parser_to_butler(testkit_cfg) workflow_options, task_options = [], [] def __get_option_type(val): option_type = TaskOptionTypes.STR if isinstance(val, bool): option_type = TaskOptionTypes.BOOL elif isinstance(val, int): option_type = TaskOptionTypes.INT elif isinstance(val, float): option_type = TaskOptionTypes.FLOAT elif val is None: val = "" return option_type, val rtasks_d, _, _, _ = L.load_all() if not parsed_cfg.preset_xml in [None, '']: if not parsed_cfg.preset_json in [None, '']: raise ValueError( "Please use either preset_json or preset_xml, not both") presets = parse_pipeline_preset_xml(parsed_cfg.preset_xml) task_opts_d = validate_raw_task_options(rtasks_d, dict(presets.task_options)) for option_id, option_value in task_opts_d.iteritems(): log.info("task_option: {i} = {v}".format(i=option_id, v=option_value)) option_type, option_value = __get_option_type(option_value) task_options.append( dict(optionId=option_id, value=option_value, optionTypeId=option_type)) for option_id, option_value in presets.workflow_options: log.info("workflow_option: {i} = {v}".format(i=option_id, v=option_value)) workflow_options.append( dict(optionId=option_id, value=option_value, optionTypeId=__get_option_type(option_value)[0])) elif not parsed_cfg.preset_json in [None, '']: presets = parse_pipeline_preset_json(parsed_cfg.preset_json) for option_id, option_value in presets.task_options: log.info("task_option: {i} = {v}".format(i=option_id, v=option_value)) option_type, option_value = __get_option_type(option_value) task_options.append( dict(optionId=option_id, value=option_value, optionTypeId=option_type)) for option_id, option_value in presets.workflow_options: log.info("workflow_option: {i} = {v}".format(i=option_id, v=option_value)) workflow_options.append( dict(optionId=option_id, value=option_value, optionTypeId=__get_option_type(option_value)[0])) return task_options, workflow_options
def get_task_and_workflow_options(testkit_cfg): parsed_cfg = config_parser_to_butler(testkit_cfg) workflow_options, task_options = [], [] def __get_option_type(val): option_type = to_opt_type_ns("string") if isinstance(val, bool): option_type = to_opt_type_ns("boolean") elif isinstance(val, int): option_type = to_opt_type_ns("integer") elif isinstance(val, float): option_type = to_opt_type_ns("float") elif val is None: val = "" return option_type, val if not parsed_cfg.preset_xml in [None, '']: if not parsed_cfg.preset_json in [None, '']: raise ValueError( "Please use either preset_json or preset_xml, not both") presets = parse_pipeline_preset_xml(parsed_cfg.preset_xml) for option_id, option_value in presets.task_options: log.info("task_option: {i} = {v}".format(i=option_id, v=option_value)) option_type, option_value = __get_option_type(option_value) task_options.append( dict(optionId=option_id, value=option_value, optionTypeId=option_type)) for option_id, option_value in presets.workflow_options: log.info("workflow_option: {i} = {v}".format(i=option_id, v=option_value)) workflow_options.append( dict(optionId=option_id, value=option_value, optionTypeId=__get_option_type(option_value)[0])) elif not parsed_cfg.preset_json in [None, '']: presets = parse_pipeline_preset_json(parsed_cfg.preset_json) for option_id, option_value in presets.task_options: log.info("task_option: {i} = {v}".format(i=option_id, v=option_value)) option_type, option_value = __get_option_type(option_value) task_options.append( dict(optionId=option_id, value=option_value, optionTypeId=option_type)) for option_id, option_value in presets.workflow_options: log.info("workflow_option: {i} = {v}".format(i=option_id, v=option_value)) workflow_options.append( dict(optionId=option_id, value=option_value, optionTypeId=__get_option_type(option_value)[0])) return task_options, workflow_options
def get_task_and_workflow_options(testkit_cfg): parsed_cfg = config_parser_to_butler(testkit_cfg) workflow_options, task_options = [], [] def __get_option_type(val): option_type = to_opt_type_ns("string") if isinstance(val, bool): option_type = to_opt_type_ns("boolean") elif isinstance(val, int): option_type = to_opt_type_ns("integer") elif isinstance(val, float): option_type = to_opt_type_ns("float") elif val is None: val = "" return option_type, val if not parsed_cfg.preset_xml in [None, '']: if not parsed_cfg.preset_json in [None, '']: raise ValueError("Please use either preset_json or preset_xml, not both") presets = parse_pipeline_preset_xml(parsed_cfg.preset_xml) for option_id, option_value in presets.task_options: log.info("task_option: {i} = {v}".format(i=option_id, v=option_value)) option_type, option_value = __get_option_type(option_value) task_options.append(dict( optionId=option_id, value=option_value, optionTypeId=option_type)) for option_id, option_value in presets.workflow_options: log.info("workflow_option: {i} = {v}".format(i=option_id, v=option_value)) workflow_options.append(dict( optionId=option_id, value=option_value, optionTypeId=__get_option_type(option_value)[0])) elif not parsed_cfg.preset_json in [None, '']: presets = parse_pipeline_preset_json(parsed_cfg.preset_json) for option_id, option_value in presets.task_options: log.info("task_option: {i} = {v}".format(i=option_id, v=option_value)) option_type, option_value = __get_option_type(option_value) task_options.append(dict( optionId=option_id, value=option_value, optionTypeId=option_type)) for option_id, option_value in presets.workflow_options: log.info("workflow_option: {i} = {v}".format(i=option_id, v=option_value)) workflow_options.append(dict( optionId=option_id, value=option_value, optionTypeId=__get_option_type(option_value)[0])) return task_options, workflow_options
def _parse(self, file_name): return IO.parse_pipeline_preset_json(file_name)
def _parse(self, file_name): return IO.parse_pipeline_preset_json(file_name)