Skip to content

Commit

Permalink
fixing dag triggering
Browse files Browse the repository at this point in the history
  • Loading branch information
tkalir committed Apr 23, 2024
1 parent 44f0962 commit c4195cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion anyway/telegram_accident_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def create_public_urls_for_infographics_images(folder_name):
presigned_urls[infographic_name] = url
return presigned_urls

@staticmethod

def trigger_generate_infographics_and_send_to_telegram(newsflash_id, pre_verification_chat=True):
dag_conf = {"news_flash_id": newsflash_id}
dag_conf["chat_id"] = TELEGRAM_CHANNEL_CHAT_ID if pre_verification_chat \
Expand Down
8 changes: 4 additions & 4 deletions anyway/views/news_flash/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import logging
import pandas as pd
import os

from typing import List, Optional
from http import HTTPStatus
Expand All @@ -13,7 +14,6 @@
from flask import request, Response, make_response, jsonify
from sqlalchemy import and_, not_, or_


from anyway.app_and_db import db
from anyway.backend_constants import (
BE_CONST,
Expand All @@ -38,8 +38,8 @@
DEFAULT_LIMIT_REQ_PARAMETER = 100
DEFAULT_NUMBER_OF_YEARS_AGO = 5

class NewsFlashQuery(BaseModel):

class NewsFlashQuery(BaseModel):
id: Optional[int]
road_number: Optional[int]
offset: Optional[int] = DEFAULT_OFFSET_REQ_PARAMETER
Expand Down Expand Up @@ -407,7 +407,8 @@ def update_news_flash_qualifying(id):
new_location=new_location,
new_qualification=new_location_qualifiction,
)
if new_location_qualifiction == NewsflashLocationQualification.MANUAL.value and \
if os.environ.get("FLASK_ENV") == "production" and \
new_location_qualifiction == NewsflashLocationQualification.MANUAL.value and \
old_location_qualifiction != NewsflashLocationQualification.MANUAL.value:
trigger_generate_infographics_and_send_to_telegram(id, False)
return Response(status=HTTPStatus.OK)
Expand Down Expand Up @@ -469,7 +470,6 @@ def get_downloaded_data(format, years_ago):
columns[AccidentMarkerView.x] = 'X קואורדינטה'
columns[AccidentMarkerView.y] = 'Y קואורדינטה'


related_accidents = get_accidents_stats(
table_obj=AccidentMarkerView,
columns=columns.keys(),
Expand Down

0 comments on commit c4195cf

Please sign in to comment.