Exemplo n.º 1
0
Arquivo: api.py Projeto: ktibi/rally
    def task_create(self, values):
        tags = values.pop("tags", None)
        # TODO(ikhudoshyn): currently 'input_task'
        # does not come in 'values'
        # After completely switching to the new
        # DB schema in API we should reconstruct
        # input_task's from associated workloads
        # the same is true for 'pass_sla',
        # 'task_duration', 'validation_result'
        # and 'validation_duration'
        task = models.Task()
        task.update(values)
        task.save()

        if tags:
            for t in set(tags):
                tag = models.Tag()
                tag.update({
                    "uuid": task.uuid,
                    "type": consts.TagType.TASK,
                    "tag": t
                })
                tag.save()
        task.tags = sorted(self._tags_get(task.uuid, consts.TagType.TASK))
        return task
Exemplo n.º 2
0
 def task_create(self, values):
     task = models.Task()
     task.update(values)
     task.save()
     return task