Skip to content
Snippets Groups Projects

INFRA-10659: Implement self-healing mechanism for Netbox jobs

Merged INFRA-10659: Implement self-healing mechanism for Netbox jobs
1 unresolved thread
Merged Fahrudin Halilovic requested to merge feature/INFRA-10659-self-healing-mechanism into main
1 unresolved thread

Closes INFRA-10659

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 39 # Remove the job from its current queue and re-add it with a delay
    40 queue = Queue(job.origin, connection=job.connection)
    41 queue.enqueue_in(timedelta(seconds=delay_seconds), job.func, *job.args, **job.kwargs, job_id=job.id, meta=job.meta)
    42
    43 logger.info(f"Job {job.id} rescheduled with delay of {delay_seconds} seconds for attempt {attempt}.")
    44 except Exception as e:
    45 logger.error(f"Failed to reschedule job {job.id}: {e}")
    46 raise
    47
    48 def retry_on_failure(task_name):
    49 """
    50 A decorator that retries a function if specific network-related exceptions occur.
    51 It retries up to MAX_RETRIES times, and if all attempts fail, it raises an exception
    52 so that Django RQ can mark the job as failed.
    53 """
    54 def decorator(func):
  • Good work! Just a couple of minor comments.

  • Oh, and the pipeline fails on the tests. That should be fixed as well.

  • added 1 commit

    • 12188b92 - fix tests for synchronization

    Compare with previous version

  • added 1 commit

    • 7a1b248f - fix: adjust retry settings and remove InsecureRequestWarning suppression

    Compare with previous version

  • Anders Harrisson approved this merge request

    approved this merge request

  • mentioned in commit aab38df4

  • Please register or sign in to reply
    Loading