Flow vs Stream

https://wikidiff.com/flow/stream

As nouns the difference between flow and stream

is that flow is the movement of a fluid while stream is a small river; a large creek; a body of moving water confined by banks.

As verbs the difference between flow and stream

is that flow is to move as a fluid from one position to another while stream is to flow in a continuous or steady manner, like a liquid.

Data flow

https://www.computerhope.com/jargon/d/data-flow-diagram.htm

Data flow diagram

Updated: 04/26/2017 by Computer Hope

A data flow diagram (or DFD) is a graphical representation of the flow of data through an information system. It shows how information is input to and output from the system, the sources and destinations of that information, and where that information is stored.

Information not shown in a DFD includes how long processes take, and whether those processes operate in series or parallel. Such information is often shown in a flowchart instead.

Process Flow

https://www.differencebetween.com/difference-between-flowchart-and-vs-data-flow-diagram-dfd/

The terms flowchart and data flow diagram (DFD) are related to software engineering describing the path of process or data step by step. Although flow chart is used in almost all the fields of education and engineering data flow diagram is mainly used is the software industry. Both the diagrams are made to make the process simple to understand. A flow chart provides the steps needed to reach the desired results and a data flow diagram describes the source from which data is coming, the change that occurs in the system and the source at which it ends. Both these diagrams provide a very easy way to understand the way a process is taking place or data is being processed from the beginning till the end.

Flowchart

A flowchart is made to break down a process into simple steps by writing down the steps in boxes that are connected with arrows. A flow chart starts from the first step and ends at the last step with all the actions to be performed in middle. Flow chart also trouble shoots the problems by providing solution if an error occurs during any step. The biggest advantage of a flow chart is that it gives an overall view of the process at a single glance, to understand it better. There are different types of flowcharts like

• System flow chart

• Data flow chart

• Document flow chart

• Program flow chart

Data Flow Diagram

A data flow diagram is a representation of data flow through a system during which it is processed as well. The flow of data from an external source or internal source to its destination is shown by a diagram. Where the data will end up after being processed is also shown in a data flow diagram. The processes through which data will go through are shown in these diagrams. These processes can be a sequence or act simultaneously while data is going through the system.

Flowchart vs Data Flow Diagram (DFD)

• The main difference between flow chart and data flow diagram is that flow chart presents steps to complete a process where as data flow diagram presents the flow of data.

• Flow chart does not have any input from or output to external source whereas data flow diagram describes the path of data from external source to internal store or vice versa.

• The timing and sequence of the process is aptly shown by a flow chart where as the processing of data is taking place in a particular order or several processes are taking simultaneously is not described by a data flow diagram.

• Data flow diagrams define the functionality of a system where as flow diagram shows how to make a system function.

• Flow charts are used in designing a process but data flow diagram are used to describe the path of data that will complete that process.

work flow

https://www.process.st/what-is-a-workflow/

If you look at the Wikipedia definition of a workflow, you’re probably going to get confused as I did:

“A workflow consists of an orchestrated and repeatable pattern of business activity enabled by the systematic organization of resources into processes that transform materials, provide services, or process information It can be depicted as a sequence of operations, declared as work of a person or group, an organization of staff, or one or more simple or complex mechanisms.”

Let’s put this simply…

Workflows are the way people get work done, and can be illustrated as series of steps that need to be completed sequentially in a diagram or checklist.

例如报道工作流

https://www.dmcinfo.com/latest-thinking/blog/id/8569/onboarding-employees-using-sharepoint-workflow

ticket状态工作流

https://confluence.atlassian.com/adminjiraserver072/working-with-workflows-828787890.html

流控制实现

workflow-es

https://github.com/danielgerlag/workflow-es/blob/master/samples/node.js/javascript/01-hello-world.js

