def collect(self,
                name: str,
                items: List[IItem],
                metadata: dict,
                interval: int = -1):
        """Collect scheduler item

        Args:
             name: item name, should be unique
             items: specify dependencies
             metadata: pass metadata to share with item dependencies each other
             interval: if value is -1, it's run-once job, or run
                every interval time in seconds
        """
        if len(name) == 0:
            return
        valid_interval = interval == -1 or interval >= 10
        if not valid_interval:  # seems non-sense if interval is less than 10
            raise ValueError('interval should not less than 10 if not -1')
        with get_session(self.db_engine) as session:
            # check name if exists
            existed = session.query(SchedulerItem).filter_by(name=name).first()
            if existed:
                return
            item = SchedulerItem(
                name=name,
                pipeline=PipelineEncoder().encode(
                    self._build_pipeline(name, items, metadata)),
                interval_time=interval,
            )
            session.add(item)
            try:
                session.commit()
            except Exception as e:  # pylint: disable=broad-except
                logging.error(f'[composer] failed to create scheduler_item, '
                              f'name: {name}, exception: {e}')
                session.rollback()
Collect scheduler item

        Args:
             name: item name, should be unique
             items: specify dependencies
             metadata: pass metadata to share with item dependencies each other
             interval: if value is -1, it's run-once job, or run
                every interval time in seconds
        
web_console_v2/api/fedlearner_webconsole/composer/composer.py