Ocf120 implement eventreq 2
5 unresolved threads
5 unresolved threads
Proposers
- name-of-proposer-1 (institution-of-proposer-1)
- name-of-proposer-2 (institution-of-proposer-2) ...
Description
Describe your proposal in ~1000 characters. You can reference external content listed in section "References" as [Ref-1].
Demo or definition of done
Describe which high level conditions needs to be fulfilled to demonstrate this feature implementation is completed. You can reference external content (example, demo paper) listed in section "References" as [Ref-2].
References
- Reference name
- Author1, Author2, Author3, et. al., “My demo using feature,” in Conference-Name Demo Track, 20XX.
Acknowledgements
This work is funded by the European Commission through the project with Grant Agreement number .
example HORIZON-JU-SNS-2022 FLEX-SCALE project with Grant Agreement number 101096909.
Merge request reports
Activity
changed milestone to %Release 3
added Scopecapif code label
requested review from @jorge.moratinossalcines
assigned to @pelayo.torresalonso
66 else: 67 current_app.logger.error("monDur is in the past") 68 return bad_request_error( 69 detail="Bad Param", 70 cause="monDur is in the past", 71 invalid_params=[{"param": "monDur", "reason": "monDur is in the past"}] 72 ) 73 74 if event_subscription.event_req.notif_method == "PERIODIC" and event_subscription.event_req.rep_period is None: 75 current_app.logger.error("Periodic notification method selected but repPeriod not provided") 76 return bad_request_error( 77 detail="Bad Param", 78 cause="Periodic notification method selected but repPeriod not provided", 79 invalid_params=[{"param": "repPeriod", "reason": "Periodic notification method selected but repPeriod not provided"}] 80 ) 81 return expired_at - services/celery/requirements.txt 0 → 100644
- services/celery/tasks.py 0 → 100644
1 # celery/tasks.py 2 from celery import Celery 3 from datetime import datetime, timezone 4 import pymongo 5 import os 6 from bson.codec_options import CodecOptions 7 from config import Config 8 import aiohttp 9 import asyncio 10 11 # Celery Configuration 12 # celery = Celery( 13 # "notifications", 14 # broker=os.environ.get("CELERY_BROKER_URL", "redis://redis:6379/0"), 15 # backend=os.environ.get("CELERY_RESULT_BACKEND", "redis://redis:6379/0") 16 # ) - services/celery/tasks.py 0 → 100644
96 async with session.post(url, json=data, timeout=timeout, headers=headers) as response: 97 return await response.text() 98 99 async def send(url, data): 100 try: 101 response = await send_request(url, data) 102 print(response) 103 except asyncio.TimeoutError: 104 print("Timeout: Request timeout") 105 except Exception as e: 106 print("An exception occurred sending notification::" + str(e)) 107 return False 108 109 @celery.task(name="celery.tasks.check_notifications_collection") 110 def my_periodic_task(): 111 # print("Checking notifications collection...") - services/celery/tasks.py 0 → 100644
114 notification_data = notifications_col.find_one_and_delete( 115 {"next_report_time": {"$lt": datetime.now(timezone.utc)}} 116 ) 117 if not notification_data: 118 break 119 except pymongo.errors.AutoReconnect: 120 print("MongoDB connection failed. Retrying...") 121 continue 122 123 try: 124 print(f"sending notification to {notification_data['url']}") 125 asyncio.run(send(notification_data["url"], notification_data["notification"])) 126 except Exception as e: 127 print(f"Error sending notification: {e}") 128 129 # print("Finished processing notifications.")
Please register or sign in to reply