const workflow_es = require("workflow-es");
const workflow_mongo = require("workflow-es-mongodb"); class HelloWorld extends workflow_es.StepBody {
run(context) {
console.log("Hello World");
return workflow_es.ExecutionResult.next();
}
}
class GoodbyeWorld extends workflow_es.StepBody {
run(context) {
console.log("Goodbye World");
return workflow_es.ExecutionResult.next();
}
}
class HelloWorld_Workflow {
constructor() {
this.id = "hello-world";
this.version = 1;
}
build(builder) {
builder
.startWith(HelloWorld)
.then(GoodbyeWorld);
}
} async function main() {
var config = workflow_es.configureWorkflow();
//config.useLogger(new workflow_es.ConsoleLogger());
//let mongoPersistence = new workflow_mongo.MongoDBPersistence("mongodb://127.0.0.1:27017/workflow-node");
//await mongoPersistence.connect;
//config.usePersistence(mongoPersistence);
var host = config.getHost(); host.registerWorkflow(HelloWorld_Workflow);
await host.start();
let id = await host.startWorkflow("hello-world", 1);
console.log("Started workflow: " + id);
} main();

上面是先后顺序控制:

下面是并行控制:

const workflow_es = require("workflow-es");
const workflow_mongo = require("workflow-es-mongodb"); class SayHello extends workflow_es.StepBody {
run(context) {
console.log("Hello");
return workflow_es.ExecutionResult.next();
}
} class PrintMessage extends workflow_es.StepBody {
run(context) {
console.log(this.message);
return workflow_es.ExecutionResult.next();
}
} class DoSomething extends workflow_es.StepBody {
run(context) {
console.log("Doing something...");
return workflow_es.ExecutionResult.next();
}
} class SayGoodbye extends workflow_es.StepBody {
run(context) {
console.log("Bye");
return workflow_es.ExecutionResult.next();
}
} class Parallel_Workflow {
constructor() {
this.id = "parallel-sample";
this.version = 1;
}
build(builder) {
builder
.startWith(SayHello)
.parallel()
.do(branch1 => branch1
.startWith(PrintMessage)
.input((step, data) => step.message = "Running in branch 1")
.delay(data => 5000)
.then(DoSomething)
)
.do(branch2 => branch2
.startWith(PrintMessage)
.input((step, data) => step.message = "Running in branch 2")
)
.do(branch3 => branch3
.startWith(PrintMessage)
.input((step, data) => step.message = "Running in branch 3")
)
.join()
.then(SayGoodbye);
}
} async function main() {
var config = workflow_es.configureWorkflow();
var host = config.getHost(); host.registerWorkflow(Parallel_Workflow);
await host.start();
let id = await host.startWorkflow("parallel-sample", 1);
console.log("Started workflow: " + id);
} main();

Python taskflow

https://github.com/openstack/taskflow/blob/master/taskflow/examples/hello_world.py

# -*- coding: utf-8 -*-

#    Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License. import logging
import os
import sys logging.basicConfig(level=logging.ERROR) top_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
sys.path.insert(0, top_dir) from taskflow import engines
from taskflow.patterns import linear_flow as lf
from taskflow.patterns import unordered_flow as uf
from taskflow import task # INTRO: This is the defacto hello world equivalent for taskflow; it shows how
# an overly simplistic workflow can be created that runs using different
# engines using different styles of execution (all can be used to run in
# parallel if a workflow is provided that is parallelizable). class PrinterTask(task.Task):
def __init__(self, name, show_name=True, inject=None):
super(PrinterTask, self).__init__(name, inject=inject)
self._show_name = show_name def execute(self, output):
if self._show_name:
print("%s: %s" % (self.name, output))
else:
print(output) # This will be the work that we want done, which for this example is just to
# print 'hello world' (like a song) using different tasks and different
# execution models.
song = lf.Flow("beats") # Unordered flows when ran can be ran in parallel; and a chorus is everyone
# singing at once of course!
hi_chorus = uf.Flow('hello')
world_chorus = uf.Flow('world')
for (name, hello, world) in [('bob', 'hello', 'world'),
('joe', 'hellooo', 'worllllld'),
('sue', "helloooooo!", 'wooorllld!')]:
hi_chorus.add(PrinterTask("%s@hello" % name,
# This will show up to the execute() method of
# the task as the argument named 'output' (which
# will allow us to print the character we want).
inject={'output': hello}))
world_chorus.add(PrinterTask("%s@world" % name,
inject={'output': world})) # The composition starts with the conductor and then runs in sequence with
# the chorus running in parallel, but no matter what the 'hello' chorus must
# always run before the 'world' chorus (otherwise the world will fall apart).
song.add(PrinterTask("conductor@begin",
show_name=False, inject={'output': "*ding*"}),
hi_chorus,
world_chorus,
PrinterTask("conductor@end",
show_name=False, inject={'output': "*dong*"})) # Run in parallel using eventlet green threads...
try:
import eventlet as _eventlet # noqa
except ImportError:
# No eventlet currently active, skip running with it...
pass
else:
print("-- Running in parallel using eventlet --")
e = engines.load(song, executor='greenthreaded', engine='parallel',
max_workers=1)
e.run() # Run in parallel using real threads...
print("-- Running in parallel using threads --")
e = engines.load(song, executor='threaded', engine='parallel',
max_workers=1)
e.run() # Run in parallel using external processes...
print("-- Running in parallel using processes --")
e = engines.load(song, executor='processes', engine='parallel',
max_workers=1)
e.run() # Run serially (aka, if the workflow could have been ran in parallel, it will
# not be when ran in this mode)...
print("-- Running serially --")
e = engines.load(song, engine='serial')
e.run()
print("-- Statistics gathered --")
print(e.statistics)

