code: def on_ok(self, sender):
          
          logger.debug("in on_ok with sender %s" % sender)
  
          if self.all_ok:
              if self.finalized:
                  return AttrDict(returncode=0, message="Work has been already finalized")
              else:
                  # Set finalized here, because on_all_ok might change it (e.g. Relax + EOS in a single work)
                  self.finalized = True
                  try:
                      results = AttrDict(**self.on_all_ok())
                  except Exception as exc:
                      self.history.critical("on_all_ok raises %s" % str(exc))
                      self.finalized = False
                      raise
  
                  # Signal to possible observers that the `Work` reached S_OK
                  self.history.info("Work %s is finalized and broadcasts signal S_OK" % str(self))
                  if self._finalized:
                      self.send_signal(self.S_OK)
  
                  return results
  
          return AttrDict(returncode=1, message="Not all tasks are OK!")
docs: This callback is called when one task reaches status `S_OK`.
          It executes on_all_ok when all tasks in self have reached `S_OK`.