# A python module for parsing and executing BPMN models in a single process
Supported elements so far:
- Start/end events
- Task (Manual, User, Service) - dummy execution for now
- Gateways (Exclusive, Parallel)
- Sequence flow with conditions
Example BPMN model:
![image](https://user-images.githubusercontent.com/714889/114159824-81c65d80-9926-11eb-8b74-6d5dd9bb82ea.png)
Example usage:
```python
import asyncio
from bpmn_model import BpmnModel
m = BpmnModel("models/model_01.bpmn")
p1 = m.run("1", {"a": 1})
p2 = m.run("2", {"a": 2})
run = [p1, p2]
def run_serial():
for i, p in enumerate(run):
print(f"Running process {i+1}\n-----------------")
asyncio.run(p)
print()
def run_parallel():
async def parallel():
await asyncio.gather(p1, p2)
print(f"Running processes\n-----------------")
asyncio.run(parallel())
# run_parallel()
run_serial()
```
Example execution trace:
```python
Running process 1
-----------------
[1] DOING: UserTask(Task 1)
[1] DOING: Task(DOWN)
[1] - waiting for all processes in gate.
[1] DOING: Task(UP)
[1] DOING: ManualTask(Manual Task 2)
[1] DOING: ServiceTask(Task 3)
[1] - checking variables={'a': 1} with ['a==1']... [1] DONE: Result is True
[1] - going down default path...
[1] DOING: Task(Task down)
[1] DONE
Running process 2
-----------------
[2] DOING: UserTask(Task 1)
[2] DOING: Task(DOWN)
[2] - waiting for all processes in gate.
[2] DOING: Task(UP)
[2] DOING: ManualTask(Manual Task 2)
[2] DOING: ServiceTask(Task 3)
[2] - checking variables={'a': 2} with ['a==1']... [2] DONE: Result is False
[2] - going down default path...
[2] DOING: Task(Task down)
[2] DONE
```
MaDaniel
- 粉丝: 816
- 资源: 4571
最新资源
- HTTP协议基础概念解析及其演进过程
- 钢管切割机Creo 7.0全套技术资料100%好用.zip
- MiHealth.apk
- 【深度学习专栏】ch06配套资源
- 机床自动上下料机械手 移载机械手sw14可编辑全套技术资料100%好用.zip
- 小学生出题软件v6.3.3.zip
- MATLAB代码:基于MATLAB的三母线高斯赛德尔潮流分析计算 关键词:潮流计算 电力系统 高斯赛德尔迭代法 MATLAB 参考文献+自制详细实验文档 仿真平台:MATLAB 主要内容:潮流计算是判
- DilateFormer实战:使用DilateFormer实现图像分类任务
- 疫苗预约系统:数据库设计与数据安全性
- 粒子群MPPT多峰值寻优 针对扰动、电导等无法用在局部遮阴下,使用粒子群pso算法克服 附使用说明及解析,包括扰动法PO与粒子群PSO法
- 极片自动制片成型模切机sw16可编辑全套技术资料100%好用.zip
- 基于Python实现的医疗知识图谱的知识问答系统源码毕业设计(高分项目)
- 酒店客房管理系统:集成技术与服务创新
- 5个小游戏源代码和图片、音频等资源
- 知攻善防-应急响应靶机-web2-z05-z07.zip
- Python毕业设计Django+Neo4j基于医疗知识图谱的问答系统项目源码+使用说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论1