def validate_file(self, filename): # parse the Orquesta workflow from file orquesta_wf_data, orquesta_wf_data_ruamel = yaml_utils.read_yaml( filename) # validate the Orquesta workflow orquesta_wf_spec = orquesta_workflow.instantiate(orquesta_wf_data) self.validate_workflow_spec(orquesta_wf_spec) if self.args.verbose: print("Successfully validated workflow from {}".format(filename))
def run(): args = parse_args() for f in args.filename: # parse the Mistral workflow from file mistral_wf_data = read_yaml(f) # validate the Mistral workflow before we start mistral_wf_spec = mistral_workflow.instantiate(mistral_wf_data) validate_workflow_spec(mistral_wf_spec) # convert Mistral -> Orquesta orquesta_wf_data = convert_workflow(mistral_wf_spec.spec) # validate we've generated a proper Orquesta workflow orquesta_wf_spec = orquesta_workflow.instantiate(orquesta_wf_data) validate_workflow_spec(orquesta_wf_spec) # write out the new Orquesta workflow print obj_to_yaml(orquesta_wf_spec.spec) return 0
def convert_file(self, filename, expr_type=None): # parse the Mistral workflow from file mistral_wf_data, mistral_wf_data_ruamel = yaml_utils.read_yaml( filename) # validate the Mistral workflow before we start mistral_wf_spec = mistral_workflow.instantiate(mistral_wf_data) self.validate_workflow_spec(mistral_wf_spec) # convert Mistral -> Orquesta mistral_wf = mistral_wf_data_ruamel[mistral_wf_spec.name] workflow_converter = WorkflowConverter() orquesta_wf_data_ruamel = workflow_converter.convert( mistral_wf, expr_type, force=self.args.force) orquesta_wf_data_str = yaml_utils.obj_to_yaml(orquesta_wf_data_ruamel) orquesta_wf_data = yaml_utils.yaml_to_obj(orquesta_wf_data_str) # validate we've generated a proper Orquesta workflow orquesta_wf_spec = orquesta_workflow.instantiate(orquesta_wf_data) if not self.args.force: self.validate_workflow_spec(orquesta_wf_spec) # write out the new Orquesta workflow to a YAML string return yaml_utils.obj_to_yaml(orquesta_wf_data_ruamel)