Ejemplo n.º 1
0
 def _save_flowdetail_tasks(self, e_fd, flow_detail):
     for task_detail in flow_detail:
         e_td = e_fd.find(task_detail.uuid)
         if e_td is None:
             e_td = logbook.TaskDetail(name=task_detail.name, uuid=task_detail.uuid)
             e_fd.add(e_td)
         if task_detail.uuid not in self.backend.task_details:
             self.backend.task_details[task_detail.uuid] = e_td
         p_utils.task_details_merge(e_td, task_detail, deep_copy=True)
Ejemplo n.º 2
0
 def _save_flowdetail_tasks(self, e_fd, flow_detail):
     for task_detail in flow_detail:
         e_td = e_fd.find(task_detail.uuid)
         if e_td is None:
             e_td = logbook.TaskDetail(name=task_detail.name,
                                       uuid=task_detail.uuid)
             e_fd.add(e_td)
         if task_detail.uuid not in self.backend.task_details:
             self.backend.task_details[task_detail.uuid] = e_td
         p_utils.task_details_merge(e_td, task_detail, deep_copy=True)
Ejemplo n.º 3
0
 def update_task_details(self, task_detail):
     try:
         e_td = self.backend.task_details[task_detail.uuid]
     except KeyError:
         raise exc.NotFound("No task details found with id: %s"
                            % task_detail.uuid)
     return p_utils.task_details_merge(e_td, task_detail, deep_copy=True)
Ejemplo n.º 4
0
 def update_task_details(self, task_detail):
     try:
         e_td = self.backend.task_details[task_detail.uuid]
     except KeyError:
         raise exc.NotFound("No task details found with id: %s" %
                            task_detail.uuid)
     return p_utils.task_details_merge(e_td, task_detail, deep_copy=True)
Ejemplo n.º 5
0
 def update_task_details(self, task_detail):
     try:
         return p_utils.task_details_merge(_TASK_DETAILS[task_detail.uuid],
                                           task_detail)
     except KeyError:
         raise exc.NotFound("No task details found with id: %s"
                            % task_detail.uuid)
Ejemplo n.º 6
0
 def _save_task_details(self, task_detail, ignore_missing):
     # See if we have an existing task detail to merge with.
     e_td = None
     try:
         e_td = self._get_task_details(task_detail.uuid, lock=False)
     except EnvironmentError:
         if not ignore_missing:
             raise exc.NotFound("No task details found with id: %s"
                                % task_detail.uuid)
     if e_td is not None:
         task_detail = p_utils.task_details_merge(e_td, task_detail)
     td_path = os.path.join(self._task_path, task_detail.uuid)
     td_data = p_utils.format_task_detail(task_detail)
     self._write_to(td_path, jsonutils.dumps(td_data))
     return task_detail
Ejemplo n.º 7
0
 def _save_task_details(self, task_detail, ignore_missing):
     # See if we have an existing task detail to merge with.
     e_td = None
     try:
         e_td = self._get_task_details(task_detail.uuid, lock=False)
     except EnvironmentError:
         if not ignore_missing:
             raise exc.NotFound("No task details found with id: %s"
                                % task_detail.uuid)
     if e_td is not None:
         task_detail = p_utils.task_details_merge(e_td, task_detail)
     td_path = os.path.join(self._task_path, task_detail.uuid)
     td_data = p_utils.format_task_detail(task_detail)
     self._write_to(td_path, jsonutils.dumps(td_data))
     return task_detail
Ejemplo n.º 8
0
    def _update_task_details(self, td, txn, create_missing=False):
        # Determine whether the desired data exists or not.
        td_path = paths.join(self.task_path, td.uuid)
        try:
            td_data, _zstat = self._client.get(td_path)
        except k_exc.NoNodeError:
            # Not-existent: create or raise exception.
            if create_missing:
                txn.create(td_path)
                e_td = logbook.TaskDetail(name=td.name, uuid=td.uuid)
            else:
                raise exc.NotFound("No task details found with id: %s"
                                   % td.uuid)
        else:
            # Existent: read it out.
            e_td = p_utils.unformat_task_detail(td.uuid,
                                                misc.decode_json(td_data))

        # Update and write it back
        e_td = p_utils.task_details_merge(e_td, td)
        td_data = p_utils.format_task_detail(e_td)
        txn.set_data(td_path, misc.binary_encode(jsonutils.dumps(td_data)))
        return e_td
Ejemplo n.º 9
0
    def _update_task_details(self, td, txn, create_missing=False):
        # Determine whether the desired data exists or not.
        td_path = paths.join(self.task_path, td.uuid)
        try:
            td_data, _zstat = self._client.get(td_path)
        except k_exc.NoNodeError:
            # Not-existent: create or raise exception.
            if create_missing:
                txn.create(td_path)
                e_td = logbook.TaskDetail(name=td.name, uuid=td.uuid)
            else:
                raise exc.NotFound("No task details found with id: %s" %
                                   td.uuid)
        else:
            # Existent: read it out.
            e_td = p_utils.unformat_task_detail(td.uuid,
                                                misc.decode_json(td_data))

        # Update and write it back
        e_td = p_utils.task_details_merge(e_td, td)
        td_data = p_utils.format_task_detail(e_td)
        txn.set_data(td_path, misc.binary_encode(jsonutils.dumps(td_data)))
        return e_td
Ejemplo n.º 10
0
def _taskdetails_merge(td_m, td):
    return persistence_utils.task_details_merge(td_m, td)
Ejemplo n.º 11
0
def _taskdetails_merge(td_m, td):
    return persistence_utils.task_details_merge(td_m, td)