From patchwork Mon Oct 30 19:51:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B3CC00142 for ; Mon, 30 Oct 2023 19:51:45 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.159186.1698695503468368314 for ; Mon, 30 Oct 2023 12:51:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=pTuXBAh3; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id D281F9C334C for ; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id F1u-NuMkzOKG; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 5E6E19C2BF6; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 5E6E19C2BF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695502; bh=BJJCHJagV8wWB7OftgGDU0y8IUJUDqTzkxwOyUfE7YE=; h=From:To:Date:Message-Id:MIME-Version; b=pTuXBAh3s9TqCwWkxtFwBOt/8B6nssMs3Vv11UWZpIlUgglCUA9cUj78dA8Sqzz5B HIXNzwD2hV0KdXz7ciYSBd+kA2BpWVoMrIF+Tc6i53DgXrfUrrI2McunswVO3aywQC NVfiwatPBm/6rI5hXxEyww6tnsouP2DavVlSVNHQz5FjIJAPfGtgeGqL4s4zvRFhxe 74zKfm2RV+0vglM13ylMLLrS2rXD9nbnij3lRAEuopalADv1Hlqu0wtW+K1WEZArNe ap55SnYyfbb+ZhMnzu+MOK/BkhtPwluGq71IhFN9BZIZJ2sk4T9WuLtwOVCm9JiAvo iMErwQs/TXJRw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id QS8aNiERquUx; Mon, 30 Oct 2023 15:51:42 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 7EF239C0C3C; Mon, 30 Oct 2023 15:51:41 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 2/8] Toaster: Update orm.models to catch error ProcessLookupError Date: Mon, 30 Oct 2023 20:51:26 +0100 Message-Id: <20231030195132.235083-2-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:44 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5905 Signed-off-by: Alassane Yattara --- lib/toaster/orm/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py index 0d503a51..4f6d2147 100644 --- a/lib/toaster/orm/models.py +++ b/lib/toaster/orm/models.py @@ -1389,9 +1389,6 @@ class Machine(models.Model): return "Machine " + self.name + "(" + self.description + ")" - - - class BitbakeVersion(models.Model): name = models.CharField(max_length=32, unique = True) @@ -1838,6 +1835,7 @@ class LogMessage(models.Model): def __str__(self): return force_bytes('%s %s %s' % (self.get_level_display(), self.message, self.build)) + def invalidate_cache(**kwargs): from django.core.cache import cache try: @@ -1845,6 +1843,7 @@ def invalidate_cache(**kwargs): except Exception as e: logger.warning("Problem with cache backend: Failed to clear cache: %s" % e) + def signal_runbuilds(): """Send SIGUSR1 to runbuilds process""" try: @@ -1853,6 +1852,9 @@ def signal_runbuilds(): os.kill(int(pidf.read()), SIGUSR1) except FileNotFoundError: logger.info("Stopping existing runbuilds: no current process found") + except ProcessLookupError: + pass + class Distro(models.Model): search_allowed_fields = ["name", "description", "layer_version__layer__name"]