diff --git a/requirements-base.txt b/requirements-base.txt index fece2b2366ae..e7f2d7377c99 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -122,7 +122,7 @@ frozenlist==1.4.0 # aiosignal google-api-core==2.11.1 # via google-api-python-client -google-api-python-client==2.99.0 +google-api-python-client==2.100.0 # via -r requirements-base.in google-auth==2.22.0 # via @@ -218,7 +218,7 @@ murmurhash==1.0.9 # preshed # spacy # thinc -numpy==1.25.2 +numpy==1.26.0 # via # -r requirements-base.in # blis @@ -245,7 +245,7 @@ packaging==23.1 # spacy # statsmodels # thinc -pandas==2.1.0 +pandas==2.1.1 # via # -r requirements-base.in # statsmodels diff --git a/requirements-dev.txt b/requirements-dev.txt index d18494ecda1a..d15fe4be7bbd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -34,7 +34,7 @@ executing==1.2.0 # stack-data factory-boy==3.3.0 # via -r requirements-dev.in -faker==19.6.1 +faker==19.6.2 # via # -r requirements-dev.in # factory-boy @@ -90,7 +90,7 @@ python-dateutil==2.8.2 # via faker pyyaml==6.0.1 # via pre-commit -ruff==0.0.289 +ruff==0.0.290 # via -r requirements-dev.in six==1.16.0 # via diff --git a/src/dispatch/incident/service.py b/src/dispatch/incident/service.py index 3c6d06d06433..5c6a70daf5af 100644 --- a/src/dispatch/incident/service.py +++ b/src/dispatch/incident/service.py @@ -289,9 +289,8 @@ def update(*, db_session, incident: Incident, incident_in: IncidentUpdate) -> In incident_severity_in=incident_in.incident_severity, ) - if incident_in.status == IncidentStatus.stable: - if incident.project.stable_priority: - incident_priority = incident.project.stable_priority + if incident_in.status == IncidentStatus.stable and incident.project.stable_priority: + incident_priority = incident.project.stable_priority else: incident_priority = incident_priority_service.get_by_name_or_default( db_session=db_session, diff --git a/src/dispatch/plugins/dispatch_slack/incident/interactive.py b/src/dispatch/plugins/dispatch_slack/incident/interactive.py index b89b6e4ae65e..c47af6a68f54 100644 --- a/src/dispatch/plugins/dispatch_slack/incident/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/incident/interactive.py @@ -1503,7 +1503,7 @@ def handle_report_tactical_command( incident = incident_service.get(db_session=db_session, incident_id=context["subject"].id) if incident.tasks: - actions = "\n".join( + actions += "\n\nOutstanding Incident Tasks:\n".join( [ "-" + task.description for task in incident.tasks diff --git a/src/dispatch/plugins/dispatch_slack/service.py b/src/dispatch/plugins/dispatch_slack/service.py index 17162392bf38..6de65c05c185 100644 --- a/src/dispatch/plugins/dispatch_slack/service.py +++ b/src/dispatch/plugins/dispatch_slack/service.py @@ -38,43 +38,30 @@ def chunks(ids, n): yield ids[i : i + n] -def handle_slack_error(exception: SlackApiError, endpoint: str, kwargs: dict) -> NoReturn: - message = ( - f"SlackAPIError. Response: {exception.response}. Endpoint: {endpoint}. Kwargs: {kwargs}" - ) - error = exception.response["error"] - - if error in { - SlackAPIErrorCode.CHANNEL_NOT_FOUND, - SlackAPIErrorCode.USER_NOT_IN_CHANNEL, - SlackAPIErrorCode.USERS_NOT_FOUND, - }: - log.warn(message) - elif error == SlackAPIErrorCode.FATAL_ERROR: - # NOTE we've experienced a wide range of issues when Slack's performance is degraded - log.error(message) - time.sleep(300) - raise TryAgain from None - elif exception.response.headers.get("Retry-After"): - wait = int(exception.response.headers["Retry-After"]) - log.info(f"SlackError: Rate limit hit. Waiting {wait} seconds.") - time.sleep(wait) - raise TryAgain from None - else: - raise exception - - @retry(stop=stop_after_attempt(5), retry=retry_if_exception_type(TryAgain)) def make_call(client: WebClient, endpoint: str, **kwargs) -> SlackResponse: """Makes a Slack client API call.""" try: if endpoint in set(SlackAPIGetEndpoints): - response = client.api_call(endpoint, http_verb="GET", params=kwargs) - else: - response = client.api_call(endpoint, json=kwargs) - except SlackApiError as e: - handle_slack_error(e, endpoint, kwargs) - return response + return client.api_call(endpoint, http_verb="GET", params=kwargs) + return client.api_call(endpoint, json=kwargs) + except SlackApiError as exception: + message = ( + f"SlackAPIError. Response: {exception.response}. Endpoint: {endpoint}. Kwargs: {kwargs}" + ) + + error = exception.response["error"] + if error == SlackAPIErrorCode.FATAL_ERROR: + # NOTE we've experienced a wide range of issues when Slack's performance is degraded + log.error(message) + time.sleep(300) + raise TryAgain from None + elif exception.response.headers.get("Retry-After"): + wait = int(exception.response.headers["Retry-After"]) + log.info(f"SlackError: Rate limit hit. Waiting {wait} seconds.") + time.sleep(wait) + raise TryAgain from None + raise exception def list_conversation_messages(client: WebClient, conversation_id: str, **kwargs) -> SlackResponse: diff --git a/src/dispatch/static/dispatch/src/incident/store.js b/src/dispatch/static/dispatch/src/incident/store.js index 423225559f00..f14b07a21d3f 100644 --- a/src/dispatch/static/dispatch/src/incident/store.js +++ b/src/dispatch/static/dispatch/src/incident/store.js @@ -219,12 +219,14 @@ const actions = { commit("SET_DIALOG_REPORT", true) commit("SET_SELECTED", incident) - state.report.tactical.actions = incident.tasks.reduce((result, task) => { - if (task.status == "Resolved") { - return result - } - return (result ? result + "\n" : "") + "- " + task.description - }, "") + state.report.tactical.actions += + "\n\nOutstanding Incident Tasks:\n" + + incident.tasks.reduce((result, task) => { + if (task.status == "Resolved") { + return result + } + return (result ? result + "\n" : "") + "- " + task.description + }, "") }, closeReportDialog({ commit }) { commit("SET_DIALOG_REPORT", false)