def add_image(self, image: 'Image'): """ Add image for model and save it to meta repo :param image: image to add """ if image.model_id is not None and image.model_id != self.id: raise errors.MetadataError('Image is already in model {}. Delete it first'.format(image.model_id)) image.model_id = self.id self._meta.save_image(image) self._images.add(image)
def add_model(self, model: 'Model'): """ Add model to task and save it to meta repo :param model: model to add """ if model.task_id is not None and model.task_id != self.id: raise errors.MetadataError('Model is already in task {}. Delete it first'.format(model.task_id)) model.task_id = self.id self._meta.save_model(model) self._models.add(model) return model.bind_artifact_repo(self._art)
def add_task(self, task: 'Task'): """ Add task to project and save it to meta repo :param task: task to add """ if task.project_id is not None and task.project_id != self.id: raise errors.MetadataError('Task is already in project {}. Delete it first'.format(task.project_id)) task.project_id = self.id self._meta.save_task(task) self._tasks.add(task) return task.bind_artifact_repo(self._art)
def add_pipeline(self, pipeline: 'Pipeline'): """ Add model to task and save it to meta repo :param pipeline: pipeline to add """ if pipeline.task_id is not None and pipeline.task_id != self.id: raise errors.MetadataError( 'Pipeline is already in task {}. Delete it first'.format( pipeline.task_id)) pipeline.task_id = self.id self._meta.save_pipeline(pipeline) self._pipelines.add(pipeline)