https://www.tuicool.com/articles/fAfqMf

from __future__ import print_function

import urllib2

import taskflow.engines
from taskflow.patterns import linear_flow as lf
from taskflow import task def flow_watch(state, details):
print('Flow State: {}'.format(state))
print('Flow Details: {}'.format(details)) def task_watch(state, details):
print('Task State: {}'.format(state))
print('Task Details: {}'.format(details)) def fetch(url):
request = urllib2.Request(url=url)
response = urllib2.urlopen(request)
return response.getcode() class GoogleFetch(task.Task):
def execute(self, google_url, *args, **kwargs):
status_code = fetch(google_url)
print('Google Response Code: {}'.format(status_code)) def revert(self, google_url, *args, **kwargs):
print('Magically Reverting the Google Call!') class AmazonFetch(task.Task):
def execute(self, amazon_url, *args, **kwargs):
status_code = fetch(amazon_url)
print('Amazon Response Code: {}'.format(status_code)) def revert(self, amazon_url, *args, **kwargs):
print('Magically Reverting the Amazon Call!') if __name__ == "__main__":
flow = lf.Flow('simple-linear-listen').add(
GoogleFetch(),
AmazonFetch()
) engine = taskflow.engines.load(flow,
store=dict(
google_url='http://google.com',
amazon_url='HELLO!http://amazon.com')) engine.notifier.register('*', flow_watch)
engine.task_notifier.register('*', task_watch) try:
engine.run()
except urllib2.URLError:
print("I think the URL is bad in one of the tasks...")
except Exception as ex:
print(ex.message)

