| code = 429 | code = 429 | ||||
| class CompilanceRateLimitError(BaseHTTPException): | |||||
| error_code = "compilance_rate_limit" | |||||
| class ComplianceRateLimitError(BaseHTTPException): | |||||
| error_code = "compliance_rate_limit" | |||||
| description = "Rate limit exceeded for downloading compliance report." | description = "Rate limit exceeded for downloading compliance report." | ||||
| code = 429 | code = 429 |
| ): | ): | ||||
| limiter_key = f"{account_id}:{tenant_id}" | limiter_key = f"{account_id}:{tenant_id}" | ||||
| if cls.compliance_download_rate_limiter.is_rate_limited(limiter_key): | if cls.compliance_download_rate_limiter.is_rate_limited(limiter_key): | ||||
| from controllers.console.error import CompilanceRateLimitError | |||||
| from controllers.console.error import ComplianceRateLimitError | |||||
| raise CompilanceRateLimitError() | |||||
| raise ComplianceRateLimitError() | |||||
| json = { | json = { | ||||
| "doc_name": doc_name, | "doc_name": doc_name, |
| description=conv_var.description, | description=conv_var.description, | ||||
| ) | ) | ||||
| draft_conv_vars.append(draft_var) | draft_conv_vars.append(draft_var) | ||||
| _batch_upsert_draft_varaible( | |||||
| _batch_upsert_draft_variable( | |||||
| self._session, | self._session, | ||||
| draft_conv_vars, | draft_conv_vars, | ||||
| policy=_UpsertPolicy.IGNORE, | policy=_UpsertPolicy.IGNORE, | ||||
| OVERWRITE = "overwrite" | OVERWRITE = "overwrite" | ||||
| def _batch_upsert_draft_varaible( | |||||
| def _batch_upsert_draft_variable( | |||||
| session: Session, | session: Session, | ||||
| draft_vars: Sequence[WorkflowDraftVariable], | draft_vars: Sequence[WorkflowDraftVariable], | ||||
| policy: _UpsertPolicy = _UpsertPolicy.OVERWRITE, | policy: _UpsertPolicy = _UpsertPolicy.OVERWRITE, | ||||
| draft_vars = self._build_variables_from_start_mapping(outputs) | draft_vars = self._build_variables_from_start_mapping(outputs) | ||||
| else: | else: | ||||
| draft_vars = self._build_variables_from_mapping(outputs) | draft_vars = self._build_variables_from_mapping(outputs) | ||||
| _batch_upsert_draft_varaible(self._session, draft_vars) | |||||
| _batch_upsert_draft_variable(self._session, draft_vars) | |||||
| @staticmethod | @staticmethod | ||||
| def _should_variable_be_editable(node_id: str, name: str) -> bool: | def _should_variable_be_editable(node_id: str, name: str) -> bool: |
| self, node_data: dict, tenant_id: str, user_id: str, node_id: str, user_inputs: dict[str, Any] | self, node_data: dict, tenant_id: str, user_id: str, node_id: str, user_inputs: dict[str, Any] | ||||
| ) -> WorkflowNodeExecution: | ) -> WorkflowNodeExecution: | ||||
| """ | """ | ||||
| Run draft workflow node | |||||
| Run free workflow node | |||||
| """ | """ | ||||
| # run draft workflow node | |||||
| # run free workflow node | |||||
| start_at = time.perf_counter() | start_at = time.perf_counter() | ||||
| node_execution = self._handle_node_run_result( | node_execution = self._handle_node_run_result( |