【Mistral】 workflow实例一, yaml文件里的变量定义,action调用等
以下实例引用自https://github.com/openstack/mistral-extra/blob/master/examples/v2/calculator/calculator.yaml
实例中,对于变量定义,string类型,变量引用,task返回都有涉及。
---
version: "2.0"name: calculatoractions:calc_summ:description: HTTP request to the server.base: std.httpbase-input:url: 'http://<% $.vm_ip %>:5000/summ'method: POSTbody:arguments: <% $.arguments %>output:summ_result: <% $.content.result %>input:- vm_ip- argumentsrun_calculator_server:description: SSH command to run the server.base: std.sshbase-input:host: <% $.host %>username: <% $.username %>password: <% $.password %>cmd: 'nohup python ~/web_app.py > web_app.log &'input:- host- username- passwordworkflows:run_calculator:type: directinput:- server_name # Name of the new instance- image_id # image id from Glance service- flavor_id # flavor id - type of instance hardware- ssh_username # VM username- ssh_password # VM password- to_email # email address to send notifications to- from_email # email address to send notifications from- smtp_server # SMTP server to use for sending emails (e.g. smtp.gmail.com:587)- smtp_password # password to connect to SMTP servertask-defaults:on-error:- send_create_vm_errordescription: |This workflow spins up a vm,deploys calculator web app on itand runs the calculation by sendinga request to calculator app.tasks:create_vm:description: Initial request to create a VM.workflow: std.create_instanceinput:name: <% $.server_name %>image_id: <% $.image_id %>flavor_id: <% $.flavor_id %>ssh_username: <% $.ssh_username %>ssh_password: <% $.ssh_password %>publish:vm_id: <% task(create_vm).result.id %>vm_ip: <% task(create_vm).result.ip %>on-success:- run_serverrun_server:description: When VM is up, we are able to run the server on VM (SSH command).action: run_calculator_server host=<% $.vm_ip %> username=<% $.ssh_username %> password=<% $.ssh_password %>on-success:- calc_summcalc_summ:description: Send HTTP request on server and calc the result.action: calc_summ arguments=[32, 45, 23] vm_ip=<% $.vm_ip %>retry:count: 10delay: 1publish:result: <% task(calc_summ).result.summ_result %>on-complete:- send_result_emailsend_result_email:description: Email the result of the calculation.action: std.emailinput:from_addr: <% $.from_email %>to_addrs: [<% $.to_email %>]subject: Workflow resultbody: |Workflow result of execution <% execution().id %> is <% $.result %>-- Thanks, Mistral Team.smtp_server: <% $.smtp_server %>smtp_password: <% $.smtp_password %>on-complete:- delete_vmsend_create_vm_error:description: In case of createVM error send e-mail with error message.action: std.emailinput:from_addr: <% $.from_email %>to_addrs: [<% $.to_email %>]subject: Workflow errorbody: |Failed to create a VM in execution <% execution().id %>-- Thanks, Mistral Team.smtp_server: <% $.smtp_server %>smtp_password: <% $.smtp_password %>on-complete:- delete_vmdelete_vm:description: Destroy VM.workflow: std.delete_instance instance_id=<% $.vm_id %>on-error:
- fail
每一行详细的介绍,稍后完成。
有基础的童鞋,可以做个参考。
不太了解的可以先看下
https://docs.openstack.org/mistral/latest/user/wf_lang_v2.html
https://yaml.org/spec/1.2/spec.html
【Mistral】 workflow实例一, yaml文件里的变量定义,action调用等相关推荐
- 【python练手】yaml文件里存储元组类型tuple
1.yaml 文件,写入时格式为tuple类型 如 YAML 文件里: info: (hahaha, "lalala") Python 读取出来的效果: {info: 'hahah ...
- yaml文件里引用yaml文件
a.yaml文件内容: a: 1 b: - 2 - 3 c: !include b.yaml b.yaml文件内容: - 10 - [100, 200, 300] python代码 # 基于类的解决方 ...
- php调用另一个php文件里的变量的值,thinkphp中一个方法调用另一个步骤的变量
thinkphp中一个方法调用另一个方法的变量 //实例化上传类 public function upload() { $upload = new Upload(); $upload->maxS ...
- yaml 文件内部使用变量赋值的方式_spring boot 学习笔记5(application.yaml 配置文件)...
YAML文件格式是Spring Boot支持的一种JSON超集文件格式,相较于传统的Properties配置文件, YAML文件以数据为核心,是一种更为直观且容易被电脑识别的数据序列化格式.appli ...
- shell中文件路径用变量定义_环境变量
环境变量可以使得 bash shell 存储有关 shell 会话和工作环境的信息,允许在内存中存储数据. 在 bash shell 中,环境变量分为: 全局变量 局部变量 全局变量对 shell 会 ...
- shell中文件路径用变量定义_shell学习笔记01(概述amp;变量)
Shell概述 为什么要学习Shell呢? 因为有用. Shell脚本入门 1.脚本格式 脚本以#!/bin/bash开头(指定解析器) 2.第一个Shell脚本:helloworld (1)需求:创 ...
- 如何在一个.c文件里调用另一个.c文件里的变量
假设被调用的C文件为func.c,则被调用的全局变量需被定义在文件开始处,即与头文件.宏定义. 函数声明在一起 #include <stdio.h> #define KEY abcd in ...
- string.h头文件里的函数源代码及调用(尝试编写)
1.strlen()函数的源代码及调用: #include<stdio.h> int strlen(char *s); int main() {int n;scanf("%d&q ...
- android读取本地yaml文件_python笔记11-读取yaml配置文件(pyyaml)
YAML简介 YAML 是一种较为人性化的数据序列化语言,可以配合目前大多数编程语言使用. YAML 的语法比较简洁直观,特点是使用空格来表达层次结构,其最大优势在于数据结构方面的表达,所以 YAML ...
最新文章
- linux kvm usb设备,KVM客户机使用主机USB设备
- python多久能学会爬虫-python一般学多久
- zabbix4.2学习笔记系列
- jdk的ServiceLoader
- 盲人方便的使用计算机输入文字,中文信息学报盲人用计算机软件系统中的语音和自然语言处理技术Ξ.PDF...
- PS使用:利用PS制作旋转水晶球gif图
- PHP根据配置设置可变变量
- 如何利用即时通讯工具进行营销
- 计算机操作系统——死锁的概念与处理
- java学习笔记 java编程思想 第5章 初始化与清理
- 疯狂的上网本意义何在?
- QT操作Word汇总
- 人民币大小写金额转换
- 大数据技术发展影响因素有哪些?
- 润乾报表主子报表通过参数控制子报表显示
- MySql数据库中,表字段新增,修改,删除
- Swift Literal Convertibles
- 《史蒂芬·乔布斯传》摘录
- TABLE 的 COL 及 COLGROUP 元素
- c语言实现大数运算加法