TT#96400 improve celery logging for worker

Change-Id: I47c64372d341042746b3f4a37d1ce4bf5f72d00e
pull/3/head
Victor Seva 5 years ago
parent 96d7217c9e
commit 1e5064007b
No known key found for this signature in database
GPG Key ID: B1589889727198E0

@ -1,4 +1,4 @@
# Copyright (C) 2017 The Sipwise Team - http://sipwise.com
# Copyright (C) 2017-2020 The Sipwise Team - http://sipwise.com
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
@ -12,9 +12,8 @@
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
from celery import shared_task
from celery.utils.log import get_task_logger
from .conf import settings
from build.models.br import BuildRelease
@ -22,7 +21,7 @@ from build.utils import trigger_build
from build.utils import trigger_copy_deps
from repoapi.celery import app
logger = logging.getLogger(__name__)
logger = get_task_logger(__name__)
@app.task(bind=True)
@ -37,7 +36,9 @@ def build_release(self, pk):
else:
release = instance.release
url = trigger_copy_deps(
release=release, internal=True, release_uuid=instance.uuid,
release=release,
internal=True,
release_uuid=instance.uuid,
)
logger.info("%s triggered" % url)

@ -1,4 +1,4 @@
# Copyright (C) 2016 The Sipwise Team - http://sipwise.com
# Copyright (C) 2016-2020 The Sipwise Team - http://sipwise.com
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
@ -12,14 +12,13 @@
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
from celery import shared_task
from celery.utils.log import get_task_logger
from .utils import process_hotfix
from repoapi.models import JenkinsBuildInfo
logger = logging.getLogger(__name__)
logger = get_task_logger(__name__)
@shared_task(ignore_result=True)

@ -13,14 +13,14 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import json
import logging
from celery import shared_task
from celery.utils.log import get_task_logger
from django.apps import apps
from .models import ReleaseChanged
logger = logging.getLogger(__name__)
logger = get_task_logger(__name__)
@shared_task(ignore_result=True)
@ -32,7 +32,8 @@ def process_result(jbi_id, path_envVars):
info = data["envMap"]
if info["vmdone"] == "yes":
ReleaseChanged.objects.filter(
version=info["vmversion"], vmtype=info["vmtype"],
version=info["vmversion"],
vmtype=info["vmtype"],
).delete()
logger.info("{}_{} deleted".format(info["vmtype"], info["vmversion"]))
return

@ -1,4 +1,4 @@
# Copyright (C) 2016 The Sipwise Team - http://sipwise.com
# Copyright (C) 2016-2020 The Sipwise Team - http://sipwise.com
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
@ -12,9 +12,8 @@
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
from celery import shared_task
from celery.utils.log import get_task_logger
from .conf import settings
from .models import DockerImage
@ -23,7 +22,7 @@ from .models import Project
from .utils import build
from .utils import docker
logger = logging.getLogger(__name__)
logger = get_task_logger(__name__)
@shared_task(ignore_result=True)

@ -13,11 +13,11 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import json
import logging
from datetime import timedelta
from os.path import basename
from celery import shared_task
from celery.utils.log import get_task_logger
from django.apps import apps
from .celery import app
@ -29,7 +29,7 @@ from .utils import jenkins_get_build
from .utils import jenkins_get_console
from .utils import jenkins_get_env
logger = logging.getLogger(__name__)
logger = get_task_logger(__name__)
@shared_task(ignore_result=True)

Loading…
Cancel
Save