def run_show_template_details(template_id, output_preset_xml, output_preset_json): rtasks, rfiles, operators, pipelines_d = __dynamically_load_all() from pbsmrtpipe.pb_io import binding_str_to_task_id_and_instance_id task_options = {} if template_id in pipelines_d: pipeline = pipelines_d[template_id] print "**** Pipeline Summary ****" print "id : {i}".format(i=pipeline.idx) print "version : {i}".format(i=pipeline.version) print "name : {x}".format(x=pipeline.display_name) if pipeline.tags: print "Tags : {t} ".format(t=",".join(pipeline.tags)) print "Description: \n {x}".format(x=pipeline.description.strip()) print print pretty_bindings(pipeline.all_bindings) for b_out, b_in, in pipeline.all_bindings: for x in (b_out, b_in): if not binding_str_is_entry_id(x): task_id, _, _ = binding_str_to_task_id_and_instance_id(x) task = rtasks.get(task_id, None) if task is None: log.warn("Unable to load task {x}".format(x=task_id)) else: for k, vx in task.option_schemas.iteritems(): if k in pipeline.task_options: # this is kinda not awesome. there's the double API here # pbcommand and pbsmrtpipe need to be converted to # use a non-jsonschema model v = copy.deepcopy(vx) v['properties'][k]['default'] = pipeline.task_options[k] v['pb_option']['default'] = pipeline.task_options[k] task_options[k] = v else: task_options[k] = copy.deepcopy(vx) warn_msg = "Pipeline {i} has no options.".format(i=pipeline.idx) if isinstance(output_preset_xml, str): write_task_options_to_preset_xml_and_print(task_options, output_preset_xml, warn_msg) if isinstance(output_preset_json, str): write_presets_json_and_print(pipeline, task_options, output_preset_json, warn_msg) if task_options: _print_option_schemas(task_options) else: print "No default task options" else: msg = "Unable to find template id '{t}' in registered pipelines. Use the show-templates option to get a list of workflow options.".format(t=template_id) log.error(msg) print msg return 0
def run_show_template_details(template_id, output_preset_xml): rtasks, rfiles, operators, pipelines_d = __dynamically_load_all() from pbsmrtpipe.pb_io import binding_str_to_task_id_and_instance_id if template_id in pipelines_d: pipeline = pipelines_d[template_id] print "Pipeline id : {i}".format(i=pipeline.idx) print "Pipeline name : {x}".format(x=pipeline.display_name) print "Description : {x}".format(x=pipeline.description) if pipeline.tags: print "Tags : {t} ".format(t=",".join(pipeline.tags)) print pretty_bindings(pipeline.all_bindings) if isinstance(output_preset_xml, str): rtasks, rfiles, operators, pipelines = __dynamically_load_all() task_options = {} for b_out, b_in, in pipeline.bindings: for x in (b_out, b_in): task_id, _, _ = binding_str_to_task_id_and_instance_id(x) task = rtasks.get(task_id, None) if task is None: log.warn("Unable to load task {x}".format(x=task_id)) else: for k, v in task.option_schemas.iteritems(): task_options[k] = v warn_msg = "Pipeline {i} has no options.".format(i=pipeline.idx) write_task_options_to_preset_xml_and_print(task_options, output_preset_xml, warn_msg) else: msg = "Unable to find template id '{t}' in registered pipelines. Use the show-templates option to get a list of workflow options.".format(t=template_id) log.error(msg) print msg return 0
def test_binding_str_format(self): for b, r in zip(self.bs, self.results): r2 = IO.binding_str_to_task_id_and_instance_id(b) self.assertEquals(r, r2)
def run_show_template_details(template_id, output_preset_xml, output_preset_json): rtasks, rfiles, operators, pipelines_d = __dynamically_load_all() from pbsmrtpipe.pb_io import binding_str_to_task_id_and_instance_id pb_options = {} if template_id in pipelines_d: pipeline = pipelines_d[template_id] print "**** Pipeline Summary ****" print "id : {i}".format(i=pipeline.idx) print "version : {i}".format(i=pipeline.version) print "name : {x}".format(x=pipeline.display_name) # print "Schema version: {}".format(pipeline.schema_version) if pipeline.tags: print "Tags : {t} ".format(t=",".join(pipeline.tags)) print "Description: \n {x}".format(x=pipeline.description.strip()) print print pretty_bindings(pipeline.all_bindings) for b_out, b_in, in pipeline.all_bindings: for x in (b_out, b_in): if not binding_str_is_entry_id(x): task_id, _, _ = binding_str_to_task_id_and_instance_id(x) task = rtasks.get(task_id, None) if task is None: log.warn("Unable to load task {x}".format(x=task_id)) else: for pb_opt in task.option_schemas: if pb_opt.option_id in pb_options: continue elif pb_opt.option_id in pipeline.task_options: x = copy.deepcopy(pb_opt) value = pipeline.task_options[pb_opt.option_id] x._default = value # XXX hacky pb_options[pb_opt.option_id] = x else: pb_options[pb_opt.option_id] = pb_opt warn_msg = "Pipeline {i} has no options.".format(i=pipeline.idx) task_options_d = OrderedDict([(k, pb_options[k].default) for k in sorted(pb_options.keys())]) if isinstance(output_preset_xml, str): write_task_options_to_preset_xml_and_print(task_options_d, output_preset_xml, warn_msg) if isinstance(output_preset_json, str): write_presets_json_and_print(pipeline, task_options_d, output_preset_json, warn_msg) if pb_options: _print_pacbio_options( [pb_options[k] for k in sorted(pb_options.keys())]) else: print "No default task options" else: msg = "Unable to find template id '{t}' in registered pipelines. Use the show-templates option to get a list of workflow options.".format( t=template_id) log.error(msg) print msg return 0
def test_binding_str_format(self): for b, r in zip(self.bs, self.results): r2 = IO.binding_str_to_task_id_and_instance_id(b) self.assertEquals(r, r2)