-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMEW.py
60 lines (49 loc) · 1.44 KB
/
MEW.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from MSW import MSW
class MEW(object):
"""docstring for MEW"""
def __init__(self):
self.tasks = ["Basic workflow definition","Define Atomic tasks","Define roles","Define Sequence", "Link roles and tasks"]
self.workflow = None
def create_workflow_instance(self):
self.workflow = MSW()
def Update_state_running(self):
self.workflow.state = "Running"
def execute_task(self,task):
if task == self.tasks[0]:
self.workflow.basic_workflow_definition()
elif task == self.tasks[1]:
self.workflow.define_atomic_tasks()
elif task == self.tasks[2]:
self.workflow.define_roles()
elif task == self.tasks[3]:
self.workflow.sequence_of_tasks(self.workflow.tasks)
self.workflow.conditions_on_tasks(self.workflow.sequence)
elif task == self.tasks[4]:
self.workflow.link_roles_to_tasks(self.workflow.tasks, self.workflow.roles)
def check_resources(self,task):
return True
def check_availablity(self,a):
if a < len(self.tasks):
return True
return False
def get_task(self,i):
return self.tasks[i]
def update_state_complete(self):
self.workflow.state = "Complete"
def run(self):
i = 0
self.create_workflow_instance()
self.Update_state_running()
while True:
if not self.check_availablity(i):
break
task = self.get_task(i)
if not self.check_resources(task):
continue
self.execute_task(task)
i = i + 1
self.update_state_complete()
self.workflow.run()
if __name__ == "__main__":
m = MEW()
m.run()