def _parse_mover_id_from_mover_output(mover_output):
     log.debug('Mover output was: {}'.format(mover_output))
     pattern = re.compile('^(.+-\w+-\d+)$')
     hits = pattern.match(mover_output)
     if hits:
         return hits.group(1)
     else:
         raise CannotParseMoverOutputException("Could not parse mover id from: {}".format(mover_output))
 def _parse_status_from_mover_info_result(mover_info_result):
     #Parse status from this type of example string:
     # Delivered: Jan 19 00:23:31 [1484781811UTC]
     pattern = re.compile('^(\w+):\s')
     hits = pattern.match(mover_info_result)
     if hits:
         return hits.group(1)
     else:
         raise CannotParseMoverOutputException("Could not parse mover info status from: {}".
                                               format(mover_info_result))
    def _run_mover_info(self, mover_delivery_order_id):

        cmd = [os.path.join(self.path_to_mover, 'moverinfo'), '-i', mover_delivery_order_id]
        execution_result = yield self.moverinfo_external_program_service.run_and_wait(cmd)

        if execution_result.status_code == 0:
            mover_status = MoverDeliveryService._parse_status_from_mover_info_result(execution_result.stdout)
        else:
            raise CannotParseMoverOutputException("moverinfo returned a non-zero exit status: {}".
                                                  format(execution_result))
        return mover_status