Пример #1
0
    async def create_step(self, id, step: Step):
        try:
            step.id = shortuuid.uuid()
            item = self._find_by_id(id)

            step.instance = FermentStep(self.cbpi, step.id, step.name, None,
                                        self._done)

            item.steps.append(step)
            self.save()
            return step
        except Exception as e:
            self.logger.error(e)
Пример #2
0
 async def add(self, item: Step):
     logging.debug("Add step")
     item.id = shortuuid.uuid()
     item.status = StepState.INITIAL
     try:
         type_cfg = self.types.get(item.type)
         clazz = type_cfg.get("class")
         item.instance = clazz(self.cbpi, item.id, item.name, item.props, self.done)
     except Exception as e:
         logging.warning("Failed to create step instance %s - %s "  % (id, e))
         item.instance = None
     self.profile.append(item)
     await self.save()
     return item