Exemplo n.º 1
0
    def UpdateActionHistoryToRetry(self, action_history):
        """
        [概要]
          再実行させるようにアクション履歴を更新する
        """

        logger.logic_log('LOSI00001',
                         'action_history_id: %s' % (action_history.pk))
        try:
            with transaction.atomic():
                action_history.retry_status = PROCESSING
                action_history.retry_flag = False
                action_history.status_update_id = gethostname()
                action_history.last_update_user = self.last_update_user
                action_history.last_update_timestamp = ActCommon.getStringNowDateTime(
                )
                action_history.save(force_update=True)

                logger.logic_log('LOSI00002', 'None')

                return True

        except Exception as e:
            logger.logic_log('LOSM01001', traceback.format_exc())
            return False
Exemplo n.º 2
0
    def OASE_T_RHDM_RESPONSE_update(self, rhdm_response):
        """
        [概要]
          ルールマッチング結果管理更新メゾット
        """
        logger.logic_log('LOSI00001', 'None')

        try:
            with transaction.atomic():
                rhdm_response.status_update_id = self.hostname
                rhdm_response.last_update_user = self.last_update_user
                rhdm_response.last_update_timestamp = ActCommon.getStringNowDateTime(
                )
                rhdm_response.save(force_update=True)
            return True

        except Exception as ex:
            logger.logic_log('LOSM01001', traceback.format_exc())
            return False
Exemplo n.º 3
0
    def do_normal(self, aryPCB):
        """
        アクション通常実行
        """
        # ルールマッチング結果管理:未処理データをレスポンス受信日時の昇順で取得
        now = ActCommon.getStringNowDateTime()
        rhdm_response_list = RhdmResponse.objects.filter(
            request_type_id=PRODUCTION).filter(
                Q(status=UNPROCESS)
                | Q(status=WAITING)
                | Q(status=ACTION_HISTORY_STATUS.RETRY,
                    resume_timestamp__isnull=False,
                    resume_timestamp__lte=now)).order_by(
                        'request_reception_time')

        logger.logic_log('LOSI01000', str(len(rhdm_response_list)), None)

        if len(rhdm_response_list) > 0:
            for rhdm_res in rhdm_response_list:
                trace_id = rhdm_res.trace_id
                response_id = rhdm_res.response_id
                resume_order = rhdm_res.resume_order

                logger.logic_log('LOSI01001', trace_id)

                # 待機中以外はステータスを処理中に更新
                if rhdm_res.status != WAITING:
                    rhdm_res.status = PROCESSING
                result = self.OASE_T_RHDM_RESPONSE_update(rhdm_res)

                if not result:
                    logger.logic_log('LOSM01005', trace_id)
                    return False

                # 子プロセス起動
                ret = self.ExecuteSubProcess(aryPCB, 'normal', response_id,
                                             trace_id, resume_order)
                if not ret:
                    logger.logic_log('LOSM01006', trace_id)
                    return False

        return True