Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • lava lava
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 94
    • Issues 94
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 45
    • Merge requests 45
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • lava
  • lavalava
  • Issues
  • #614

Closed
Open
Created Jun 15, 2023 by Igor Ponomarev@igo95862Contributor

testjob_init_handler signal conflicts with .only()

Try running

t = TestJob.objects.only("pk", "actual_device_id").first()

What happens is:

Unable to execute signal 'testjob_init_handler', ignoring
maximum recursion depth exceeded while calling a Python object
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lava_scheduler_app/signals.py", line 30, in function_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/lava_scheduler_app/signals.py", line 124, in testjob_init_handler
    instance._old_state = instance.state
  File "/usr/lib/python3/dist-packages/django/db/models/query_utils.py", line 135, in __get__
    instance.refresh_from_db(fields=[self.field_name])
  File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 619, in refresh_from_db
    db_instance_qs = self.__class__._base_manager.db_manager(using, hints=hints).filter(pk=self.pk)
  File "/usr/lib/python3/dist-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/db/models/manager.py", line 144, in get_queryset
    return self._queryset_class(model=self.model, using=self._db, hints=self._hints)
  File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 193, in __init__
    self.query = query or sql.Query(self.model)
  File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 155, in __init__
    self.alias_map = OrderedDict()
RecursionError: maximum recursion depth exceeded while calling a Python object

The reason is testjob_init_handler wants to access health and state attributes which triggers TestJob models initialisation which triggers testjob_init_handler...

Django advises against using signals so I think there is a room for argument to replace signals with a more explicit code.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking