Skip to content
Snippets Groups Projects
Commit 9303d344 authored by Timothe Jost's avatar Timothe Jost
Browse files

little change to revert the ability to run create_celery_app without raising exceptions if it fails

parent a6c8c424
No related branches found
No related tags found
No related merge requests found
Pipeline #127804 passed
__version__ = "0.0.48" __version__ = "0.0.49"
from . import loggs from . import loggs
from .pipes import * from .pipes import *
......
...@@ -316,8 +316,26 @@ class LogTask: ...@@ -316,8 +316,26 @@ class LogTask:
def create_celery_app(conf_path, app_name="pypelines", v_host=None) -> "Celery | None": def create_celery_app(conf_path, app_name="pypelines", v_host=None) -> "Celery | None":
failure_message = (
f"Celery app : {app_name} failed to be created."
"Don't worry, about this alert, "
"this is not be an issue if you didn't explicitely planned on using celery. Issue was : "
)
logger = getLogger("pypelines.create_celery_app")
if app_name in APPLICATIONS_STORE.keys():
logger.warning(f"Tried to create a celery app named {app_name}, but it already exists. Returning it instead.")
return APPLICATIONS_STORE[app_name]
try:
from celery import Task
except ImportError as e:
logger.warning(f"{failure_message} Could not import celery app. {e}")
return None
from types import MethodType from types import MethodType
from celery import Task
def get_setting_files_path(conf_path) -> List[Path]: def get_setting_files_path(conf_path) -> List[Path]:
conf_path = Path(conf_path) conf_path = Path(conf_path)
...@@ -480,18 +498,6 @@ def create_celery_app(conf_path, app_name="pypelines", v_host=None) -> "Celery | ...@@ -480,18 +498,6 @@ def create_celery_app(conf_path, app_name="pypelines", v_host=None) -> "Celery |
) )
return task_record return task_record
failure_message = (
f"Celery app : {app_name} failed to be created."
"Don't worry, about this alert, "
"this is not be an issue if you didn't explicitely planned on using celery. Issue was : "
)
logger = getLogger("pypelines.create_celery_app")
if app_name in APPLICATIONS_STORE.keys():
logger.warning(f"Tried to create a celery app named {app_name}, but it already exists. Returning it instead.")
return APPLICATIONS_STORE[app_name]
settings_files = get_setting_files_path(conf_path) settings_files = get_setting_files_path(conf_path)
if len(settings_files) == 0: if len(settings_files) == 0:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment