question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unclear why job executes multiple times

See original GitHub issue

Describe the bug Setting a cron job to run at ~4pm everyday but the job runs multiple times as the logs show.

To Reproduce

code


_job_defaults = {
    "coalesce": True,  # Trigger only one job to make up for missed jobs.
    "max_instances": 1,  # Allow only one execution of a job per time.
}

local_scheduler: BackgroundScheduler = BackgroundScheduler(
    jobstores={
        "default": job_store,
    },
    executors={
        "default": ThreadPoolExecutor(),
    },
    timezone=_timezone,
    job_defaults=_job_defaults,
)

@local_scheduler.scheduled_job(
    # assuming trader runs in PDT timezone
    name="notify.daily.report",
    trigger=CronTrigger(
        day_of_week="mon-fri",
        hour="16",
        jitter=120,
    ),
)
def my_func()
   ...

Logs:

image

Expected behavior Job should only run once ~4 pm.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
agronholmcommented, Feb 12, 2021

You are not using the latest version. Please upgrade and see if the error persists.

0reactions
agronholmcommented, Aug 17, 2022

The improved jitter feature in v4.0.0a1 eliminates jitter as the cause of such issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - My job executes an arbitrary number of times even though ...
What I am seeing is that method get called multiple times (the amount varies from each run of the console application) and I...
Read more >
is there a way to run the same job multiple times without ...
You might want to take a look at the process to see if there is a way to batch that job. Maybe record...
Read more >
Snakefiles and Rules — Snakemake 7.19.1 documentation
Instead, resources are used to determine which jobs can be executed at the same time without exceeding the limits specified at the command...
Read more >
Uncertain About Hiring, Some Companies Try 'Test Drives'
About half of the 30 people who have been asked to work on a trial basis have moved into full-time jobs, he said....
Read more >
7 Ways to Motivate Employees in Uncertain Times
Here are a few tips for helping employees through uncertain times. ... ask how they're doing, and what support they need to do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found