flow的更多相关文章

  1. Git 在团队中的最佳实践--如何正确使用Git Flow

    我们已经从SVN 切换到Git很多年了,现在几乎所有的项目都在使用Github管理, 本篇文章讲一下为什么使用Git, 以及如何在团队中正确使用. Git的优点 Git的优点很多,但是这里只列出我认为 ...

  2. [LeetCode] Pacific Atlantic Water Flow 太平洋大西洋水流

    Given an m x n matrix of non-negative integers representing the height of each unit cell in a contin ...

  3. BZOJ 4390: [Usaco2015 dec]Max Flow

    4390: [Usaco2015 dec]Max Flow Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 177  Solved: 113[Submi ...

  4. ArcGIS制作放射状流向地图(Radial Flow Map)

    流向地图火了,因为Facebook的那张著名的友邻图,抑或因为<数据可视化之美>中介绍飞行模式的航线图,总之,流向地图以它特殊的可视化形式,直观地展示事物之间的联系,尤其在展示网络流向.贸 ...

  5. SSIS Data Flow优化

    一,数据流设计优化 数据流有两个特性:流和在内存缓冲区中处理数据,根据数据流的这两个特性,对数据流进行优化. 1,流,同时对数据进行提取,转换和加载操作 流,就是在source提取数据时,转换组件处理 ...

  6. Data Flow的Error Output

    一,在Data Flow Task中,对于Error Row的处理通过Error Output Tab配置的. 1,操作失败的类型:Error(Conversion) 和 Truncation. 2, ...

  7. SSIS Data Flow 的 Execution Tree 和 Data Pipeline

    一,Execution Tree 执行树是数据流组件(转换和适配器)基于同步关系所建立的逻辑分组,每一个分组都是一个执行树的开始和结束,也可以将执行树理解为一个缓冲区的开始和结束,即缓冲区的整个生命周 ...

  8. SSIS的 Data Flow 和 Control Flow

    Control Flow 和 Data Flow,是SSIS Design中主要用到的两个Tab,理解这两个Tab的作用,对设计更高效的package十分重要. 一,Control Flow 在Con ...

  9. 前端必须了解的布局常识:普通流(normal flow)

    目录 一.概述 二.块级元素和内联元素 常见的块级元素 BFC 常见的行内元素 IFC 三.哪些情况会脱离普通流 浮动 绝对定位 固定定位 display:none 四.总结 五.参考资料 一.概述 ...

  10. 财务报表 > 现金流表的直接法,间接法,Cash Flow from Operating Activites

    经营活动现金流量 Cash Flow from Operating Activites 是指企业投资活动和筹资活动以外的所有的交易和事项产生的现金流量.它是企业现金的主要来源. 1. 直接法经营活动现 ...

随机推荐

  1. Dapper 一对多查询 one to many

    参考文档:Dapper one to many Table public class Person { public int Id { get; set; } public string Name { ...

  2. DFS(一):砌墙问题

    问题描述 使用两种砖头砌墙,砖头A宽为2,高为1,砖头B宽为3,高为1,用这两种砖头砌一面宽为W,高为H的墙. 为了使墙牢固性高,要求每种砖只能横向摆放,不能竖起来,且除了两侧以外,不能出现上下对齐的 ...

  3. 逆向破解之160个CrackMe —— 019

    CrackMe —— 019 160 CrackMe 是比较适合新手学习逆向破解的CrackMe的一个集合一共160个待逆向破解的程序 CrackMe:它们都是一些公开给别人尝试破解的小程序,制作 c ...

  4. Linux系统下jar包的启动方式

    Linux 运行jar包命令如下: 方式一: Java -jar shareniu.jar 特点:当前ssh窗口被锁定,可按CTRL + C打断程序运行,或直接关闭窗口,程序退出 那如何让窗口不锁定? ...

  5. 利用反射与dom4j读取javabean生成对应XML

    项目中需要自定义生成一个xml,要把Javabean中的属性拼接一个xml,例如要生成以下xml <?xml version="1.0" encoding="gb2 ...

  6. hive创建表

    一.为什么要创建分区表 1.select查询中会扫描整个表内容,会消耗大量时间.由于相当多的时候人们只关心表中的一部分数据, 故建表时引入了分区概念. 2.hive分区表:是指在创建表时指定的part ...

  7. Ajax无法访问回调函数seccess问题

    1,后台返回的数据是标准json格式,前端dataType也是josn, 2,没有跨域访问, 但是一直只执行error方法, 原因出在: 应设置为button按钮,指明类型为button

  8. swift语法之常量 变量 类型

    常量和变量: 在swift中声明变量或者声明常量的时候可以不用写变量或者常量类型 因为系统会自动推导出对应的类型. 变量:可以更改值 swift中每句代码后面不需要加 ; 号 var num = 5 ...

  9. (尚031)Vue_案例_自定义事件(组件间通信第2种方式:vue自定义事件)

    自定义事件: 我们知道,父组件使用prop传递数据的子组件,但子组件怎么跟父组件通信呢? 这个时候Vue的自定义事件系统就派得上用场了. 自定义事件知道两件事: (1).绑定 (2).触发 注意:$o ...

  10. Hibernate的事务

    1.数据库的封锁(https://www.cnblogs.com/zhai1997/p/11710082.html): 封锁是实现并发控制的重要技术. read uncommitted : 读取尚未提 ...