Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit db69916a authored by Thomas Lavocat's avatar Thomas Lavocat
Browse files

Correct bugged linked to new dep API

parent 65560360
import base64
import json
from .. import consts
from .. import consts
from .task import Task
from .task import Dependency
from .task import DependencyEvent
class TaskBag(Task) :
......@@ -18,18 +20,12 @@ class TaskBag(Task) :
self.task_list.append(task)
self.wait_done += 1
task.register_on_state(self.sub_task_state_change)
self.add_dependency_for_transition(consts.INIT_RUNNING,
consts.INIT_RUNNING,
task)
def set_task_list(self, task_list):
self.task_list = task_list
self.wait_done = len(self.task_list)
for task in self.task_list :
task.register_on_state(self.sub_task_state_change)
self.add_dependency_for_transition(consts.INIT_RUNNING,
consts.INIT_RUNNING,
task)
dep = DependencyEvent(task, consts.INIT_RUNNING)
prev_dep = self.get_dependency_for_transition(consts.INIT_RUNNING)
if prev_dep is None :
self.set_dependency_for_transition(consts.INIT_RUNNING, Dependency(Dependency.AND, [dep]))
else :
self.set_dependency_for_transition(consts.INIT_RUNNING, Dependency(Dependency.AND, [dep, prev_dep]))
def runing_state(self) :
pass
......@@ -48,22 +44,12 @@ class TaskBag(Task) :
if self.wait_done is 0 :
self.request_transition(self.state + self.final_state)
def add_all_dependency_for_transition(self, transition, task_t, task) :
self.add_dependency_for_transition(transition, task_t, task)
for t in self.task_list :
t.add_dependency_for_transition(transition, task_t, task)
def add_all_trigger_for_transition(self,transition, task_t, task) :
self.add_trigger_for_transition(transition, task_t, task)
for t in self.task_list :
t.add_trigger_for_transition(transition, task_t, task)
def add_all_dependency_for_state(self, transition, task_t, task) :
self.add_dependency_for_state(transition, task_t, task)
def set_all_dependency_for_transition(self, transition, dependency) :
self.set_dependency_for_transition(transition, dependency)
for t in self.task_list :
t.add_dependency_for_state(transition, task_t, task)
t.set_dependency_for_transition(transition, task_t, task)
def add_all_trigger_for_state(self,transition, task_t, task) :
self.add_trigger_for_state(transition, task_t, task)
def set_all_trigger_for_transition(self,transition, dependency) :
self.set_trigger_for_transition(transition, dependency)
for t in self.task_list :
t.add_trigger_for_state(transition, task_t, task)
t.set_trigger_for_transition(transition, dependency)
......@@ -136,7 +136,14 @@ class Task:
toRemove.append(my_transition)
for my_transition in toRemove :
del self.trigger_transitions[my_transition]
self.apply_transition(my_transition)
arrival_state = my_transition - self.state
if (arrival_state == consts.INIT
or arrival_state == consts.RUNNING
or arrival_state == consts.DONE
or arrival_state == consts.ERROR
or arrival_state == consts.TIMEOUT
or arrival_state == consts.CANCELED ):
self.apply_transition(my_transition)
def execute_when_transition_transition_possible(self, transition, callback) :
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment