Ejemplo n.º 1
0
 def get_state(self, payment_info):
     """ Return state of a payment for given task that should be / was made to given node
     :return str|None: return state of payment or none if such payment don't exist in database
     """
     # FIXME: Remove this method
     try:
         return Payment.get(
             Payment.subtask == payment_info.subtask_id).status
     except Payment.DoesNotExist:
         logger.warning(
             "Payment for subtask {} to node {} does not exist".format(
                 payment_info.subtask_id, payment_info.computer.key_id))
         return None
Ejemplo n.º 2
0
 def get_payment_for_subtask(subtask_id):
     try:
         return Payment.get(Payment.subtask == subtask_id).value
     except Payment.DoesNotExist:
         logger.debug("Can't get payment value - payment does not exist")
         return 0