def before_processing(objects, self): """ Executed before processing the workflow. """ # 1. Save workflow (ourselves). if not self.db_obj.uuid: self.save() self.set_counter_initial(len(objects)) self.log_info("Workflow has been started") # 2. We want to save all the objects as version 0. for o in objects: same_workflow = \ o.id_workflow and \ o.id_workflow == self.db_obj.uuid if o.id and same_workflow: # If object exists and we are running the same workflow, # do nothing o.log_info("object saving process : was already existing") continue # Set the current workflow id in the object if o.version == CFG_OBJECT_VERSION.INITIAL \ and o.id_workflow is not None: o.log_info("object saving process : was already existing") pass else: o.id_workflow = self.uuid o.save(o.version) GenericWorkflowEngine.before_processing(objects, self)
def before_processing(objects, self): """ Executed before processing the workflow. """ # 1. Save workflow (ourselves). if not self.db_obj.uuid: self.save() self.setCounterInitial(objects) self.log.info("[%s], %s has been started" % (str(datetime.now()), str(self.db_obj.name))) # 2. We want to save all the objects as version 0. for o in objects: same_workflow = \ o.db_obj.workflow_id and \ o.db_obj.workflow_id == self.db_obj.uuid if o.db_obj.id and same_workflow: # If object exists and we are running the same workflow, # do nothing continue # Set the current workflow id in the object if o.db_obj.version == CFG_OBJECT_VERSION.INITIAL \ and o.db_obj.workflow_id is not None: pass else: o.db_obj.workflow_id = self.db_obj.uuid o.save(CFG_OBJECT_VERSION.INITIAL) GenericWorkflowEngine.before_processing(objects, self)
def before_processing(objects, self): """Executed before processing the workflow.""" self.save(status=WorkflowStatus.RUNNING) self.set_counter_initial(len(objects)) workflow_started.send(self) GenericWorkflowEngine.before_processing(objects, self)