Esempio n. 1
0
    def _check_all_results_provided(self, atom_name, data):
        """Warn if an atom did not provide some of its expected results.

        This may happen if atom returns shorter tuple or list or dict
        without all needed keys. It may also happen if atom returns
        result of wrong type.
        """
        result_mapping = self._result_mappings.get(atom_name)
        if not result_mapping:
            return
        for name, index in six.iteritems(result_mapping):
            try:
                misc.item_from(data, index, name=name)
            except exceptions.NotFound:
                LOG.warning("Atom %s did not supply result "
                            "with index %r (name %s)", atom_name, index, name)
Esempio n. 2
0
    def _check_all_results_provided(self, task_name, data):
        """Warn if task did not provide some of results

        This may happen if task returns shorter tuple or list or dict
        without all needed keys. It may also happen if task returns
        result of wrong type.
        """
        result_mapping = self._result_mappings.get(task_name, None)
        if result_mapping is None:
            return
        for name, index in six.iteritems(result_mapping):
            try:
                misc.item_from(data, index, name=name)
            except exceptions.NotFound:
                LOG.warning("Task %s did not supply result "
                            "with index %r (name %s)",
                            task_name, index, name)
Esempio n. 3
0
    def _check_all_results_provided(self, task_name, data):
        """Warn if task did not provide some of results.

        This may happen if task returns shorter tuple or list or dict
        without all needed keys. It may also happen if task returns
        result of wrong type.
        """
        result_mapping = self._result_mappings.get(task_name)
        if not result_mapping:
            return
        for name, index in six.iteritems(result_mapping):
            try:
                misc.item_from(data, index, name=name)
            except exceptions.NotFound:
                LOG.warning(
                    "Task %s did not supply result "
                    "with index %r (name %s)", task_name, index, name)
Esempio n. 4
0
 def fetch(self, name):
     """Fetch named task result"""
     try:
         indexes = self._reverse_mapping[name]
     except KeyError:
         raise exceptions.NotFound("Name %r is not mapped" % name)
     # Return the first one that is found.
     for task_name, index in reversed(indexes):
         try:
             result = self.get(task_name)
             return misc.item_from(result, index, name=name)
         except exceptions.NotFound:
             pass
     raise exceptions.NotFound("Unable to find result %r" % name)
Esempio n. 5
0
 def fetch(self, name):
     """Fetch named task result."""
     with self._lock.read_lock():
         try:
             indexes = self._reverse_mapping[name]
         except KeyError:
             raise exceptions.NotFound("Name %r is not mapped" % name)
         # Return the first one that is found.
         for (task_name, index) in reversed(indexes):
             try:
                 result = self.get(task_name)
                 return misc.item_from(result, index, name=name)
             except exceptions.NotFound:
                 pass
         raise exceptions.NotFound("Unable to find result %r" % name)
Esempio n. 6
0
 def fetch(self, name):
     """Fetch a named atoms result."""
     with self._lock.read_lock():
         try:
             indexes = self._reverse_mapping[name]
         except KeyError:
             raise exceptions.NotFound("Name %r is not mapped" % name)
         # Return the first one that is found.
         for (atom_name, index) in reversed(indexes):
             if not atom_name:
                 results = self._transients
             else:
                 results = self._get(atom_name, only_last=True)
             try:
                 return misc.item_from(results, index, name)
             except exceptions.NotFound:
                 pass
         raise exceptions.NotFound("Unable to find result %r" % name)