def registry_runner(registry_, rtasks, output_dir, emit_xml=False): # this will emit the PTs to an output dir from pbsmrtpipe.pb_io import pipeline_to_xml, write_pipeline_templates_to_json d = os.path.abspath(os.path.expanduser(output_dir)) r = registry_ log.info("Writing Pipeline Templates to {o}".format(o=output_dir)) print "Emitting pipelines to output dir {d}".format(d=d) # write_pipeline_templates_to_avro(r.pipelines.values(), rtasks, d) write_pipeline_templates_to_json(r.pipelines.values(), rtasks, d) for p in r.pipelines.values(): if emit_xml: file_name = p.idx + "_pipeline.xml" path = os.path.join(output_dir, file_name) xml = pipeline_to_xml(p) with open(path, 'w') as f: f.write(str(xml)) log.info("writing pipeline {x}".format(x=path)) log.info("Successfully wrote {n} pipelines to {d}".format(n=len(r.pipelines), d=d)) return 0
def registry_runner(registry_, rtasks, output_dir, emit_xml=False): """ :type registry_: PipelineRegistry :param rtasks: :type output_dir: str :type emit_xml: bool :rtype: int """ # this will emit the PTs to an output dir import pbsmrtpipe.pb_io as IO # get around circular imports import pbsmrtpipe.graph.bgraph as B r = registry_ log.info("Validating pipelines") # Validating pipeline integrity for i, p in r.pipelines.iteritems(): log.debug("Validating pipeline {}".format(i)) bg = B.binding_strs_to_binding_graph(rtasks, list(p.all_bindings)) # or this will raise is_valid = B.validate_binding_graph_integrity(bg) log.info("Pipeline {} is valid? {}".format(i, is_valid)) # Make the dir if it' doesn't exist output_pipeline_dir = os.path.abspath(os.path.expanduser(output_dir)) log.info("Writing {x} Pipeline Templates to {o}".format(o=output_dir, x=len( r.pipelines))) print "Emitting pipelines to output dir {d}".format(d=output_pipeline_dir) IO.write_pipeline_templates_to_json(r.pipelines.values(), rtasks, output_pipeline_dir) for p in r.pipelines.values(): if emit_xml: file_name = p.idx + "_pipeline.xml" path = os.path.join(output_dir, file_name) xml = IO.pipeline_to_xml(p) with open(path, 'w') as f: f.write(str(xml)) log.info("writing pipeline {x}".format(x=path)) _d = dict(n=len(r.pipelines), d=output_pipeline_dir, x=len(r.original_pipeline_ids), a=len(r.all_pipelines)) log.info( "Successfully wrote {n} new pipelines (previously loaded {x} all pipelines {a} to {d}" .format(**_d)) return 0
def registry_runner(registry_, rtasks, output_dir, emit_xml=False): """ :type registry_: PipelineRegistry :param rtasks: :type output_dir: str :type emit_xml: bool :rtype: int """ # this will emit the PTs to an output dir import pbsmrtpipe.pb_io as IO # get around circular imports import pbsmrtpipe.graph.bgraph as B r = registry_ log.info("Validating pipelines") # Validating pipeline integrity for i, p in r.pipelines.iteritems(): log.debug("Validating pipeline {}".format(i)) bg = B.binding_strs_to_binding_graph(rtasks, list(p.all_bindings)) # or this will raise is_valid = B.validate_binding_graph_integrity(bg) log.info("Pipeline {} is valid? {}".format(i, is_valid)) # Make the dir if it' doesn't exist output_pipeline_dir = os.path.abspath(os.path.expanduser(output_dir)) log.info("Writing {x} Pipeline Templates to {o}".format(o=output_dir, x=len(r.pipelines))) print "Emitting pipelines to output dir {d}".format(d=output_pipeline_dir) IO.write_pipeline_templates_to_json(r.pipelines.values(), rtasks, output_pipeline_dir) for p in r.pipelines.values(): if emit_xml: file_name = p.idx + "_pipeline.xml" path = os.path.join(output_dir, file_name) xml = IO.pipeline_to_xml(p) with open(path, 'w') as f: f.write(str(xml)) log.info("writing pipeline {x}".format(x=path)) _d = dict(n=len(r.pipelines), d=output_pipeline_dir, x=len(r.original_pipeline_ids), a=len(r.all_pipelines)) log.info("Successfully wrote {n} new pipelines (previously loaded {x} all pipelines {a} to {d}".format(**_d)) return 0
def registry_runner(registry_, rtasks, output_dir): # this will emit the PTs to an output dir d = os.path.abspath(os.path.expanduser(output_dir)) r = registry_ log.info("Writing Pipeline Templates to {o}".format(o=output_dir)) print "Emitting pipelines to output dir {d}".format(d=d) write_pipeline_templates_to_avro(r.pipelines.values(), rtasks, d) for p in r.pipelines.values(): file_name = p.idx + "_pipeline.xml" path = os.path.join(output_dir, file_name) xml = pipeline_to_xml(p) with open(path, 'w') as f: f.write(str(xml)) log.info("writing pipeline {x}".format(x=path)) log.info("Successfully wrote {n} pipelines to {d}".format(n=len(r.pipelines), d=d)) return 0